@Test public void testJoinerOutputSchema() { String joinKeys = "film.film_id=filmActor.film_id=filmCategory.film_id"; String selectedFields = "film.film_id, film.film_name, filmActor.actor_name as renamed_actor, " + "filmCategory.category_name as renamed_category"; String requiredInputs = "film,filmActor,filmCategory"; JoinerConfig joinerConfig = new JoinerConfig(joinKeys, selectedFields, requiredInputs); Joiner joiner = new Joiner(joinerConfig); FailureCollector collector = new MockFailureCollector(); AutoJoinerContext autoJoinerContext = new MockAutoJoinerContext(INPUT_STAGES, collector); JoinDefinition joinDefinition = joiner.define(autoJoinerContext); Assert.assertEquals(OUTPUT_SCHEMA, joinDefinition.getOutputSchema()); Assert.assertEquals(0, collector.getValidationFailures().size()); }
@Nullable public Schema getOutputSchema(FailureCollector collector) { try { return Strings.isNullOrEmpty(schema) ? null : Schema.parseJson(schema); } catch (IOException e) { collector.addFailure("Invalid schema: " + e.getMessage(), null).withConfigProperty(OUTPUT_SCHEMA); } throw collector.getOrThrowException(); }
JoinerConfig extends PluginConfig { @Nullable public Schema getOutputSchema(FailureCollector collector) { try { return Strings.isNullOrEmpty(schema) ? null : Schema.parseJson(schema); } catch (IOException e) { collector.addFailure("Invalid schema: " + e.getMessage(), null).withConfigProperty(OUTPUT_SCHEMA); } throw collector.getOrThrowException(); } }
JoinerConfig extends PluginConfig { @Nullable public Schema getOutputSchema(FailureCollector collector) { try { return Strings.isNullOrEmpty(schema) ? null : Schema.parseJson(schema); } catch (IOException e) { collector.addFailure("Invalid schema: " + e.getMessage(), null).withConfigProperty(OUTPUT_SCHEMA); } throw collector.getOrThrowException(); } JoinerConfig(); @VisibleForTesting  JoinerConfig(String joinKeys, String selectedFields, String requiredInputs); }
JoinerConfig extends PluginConfig { @Nullable public Schema getOutputSchema(FailureCollector collector) { try { return Strings.isNullOrEmpty(schema) ? null : Schema.parseJson(schema); } catch (IOException e) { collector.addFailure("Invalid schema: " + e.getMessage(), null).withConfigProperty(OUTPUT_SCHEMA); } throw collector.getOrThrowException(); } JoinerConfig(); @VisibleForTesting  JoinerConfig(String joinKeys, String selectedFields, String requiredInputs); @Nullable Integer getNumPartitions(); @Nullable Schema getOutputSchema(FailureCollector collector); @Nullable Integer getDistributionFactor(); @Nullable String getDistributionStageName(); boolean isDistributionValid(FailureCollector collector); boolean distributionContainsMacro(); }
JoinerConfig extends PluginConfig { @Nullable public Schema getOutputSchema(FailureCollector collector) { try { return Strings.isNullOrEmpty(schema) ? null : Schema.parseJson(schema); } catch (IOException e) { collector.addFailure("Invalid schema: " + e.getMessage(), null).withConfigProperty(OUTPUT_SCHEMA); } throw collector.getOrThrowException(); } JoinerConfig(); @VisibleForTesting  JoinerConfig(String joinKeys, String selectedFields, String requiredInputs); @Nullable Integer getNumPartitions(); @Nullable Schema getOutputSchema(FailureCollector collector); @Nullable Integer getDistributionFactor(); @Nullable String getDistributionStageName(); boolean isDistributionValid(FailureCollector collector); boolean distributionContainsMacro(); static final String SELECTED_FIELDS; static final String REQUIRED_INPUTS; static final String JOIN_KEYS; static final String OUTPUT_SCHEMA; static final String DISTRIBUTION_FACTOR; static final String DISTRIBUTION_STAGE; static final String MEMORY_INPUTS; }