use of org.apache.beam.sdk.extensions.sql.meta.provider.TableProvider in project beam by apache.
the class BeamSqlMultipleSchemasTest method testSelectFromExtraSchema.
@Test
public void testSelectFromExtraSchema() {
PCollection<Row> inputMain = pipeline.apply("mainInput", create(row(1, "pcollection_1"), row(2, "pcollection_2")));
PCollection<Row> inputExtra = pipeline.apply("extraInput", create(row(1, "_extra_table_1"), row(2, "_extra_table_2")));
TableProvider extraInputProvider = extraTableProvider("extraTable", inputExtra);
PCollection<Row> result = inputMain.apply(SqlTransform.query("SELECT f_int, f_string FROM extraSchema.extraTable").withTableProvider("extraSchema", extraInputProvider));
PAssert.that(result).containsInAnyOrder(row(1, "_extra_table_1"), row(2, "_extra_table_2"));
pipeline.run();
}
use of org.apache.beam.sdk.extensions.sql.meta.provider.TableProvider in project beam by apache.
the class BeamSqlMultipleSchemasTest method testOverrideUnqualifiedMainSchema.
@Test
public void testOverrideUnqualifiedMainSchema() {
PCollection<Row> inputMain = pipeline.apply("mainInput", create(row(1, "pcollection_1"), row(2, "pcollection_2")));
PCollection<Row> inputExtra = pipeline.apply("extraInput", create(row(1, "_extra_table_1"), row(2, "_extra_table_2")));
TableProvider extraInputProvider = extraTableProvider("extraTable", inputExtra);
PCollection<Row> result = inputMain.apply(SqlTransform.query("SELECT f_int, f_string FROM extraTable").withTableProvider("beam", extraInputProvider));
PAssert.that(result).containsInAnyOrder(row(1, "_extra_table_1"), row(2, "_extra_table_2"));
pipeline.run();
}
use of org.apache.beam.sdk.extensions.sql.meta.provider.TableProvider in project beam by apache.
the class BeamSqlMultipleSchemasTest method testSetDefaultQualifiedSchema.
@Test
public void testSetDefaultQualifiedSchema() {
PCollection<Row> inputMain = pipeline.apply("mainInput", create(row(1, "pcollection_1"), row(2, "pcollection_2")));
PCollection<Row> inputExtra = pipeline.apply("extraInput", create(row(1, "_extra_table_1"), row(2, "_extra_table_2")));
TableProvider extraInputProvider = extraTableProvider("extraTable", inputExtra);
PCollection<Row> result = inputMain.apply(SqlTransform.query("SELECT f_int, f_string FROM extraSchema.extraTable").withDefaultTableProvider("extraSchema", extraInputProvider));
PAssert.that(result).containsInAnyOrder(row(1, "_extra_table_1"), row(2, "_extra_table_2"));
pipeline.run();
}
use of org.apache.beam.sdk.extensions.sql.meta.provider.TableProvider in project beam by apache.
the class BeamSqlMultipleSchemasTest method testOverrideQualifiedMainSchema.
@Test
public void testOverrideQualifiedMainSchema() {
PCollection<Row> inputMain = pipeline.apply("mainInput", create(row(1, "pcollection_1"), row(2, "pcollection_2")));
PCollection<Row> inputExtra = pipeline.apply("extraInput", create(row(1, "_extra_table_1"), row(2, "_extra_table_2")));
TableProvider extraInputProvider = extraTableProvider("extraTable", inputExtra);
PCollection<Row> result = inputMain.apply(SqlTransform.query("SELECT f_int, f_string FROM beam.extraTable").withTableProvider("beam", extraInputProvider));
PAssert.that(result).containsInAnyOrder(row(1, "_extra_table_1"), row(2, "_extra_table_2"));
pipeline.run();
}
use of org.apache.beam.sdk.extensions.sql.meta.provider.TableProvider in project beam by apache.
the class BeamSqlMultipleSchemasTest method testSetDefaultUnqualifiedSchema.
@Test
public void testSetDefaultUnqualifiedSchema() {
PCollection<Row> inputMain = pipeline.apply("mainInput", create(row(1, "pcollection_1"), row(2, "pcollection_2")));
PCollection<Row> inputExtra = pipeline.apply("extraInput", create(row(1, "_extra_table_1"), row(2, "_extra_table_2")));
TableProvider extraInputProvider = extraTableProvider("extraTable", inputExtra);
PCollection<Row> result = inputMain.apply(SqlTransform.query("SELECT f_int, f_string FROM extraTable").withDefaultTableProvider("extraSchema", extraInputProvider));
PAssert.that(result).containsInAnyOrder(row(1, "_extra_table_1"), row(2, "_extra_table_2"));
pipeline.run();
}
Aggregations