org.apache.beam.sdk.io.FileBasedSink.OutputFileHints Java Examples
The following examples show how to use
org.apache.beam.sdk.io.FileBasedSink.OutputFileHints.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DynamicOneFilePerWindow.java From dlp-dataflow-deidentification with Apache License 2.0 | 6 votes |
@Override public ResourceId windowedFilename( int shardNumber, int numShards, BoundedWindow window, PaneInfo paneInfo, OutputFileHints outputFileHints) { IntervalWindow intervalWindow = (IntervalWindow) window; String filename = String.format( "%s-%s-of-%s%s", filenamePrefixForWindow(intervalWindow), shardNumber, numShards, outputFileHints.getSuggestedFilenameSuffix()); return baseFilename .getCurrentDirectory() .resolve(filename, StandardResolveOptions.RESOLVE_FILE); }
Example #2
Source File: DefaultFilenamePolicy.java From beam with Apache License 2.0 | 6 votes |
@Override public ResourceId windowedFilename( int shardNumber, int numShards, BoundedWindow window, PaneInfo paneInfo, OutputFileHints outputFileHints) { String paneStr = paneInfoToString(paneInfo); String windowStr = windowToString(window); return constructName( params.baseFilename.get(), params.shardTemplate, params.suffix + outputFileHints.getSuggestedFilenameSuffix(), shardNumber, numShards, paneStr, windowStr); }
Example #3
Source File: WriteFilesTest.java From beam with Apache License 2.0 | 6 votes |
@Override public ResourceId windowedFilename( int shardNumber, int numShards, BoundedWindow window, PaneInfo paneInfo, OutputFileHints outputFileHints) { DecimalFormat df = new DecimalFormat("0000"); IntervalWindow intervalWindow = (IntervalWindow) window; String filename = String.format( "%s-%s-of-%s%s%s", filenamePrefixForWindow(intervalWindow), df.format(shardNumber), df.format(numShards), outputFileHints.getSuggestedFilenameSuffix(), suffix); return baseFilename .getCurrentDirectory() .resolve(filename, StandardResolveOptions.RESOLVE_FILE); }
Example #4
Source File: WriteOneFilePerWindow.java From beam with Apache License 2.0 | 6 votes |
@Override public ResourceId windowedFilename( int shardNumber, int numShards, BoundedWindow window, PaneInfo paneInfo, OutputFileHints outputFileHints) { IntervalWindow intervalWindow = (IntervalWindow) window; String filename = String.format( "%s-%s-of-%s%s", filenamePrefixForWindow(intervalWindow), shardNumber, numShards, outputFileHints.getSuggestedFilenameSuffix()); return baseFilename .getCurrentDirectory() .resolve(filename, StandardResolveOptions.RESOLVE_FILE); }
Example #5
Source File: WriteFilesTest.java From beam with Apache License 2.0 | 6 votes |
@Override public ResourceId unwindowedFilename( int shardNumber, int numShards, OutputFileHints outputFileHints) { DecimalFormat df = new DecimalFormat("0000"); String prefix = baseFilename.isDirectory() ? "" : firstNonNull(baseFilename.getFilename(), ""); String filename = String.format( "%s-%s-of-%s%s%s", prefix, df.format(shardNumber), df.format(numShards), outputFileHints.getSuggestedFilenameSuffix(), suffix); return baseFilename .getCurrentDirectory() .resolve(filename, StandardResolveOptions.RESOLVE_FILE); }
Example #6
Source File: WriteToText.java From beam with Apache License 2.0 | 6 votes |
@Override public ResourceId windowedFilename( int shardNumber, int numShards, BoundedWindow window, PaneInfo paneInfo, OutputFileHints outputFileHints) { IntervalWindow intervalWindow = (IntervalWindow) window; String filename = String.format( "%s-%s-of-%s%s", filenamePrefixForWindow(intervalWindow), shardNumber, numShards, outputFileHints.getSuggestedFilenameSuffix()); return prefix.getCurrentDirectory().resolve(filename, StandardResolveOptions.RESOLVE_FILE); }
Example #7
Source File: WindowedFilenamePolicy.java From DataflowTemplates with Apache License 2.0 | 6 votes |
/** * The windowed filename method will construct filenames per window according to the baseFile, * suffix, and shardTemplate supplied. Directories with date templates in them will automatically * have their values resolved. For example the outputDirectory of /YYYY/MM/DD would resolve to * /2017/01/08 on January 8th, 2017. */ @Override public ResourceId windowedFilename( int shardNumber, int numShards, BoundedWindow window, PaneInfo paneInfo, OutputFileHints outputFileHints) { ResourceId outputFile = resolveWithDateTemplates(outputDirectory, window) .resolve(outputFilenamePrefix.get(), StandardResolveOptions.RESOLVE_FILE); DefaultFilenamePolicy policy = DefaultFilenamePolicy.fromStandardParameters( StaticValueProvider.of(outputFile), shardTemplate.get(), suffix.get(), true); ResourceId result = policy.windowedFilename(shardNumber, numShards, window, paneInfo, outputFileHints); LOG.debug("Windowed file name policy created: {}", result.toString()); return result; }
Example #8
Source File: WindowedFilenamePolicy.java From DataflowTemplates with Apache License 2.0 | 6 votes |
/** * The windowed filename method will construct filenames per window according to the baseFile, * suffix, and shardTemplate supplied. Directories with date templates in them will automatically * have their values resolved. For example the outputDirectory of /YYYY/MM/DD would resolve to * /2017/01/08 on January 8th, 2017. */ @Override public ResourceId windowedFilename( int shardNumber, int numShards, BoundedWindow window, PaneInfo paneInfo, OutputFileHints outputFileHints) { ResourceId outputFile = resolveWithDateTemplates(outputDirectory, window) .resolve(outputFilenamePrefix.get(), StandardResolveOptions.RESOLVE_FILE); DefaultFilenamePolicy policy = DefaultFilenamePolicy.fromStandardParameters( StaticValueProvider.of(outputFile), shardTemplate.get(), suffix.get(), true); ResourceId result = policy.windowedFilename(shardNumber, numShards, window, paneInfo, outputFileHints); LOG.debug("Windowed file name policy created: {}", result.toString()); return result; }
Example #9
Source File: AvroIOTest.java From beam with Apache License 2.0 | 6 votes |
@Override public ResourceId windowedFilename( int shardNumber, int numShards, BoundedWindow window, PaneInfo paneInfo, OutputFileHints outputFileHints) { String filenamePrefix = outputFilePrefix.isDirectory() ? "" : firstNonNull(outputFilePrefix.getFilename(), ""); IntervalWindow interval = (IntervalWindow) window; String windowStr = String.format("%s-%s", interval.start().toString(), interval.end().toString()); String filename = String.format( "%s-%s-%s-of-%s-pane-%s%s%s.avro", filenamePrefix, windowStr, shardNumber, numShards, paneInfo.getIndex(), paneInfo.isLast() ? "-last" : "", outputFileHints.getSuggestedFilenameSuffix()); return outputFilePrefix.getCurrentDirectory().resolve(filename, RESOLVE_FILE); }
Example #10
Source File: WriteOneFilePerWindow.java From deployment-examples with MIT License | 6 votes |
@Override public ResourceId windowedFilename( int shardNumber, int numShards, BoundedWindow window, PaneInfo paneInfo, OutputFileHints outputFileHints) { IntervalWindow intervalWindow = (IntervalWindow) window; String filename = String.format( "%s-%s-of-%s%s", filenamePrefixForWindow(intervalWindow), shardNumber, numShards, outputFileHints.getSuggestedFilenameSuffix()); return baseFilename .getCurrentDirectory() .resolve(filename, StandardResolveOptions.RESOLVE_FILE); }
Example #11
Source File: WriteToText.java From deployment-examples with MIT License | 6 votes |
@Override public ResourceId windowedFilename( int shardNumber, int numShards, BoundedWindow window, PaneInfo paneInfo, OutputFileHints outputFileHints) { IntervalWindow intervalWindow = (IntervalWindow) window; String filename = String.format( "%s-%s-of-%s%s", filenamePrefixForWindow(intervalWindow), shardNumber, numShards, outputFileHints.getSuggestedFilenameSuffix()); return prefix.getCurrentDirectory().resolve(filename, StandardResolveOptions.RESOLVE_FILE); }
Example #12
Source File: WriteOneFilePerWindow.java From dlp-dataflow-deidentification with Apache License 2.0 | 6 votes |
@Override public ResourceId windowedFilename( int shardNumber, int numShards, BoundedWindow window, PaneInfo paneInfo, OutputFileHints outputFileHints) { IntervalWindow intervalWindow = (IntervalWindow) window; String filename = String.format( "%s-%s-of-%s%s", filenamePrefixForWindow(intervalWindow), shardNumber, numShards, outputFileHints.getSuggestedFilenameSuffix()); return baseFilename .getCurrentDirectory() .resolve(filename, StandardResolveOptions.RESOLVE_FILE); }
Example #13
Source File: WindowedFilenamePolicy.java From DataflowTemplates with Apache License 2.0 | 5 votes |
/** * Unwindowed writes are unsupported by this filename policy so an {@link * UnsupportedOperationException} will be thrown if invoked. */ @Override public ResourceId unwindowedFilename( int shardNumber, int numShards, OutputFileHints outputFileHints) { throw new UnsupportedOperationException( "There is no windowed filename policy for " + "unwindowed file output. Please use the WindowedFilenamePolicy with windowed " + "writes or switch filename policies."); }
Example #14
Source File: WindowedFilenamePolicy.java From DataflowTemplates with Apache License 2.0 | 5 votes |
/** * Unwindowed writes are unsupported by this filename policy so an {@link * UnsupportedOperationException} will be thrown if invoked. */ @Override public ResourceId unwindowedFilename( int shardNumber, int numShards, OutputFileHints outputFileHints) { throw new UnsupportedOperationException( "There is no windowed filename policy for " + "unwindowed file output. Please use the WindowedFilenamePolicy with windowed " + "writes or switch filename policies."); }
Example #15
Source File: WriteFilesTranslationTest.java From beam with Apache License 2.0 | 5 votes |
@Override public ResourceId windowedFilename( int shardNumber, int numShards, BoundedWindow window, PaneInfo paneInfo, OutputFileHints outputFileHints) { throw new UnsupportedOperationException("Should never be called."); }
Example #16
Source File: DefaultFilenamePolicy.java From beam with Apache License 2.0 | 5 votes |
@Override @Nullable public ResourceId unwindowedFilename( int shardNumber, int numShards, OutputFileHints outputFileHints) { return constructName( params.baseFilename.get(), params.shardTemplate, params.suffix + outputFileHints.getSuggestedFilenameSuffix(), shardNumber, numShards, null, null); }
Example #17
Source File: AvroIOTest.java From beam with Apache License 2.0 | 4 votes |
@Override public ResourceId unwindowedFilename( int shardNumber, int numShards, OutputFileHints outputFileHints) { throw new UnsupportedOperationException("Expecting windowed outputs only"); }
Example #18
Source File: WriteFilesTranslationTest.java From beam with Apache License 2.0 | 4 votes |
@Nullable @Override public ResourceId unwindowedFilename( int shardNumber, int numShards, OutputFileHints outputFileHints) { throw new UnsupportedOperationException("Should never be called."); }
Example #19
Source File: WriteOneFilePerWindow.java From beam with Apache License 2.0 | 4 votes |
@Override public ResourceId unwindowedFilename( int shardNumber, int numShards, OutputFileHints outputFileHints) { throw new UnsupportedOperationException("Unsupported."); }
Example #20
Source File: WriteToText.java From beam with Apache License 2.0 | 4 votes |
@Override public ResourceId unwindowedFilename( int shardNumber, int numShards, OutputFileHints outputFileHints) { throw new UnsupportedOperationException("Unsupported."); }
Example #21
Source File: WriteOneFilePerWindow.java From deployment-examples with MIT License | 4 votes |
@Override public ResourceId unwindowedFilename( int shardNumber, int numShards, OutputFileHints outputFileHints) { throw new UnsupportedOperationException("Unsupported."); }
Example #22
Source File: WriteToText.java From deployment-examples with MIT License | 4 votes |
@Override public ResourceId unwindowedFilename( int shardNumber, int numShards, OutputFileHints outputFileHints) { throw new UnsupportedOperationException("Unsupported."); }
Example #23
Source File: WriteOneFilePerWindow.java From dlp-dataflow-deidentification with Apache License 2.0 | 4 votes |
@Override public ResourceId unwindowedFilename( int shardNumber, int numShards, OutputFileHints outputFileHints) { throw new UnsupportedOperationException("Unsupported."); }
Example #24
Source File: DynamicOneFilePerWindow.java From dlp-dataflow-deidentification with Apache License 2.0 | 4 votes |
@Override public ResourceId unwindowedFilename( int shardNumber, int numShards, OutputFileHints outputFileHints) { throw new UnsupportedOperationException("Unsupported."); }