WorkerCustomSources { public static DynamicSourceSplit toSourceSplit(BoundedSourceSplit<?> sourceSplitResult) { DynamicSourceSplit sourceSplit = new DynamicSourceSplit(); com.google.api.services.dataflow.model.Source primarySource; com.google.api.services.dataflow.model.Source residualSource; try { primarySource = serializeSplitToCloudSource(sourceSplitResult.primary); residualSource = serializeSplitToCloudSource(sourceSplitResult.residual); } catch (Exception e) { throw new RuntimeException("Failed to serialize one of the parts of the source split", e); } sourceSplit.setPrimary( new DerivedSource() .setDerivationMode("SOURCE_DERIVATION_MODE_INDEPENDENT") .setSource(primarySource)); sourceSplit.setResidual( new DerivedSource() .setDerivationMode("SOURCE_DERIVATION_MODE_INDEPENDENT") .setSource(residualSource)); return sourceSplit; }  static DynamicSourceSplit toSourceSplit(BoundedSourceSplit<?> sourceSplitResult); static SourceOperationResponse performSplit(
      SourceSplitRequest request, PipelineOptions options); static NativeReader<WindowedValue<?>> create(
      final CloudObject spec,
      final PipelineOptions options,
      DataflowExecutionContext executionContext); static boolean isFirstUnboundedSourceSplit(ByteString splitKey); static final long DATAFLOW_SPLIT_RESPONSE_API_SIZE_LIMIT; }
@Test public void testNegativeEstimatedSizesNotSet() throws Exception { WorkerCustomSources.BoundedSourceSplit<Integer> boundedSourceSplit = new WorkerCustomSources.BoundedSourceSplit<Integer>( new SourceProducingNegativeEstimatedSizes(), new SourceProducingNegativeEstimatedSizes()); DynamicSourceSplit dynamicSourceSplit = WorkerCustomSources.toSourceSplit(boundedSourceSplit); assertNull(dynamicSourceSplit.getPrimary().getSource().getMetadata().getEstimatedSizeBytes()); assertNull(dynamicSourceSplit.getResidual().getSource().getMetadata().getEstimatedSizeBytes()); }