@Override public void finishSpecifyingOutput( String transformName, PInput input, PTransform<?, ?> transform) { this.coderOrFailure = inferCoderOrFail( input, transform, getPipeline().getCoderRegistry(), getPipeline().getSchemaRegistry()); super.finishSpecifyingOutput(transformName, input, transform); }
/** * After building, finalizes this {@link PValue} to make it ready for running. Automatically * invoked whenever the {@link PValue} is "used" (e.g., when apply() is called on it) and when the * Pipeline is run (useful if this is a {@link PValue} with no consumers). */ @Override public void finishSpecifying(PInput input, PTransform<?, ?> transform) { if (isFinishedSpecifying()) { return; } this.coderOrFailure = inferCoderOrFail( input, transform, getPipeline().getCoderRegistry(), getPipeline().getSchemaRegistry()); // Ensure that this TypedPValue has a coder by inferring the coder if none exists; If not, // this will throw an exception. getCoder(); super.finishSpecifying(input, transform); }
try { CoderRegistry coderRegistry = input.getPipeline().getCoderRegistry(); SchemaRegistry schemaRegistry = input.getPipeline().getSchemaRegistry(); coder = this.coder.isPresent() ? this.coder.get() : null; if (coder == null) {
} else { SchemaRegistry registry = input.getPipeline().getSchemaRegistry(); try { outputSchemaCoder =
Coder<T> coder = null; CoderRegistry coderRegistry = input.getPipeline().getCoderRegistry(); SchemaRegistry schemaRegistry = input.getPipeline().getSchemaRegistry(); if (elementCoder.isPresent()) { coder = elementCoder.get();
@Override public PCollection<OutputT> expand(PCollection<? extends InputT> input) { SchemaRegistry schemaRegistry = input.getPipeline().getSchemaRegistry(); CoderRegistry registry = input.getPipeline().getCoderRegistry(); finishSpecifyingStateSpecs(fn, registry, input.getCoder()); TupleTag<OutputT> mainOutput = new TupleTag<>(MAIN_OUTPUT_TAG); PCollection<OutputT> res = input.apply(withOutputTags(mainOutput, TupleTagList.empty())).get(mainOutput); try { res.setSchema( schemaRegistry.getSchema(getFn().getOutputTypeDescriptor()), schemaRegistry.getToRowFunction(getFn().getOutputTypeDescriptor()), schemaRegistry.getFromRowFunction(getFn().getOutputTypeDescriptor())); } catch (NoSuchSchemaException e) { try { res.setCoder( registry.getCoder( getFn().getOutputTypeDescriptor(), getFn().getInputTypeDescriptor(), ((PCollection<InputT>) input).getCoder())); } catch (CannotProvideCoderException e2) { // Ignore and leave coder unset. } } return res; }