code stringlengths 23 201k | docstring stringlengths 17 96.2k | func_name stringlengths 0 235 | language stringclasses 1
value | repo stringlengths 8 72 | path stringlengths 11 317 | url stringlengths 57 377 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
private String convertMapOperatorCall() {
final String key = PigRexUtils.convertRexNodeToPigExpression(rexCall.getOperands().get(1), inputFieldNames);
final String map = PigRexUtils.convertRexNodeToPigExpression(rexCall.getOperands().get(0), inputFieldNames);
return String.format("%s#%s", map, key);
} | Translates MAP accesses for some given key to Pig Latin.
@return Pig Latin of a map access for the given key | convertMapOperatorCall | java | linkedin/coral | coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigSpecialOperator.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/main/java/com/linkedin/coral/pig/rel2pig/rel/operators/PigSpecialOperator.java | BSD-2-Clause |
@Test
public static void testNestedUDF() throws IOException, ParseException {
final String sql = "SELECT cos(sin(i1)) FROM functions.tablefields AS t";
final String[] expectedPigLatin =
{ "view = LOAD 'src/test/resources/data/functions/tablefields.json' USING JsonLoader('"
+ "i_1:int, i0:i... | Tests that Nested UDFs can be used and resolved | testNestedUDF | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/CalcitePigUDFTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/CalcitePigUDFTest.java | BSD-2-Clause |
@Test
public static void testPigIfUDF() throws IOException, ParseException {
final String sql = "SELECT if(i1 > 0, 'greater', 'lesser') FROM functions.tablefields AS t";
final String[] expectedPigLatin =
{ "view = LOAD 'src/test/resources/data/functions/tablefields.json' USING JsonLoader('"
... | Tests that the if UDF can be used and resolved | testPigIfUDF | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/CalcitePigUDFTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/CalcitePigUDFTest.java | BSD-2-Clause |
@Test
public static void testPigLog2UDF() throws IOException, ParseException {
final String sql = "SELECT log2(i3) FROM functions.tablefields AS t";
final String[] expectedPigLatin =
{ "view = LOAD 'src/test/resources/data/functions/tablefields.json' USING JsonLoader('"
+ "i_1:int, i0:int,... | Tests that the log2 UDF can be used and resolved | testPigLog2UDF | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/CalcitePigUDFTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/CalcitePigUDFTest.java | BSD-2-Clause |
@Test
public static void testPigLogUDF() throws IOException, ParseException {
final String sql = "SELECT log(i2, i3) FROM functions.tablefields AS t";
final String[] expectedPigLatin =
{ "view = LOAD 'src/test/resources/data/functions/tablefields.json' USING JsonLoader('"
+ "i_1:int, i0:in... | Tests that the log UDF can be used and resolved | testPigLogUDF | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/CalcitePigUDFTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/CalcitePigUDFTest.java | BSD-2-Clause |
@Test
public static void testPigSubstringUDF() throws IOException, ParseException {
final String sqlTemplate = "SELECT %s FROM functions.tablefields AS t";
final String expectedPigLatinTemplate = String.join("\n",
"view = LOAD 'src/test/resources/data/functions/tablefields.json' USING JsonLoader('"
... | Tests that substring UDF can be used and resolved | testPigSubstringUDF | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/CalcitePigUDFTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/CalcitePigUDFTest.java | BSD-2-Clause |
@Test
public static void testPigRoundUDF() throws IOException, ParseException {
final String sqlTemplate = "SELECT %s FROM functions.tablefields AS t";
final String expectedPigLatinTemplate = String.join("\n",
"view = LOAD 'src/test/resources/data/functions/tablefields.json' USING JsonLoader('"
... | Tests that round UDF can be used and resolved | testPigRoundUDF | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/CalcitePigUDFTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/CalcitePigUDFTest.java | BSD-2-Clause |
@Test
public static void testAllPigBuiltinFunctions() throws IOException, ParseException {
final String sqlTemplate = "SELECT %s(%s) FROM functions.tablefields";
final String expectedPigLatinTemplate = String.join("\n",
"view = LOAD 'src/test/resources/data/functions/tablefields.json' USING JsonLoader... | Tests that all Pig Builtin Functions work | testAllPigBuiltinFunctions | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/CalcitePigUDFTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/CalcitePigUDFTest.java | BSD-2-Clause |
@Test
public static void testAllPigUDF() throws IOException, ParseException {
final String sqlTemplate = "SELECT %s(%s) FROM functions.tablefields";
final String expectedPigLatinTemplate = String.join("\n", "DEFINE PIG_UDF_%1$s dali.data.pig.udf.HiveUDF('%1$s');",
"view = LOAD 'src/test/resources/data... | Tests that all Pig UDFs work | testAllPigUDF | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/CalcitePigUDFTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/CalcitePigUDFTest.java | BSD-2-Clause |
private static void runTestSuite(String sqlTemplate, String expectedPigLatinTemplate, PigFunctionTest[] testSuite)
throws IOException, ParseException {
for (final PigFunctionTest pigFunctionTest : testSuite) {
final String sql = String.format(sqlTemplate, pigFunctionTest.getSqlName(), pigFunctionTest.g... | Runs the set of tests provided in the testSuite | runTestSuite | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/CalcitePigUDFTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/CalcitePigUDFTest.java | BSD-2-Clause |
@Test
public static void testTrivialSelect() throws IOException, ParseException {
String sql = "SELECT tableA.c FROM pig.tableA AS tableA";
String[] expectedPigLatin =
{ "view = LOAD 'src/test/resources/data/pig/tablea.json' USING JsonLoader('a:int, b:int, c:int');", "view = FOREACH view GENERATE c AS... | Tests a projection of a single column
@throws IOException
@throws ParseException | testTrivialSelect | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | BSD-2-Clause |
@Test
public static void testAllSelect() throws IOException, ParseException {
String sql = "SELECT * FROM pig.tableA AS tableA";
String[] expectedPigLatin =
{ "view = LOAD 'src/test/resources/data/pig/tablea.json' USING JsonLoader('a:int, b:int, c:int');", "view = FOREACH view GENERATE a AS a, b AS b,... | Tests a projection over all columns
@throws IOException
@throws ParseException | testAllSelect | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | BSD-2-Clause |
@Test
public static void testFieldsWithAliasesSelect() throws IOException, ParseException {
String sql = "SELECT tableA.a as f1, tableA.b as f2, tableA.c as f3 FROM pig.tableA AS tableA";
String[] expectedPigLatin =
{ "view = LOAD 'src/test/resources/data/pig/tablea.json' USING JsonLoader('a:int, b:in... | Tests a projection of multiple columns with aliases that differ from its base table
@throws IOException
@throws ParseException | testFieldsWithAliasesSelect | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | BSD-2-Clause |
@Test
public static void testStructType() throws IOException, ParseException {
String sql = "SELECT t.a as a, t.b.b0 as b0, t.c.c0.c00 as c00 FROM pig.tablestruct AS t";
String[] expectedPigLatin =
{ "view = LOAD 'src/test/resources/data/pig/tablestruct.json' USING JsonLoader('a:int, b:(b0:int), c:(c0... | Tests top-level and nested structs | testStructType | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | BSD-2-Clause |
@Test
public static void testHiveInFilterSelect() throws IOException, ParseException {
String sql = "SELECT tableA.a FROM pig.tableA AS tableA WHERE tableA.a IN (2,3,4)";
String[] expectedPigLatin =
{ "view = LOAD 'src/test/resources/data/pig/tablea.json' USING JsonLoader('a:int, b:int, c:int');", "vi... | Tests the Hive IN operator
@throws IOException
@throws ParseException | testHiveInFilterSelect | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | BSD-2-Clause |
@Test
public static void testCaseOperator() throws IOException, ParseException {
final String sqlTemplate = "SELECT (CASE %s END) AS result FROM pig.tableA";
final String expectedPigLatinTemplate = String.join("\n",
"view = LOAD 'src/test/resources/data/pig/tablea.json' USING JsonLoader('a:int, b:int,... | Tests CASE statements with:
- different comparison operators
- AND and OR predicates in a single condition
- CASE with and without an ELSE(default) clause
- overlapping conditions | testCaseOperator | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | BSD-2-Clause |
@Test
public static void testNotHiveInFilterSelect() throws IOException, ParseException {
String sql = "SELECT tableA.a FROM pig.tableA AS tableA WHERE tableA.a NOT IN (2,3,4)";
String[] expectedPigLatin =
{ "view = LOAD 'src/test/resources/data/pig/tablea.json' USING JsonLoader('a:int, b:int, c:int')... | Tests the NOT Hive IN operator
@throws IOException
@throws ParseException | testNotHiveInFilterSelect | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | BSD-2-Clause |
@Test
public static void testMultipleFilterSelect() throws IOException, ParseException {
String sql = "SELECT tableA.b FROM pig.tableA AS tableA WHERE (tableA.a > 2 AND tableA.b > 3) OR tableA.c = 100";
String[] expectedPigLatin =
{ "view = LOAD 'src/test/resources/data/pig/tablea.json' USING JsonLoad... | Tests a filter with multiple conditions
@throws IOException
@throws ParseException | testMultipleFilterSelect | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | BSD-2-Clause |
@Test
public static void testAggregateFunctions() throws IOException, ParseException {
final String sqlTemplate = "SELECT a AS a, %s(b) AS agg FROM pig.tableB GROUP BY a";
final String expectedPigLatinTemplate =
String.join("\n", "view = LOAD 'src/test/resources/data/pig/tableb.json' USING JsonLoader(... | Tests the following aggregate functions with a single grouping:
COUNT, AVG, SUM, MAX, MIN | testAggregateFunctions | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | BSD-2-Clause |
@Test
public static void testMultipleFieldGroupingAggregate() throws IOException, ParseException {
final String sql = "SELECT COUNT(a) AS count, a, b, AVG(a) FROM pig.tableA GROUP BY b, a";
final String[] expectedPigLatin =
{ "view = LOAD 'src/test/resources/data/pig/tablea.json' USING JsonLoader('a:i... | Tests aggregate functions multiple field grouping | testMultipleFieldGroupingAggregate | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | BSD-2-Clause |
@Test
public static void testSelfJoinSingleCondition() throws IOException, ParseException {
final String sql =
"SELECT tl.a as a, tl.b as bl, tr.b as br FROM pig.tableLeft tl JOIN pig.tableLeft tr ON tl.a = tr.a";
final String[] expectedPigLatin =
{ "CORAL_PIG_ALIAS_1 = LOAD 'src/test/resource... | Tests a SELF-JOIN on a table with a single condition | testSelfJoinSingleCondition | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | BSD-2-Clause |
@Test
public static void testSelfJoinMultipleConditions() throws IOException, ParseException {
final String sql =
"SELECT * FROM pig.tableLeft tl JOIN pig.tableLeft tr ON tl.a = tr.a AND tl.b = tr.b AND tl.c = tr.c ";
final String[] expectedPigLatin =
{ "CORAL_PIG_ALIAS_1 = LOAD 'src/test/reso... | Tests a SELF-JOIN on a table with multiple conditions | testSelfJoinMultipleConditions | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | BSD-2-Clause |
@Test
public static void testJoinTypes() throws IOException, ParseException {
final String sqlTemplate = "SELECT * FROM pig.tableLeft tl %s JOIN pig.tableRight tr ON tl.a = tr.d";
final String expectedPigLatinTemplate = String.join("\n",
"CORAL_PIG_ALIAS_1 = LOAD 'src/test/resources/data/pig/tableleft... | Tests the following join types over two different tables:
INNER, FULL OUTER, LEFT OUTER, RIGHT OUTER | testJoinTypes | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | BSD-2-Clause |
@Test
public static void testNullablilityOperators() throws IOException, ParseException {
final String sqlTemplate = "SELECT * FROM pig.tablenull WHERE nullableField %s";
final String expectedPigLatinTemplate = String.join("\n",
"view = LOAD 'src/test/resources/data/pig/tablenull.json' USING JsonLoade... | Tests that IS NOT NULL and IS NULL works | testNullablilityOperators | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | BSD-2-Clause |
@Test
public static void testUnionSameTableSingle() throws IOException, ParseException {
final String sql = "SELECT * FROM pig.tableA UNION ALL SELECT * FROM pig.tableA";
final String[] expectedPigLatin =
{ "CORAL_PIG_ALIAS_1 = LOAD 'src/test/resources/data/pig/tablea.json' USING JsonLoader('a:int, b:... | Tests UNION functionality on the same table a single time | testUnionSameTableSingle | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | BSD-2-Clause |
@Test
public static void testUnionDifferentTable() throws IOException, ParseException {
final String sql = "SELECT a, c FROM pig.tableA UNION ALL SELECT a, b AS c FROM pig.tableB";
final String[] expectedPigLatin =
{ "CORAL_PIG_ALIAS_1 = LOAD 'src/test/resources/data/pig/tablea.json' USING JsonLoader(... | Tests UNION functionality on different tables with explicit aliasing | testUnionDifferentTable | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | BSD-2-Clause |
@Test
public static void testUnionSameTableMultiple() throws IOException, ParseException {
final String sql = "SELECT * FROM pig.tableA UNION ALL SELECT * FROM pig.tableA UNION ALL SELECT * FROM pig.tableA";
final String[] expectedPigLatin =
{ "CORAL_PIG_ALIAS_2 = LOAD 'src/test/resources/data/pig/tab... | Tests UNION functionality on the same table multiple times | testUnionSameTableMultiple | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/RelToPigLatinConverterTest.java | BSD-2-Clause |
public static void initializeViews(HiveConf conf) throws HiveException, MetaException, IOException {
String testDir = conf.get(CORAL_PIG_TEST_DIR);
System.out.println("Test Workspace: " + testDir);
FileUtils.deleteDirectory(new File(testDir));
SessionState.start(conf);
Driver driver = new Driver(con... | Initializes the tables used in Coral-Pig unit tests
@throws HiveException
@throws MetaException | initializeViews | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/TestUtils.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/TestUtils.java | BSD-2-Clause |
public static void turnOffRelSimplification() {
// Rel simplification can statically interpret boolean conditions in
// OR, AND, CASE clauses and simplify those. This has two problems:
// 1. Our type system is not perfect replication of Hive so this can be incorrect
// 2. Converted expression is harder ... | Turns off optimizations used in the transformation of Calcite SQL to Relational Algebra | turnOffRelSimplification | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/TestUtils.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/TestUtils.java | BSD-2-Clause |
public static String[] sqlToPigLatin(String sql, String outputRelation) {
RelNode relNode = hiveToRelConverter.convertSql(sql);
PigLoadFunction pigLoadFunction = (String db, String t) -> {
if (db.equalsIgnoreCase("pig") && t.equalsIgnoreCase("tableA")) {
return "JsonLoader('a:int, b:int, c:int')... | Translates the view definition of a SQL query to Pig Latin
@param sql A SQL query.
@param outputRelation The variable that the output of the table will be stored in
@return Ordered list of Pig Latin statements to read the records produced by the view definition of the
given database.table stored in outputRelati... | sqlToPigLatin | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/TestUtils.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/TestUtils.java | BSD-2-Clause |
private static void run(Driver driver, String sql) {
while (true) {
try {
driver.run(sql);
} catch (CommandNeedRetryException e) {
continue;
}
break;
}
} | Translates the view definition of a SQL query to Pig Latin
@param sql A SQL query.
@param outputRelation The variable that the output of the table will be stored in
@return Ordered list of Pig Latin statements to read the records produced by the view definition of the
given database.table stored in outputRelati... | run | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/TestUtils.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/TestUtils.java | BSD-2-Clause |
public static HiveConf loadResourceHiveConf() {
InputStream hiveConfStream = TestUtils.class.getClassLoader().getResourceAsStream("hive.xml");
HiveConf hiveConf = new HiveConf();
hiveConf.set(CORAL_PIG_TEST_DIR,
System.getProperty("java.io.tmpdir") + "/coral/pig/" + UUID.randomUUID().toString());
... | Translates the view definition of a SQL query to Pig Latin
@param sql A SQL query.
@param outputRelation The variable that the output of the table will be stored in
@return Ordered list of Pig Latin statements to read the records produced by the view definition of the
given database.table stored in outputRelati... | loadResourceHiveConf | java | linkedin/coral | coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/TestUtils.java | https://github.com/linkedin/coral/blob/master/coral-pig/src/test/java/com/linkedin/coral/pig/rel2pig/TestUtils.java | BSD-2-Clause |
public static boolean isNullableType(Schema schema) {
return schema.getType().equals(Schema.Type.UNION) && schema.getTypes().size() == 2
&& (schema.getTypes().get(0).getType().equals(Schema.Type.NULL)
|| schema.getTypes().get(1).getType().equals(Schema.Type.NULL));
// [null, null] not allowe... | Determine if an Avro schema is of type Union[T, NULL]. Avro supports nullable
types via a union of type T and null. This is a very common use case.
As such, we want to silently convert it to just T and allow the value to be null.
@return true if type represents Union[T, Null], false otherwise | isNullableType | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/AvroSerdeUtils.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/AvroSerdeUtils.java | BSD-2-Clause |
public static Schema getOtherTypeFromNullableType(Schema schema) {
List<Schema> types = schema.getTypes();
return types.get(0).getType().equals(Schema.Type.NULL) ? types.get(1) : types.get(0);
} | In a nullable type, get the schema for the non-nullable type. This method
does no checking that the provides Schema is nullable. | getOtherTypeFromNullableType | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/AvroSerdeUtils.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/AvroSerdeUtils.java | BSD-2-Clause |
@SuppressWarnings("MethodTypeParameterName")
public static <P, FP, R, FR> R visit(TypeInfo typeInfo, P partner, HiveSchemaWithPartnerVisitor<P, FP, R, FR> visitor,
PartnerAccessor<P, FP> accessor) {
switch (typeInfo.getCategory()) {
case STRUCT:
StructTypeInfo structTypeInfo = (StructTypeInfo)... | Methods to access types in the partner schema corresponding to types in the Hive schema being traversed
@param <P> type of partner schema
@param <FP> type of the field representation in the partner schema | visit | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/HiveSchemaWithPartnerVisitor.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/HiveSchemaWithPartnerVisitor.java | BSD-2-Clause |
public R struct(StructTypeInfo struct, P partner, List<FR> fieldResults) {
return null;
} | Methods to access types in the partner schema corresponding to types in the Hive schema being traversed
@param <P> type of partner schema
@param <FP> type of the field representation in the partner schema | struct | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/HiveSchemaWithPartnerVisitor.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/HiveSchemaWithPartnerVisitor.java | BSD-2-Clause |
public FR field(String name, TypeInfo field, FP partner, R fieldResult) {
return null;
} | Methods to access types in the partner schema corresponding to types in the Hive schema being traversed
@param <P> type of partner schema
@param <FP> type of the field representation in the partner schema | field | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/HiveSchemaWithPartnerVisitor.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/HiveSchemaWithPartnerVisitor.java | BSD-2-Clause |
public R list(ListTypeInfo list, P partner, R elementResult) {
return null;
} | Methods to access types in the partner schema corresponding to types in the Hive schema being traversed
@param <P> type of partner schema
@param <FP> type of the field representation in the partner schema | list | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/HiveSchemaWithPartnerVisitor.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/HiveSchemaWithPartnerVisitor.java | BSD-2-Clause |
public R map(MapTypeInfo map, P partner, R keyResult, R valueResult) {
return null;
} | Methods to access types in the partner schema corresponding to types in the Hive schema being traversed
@param <P> type of partner schema
@param <FP> type of the field representation in the partner schema | map | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/HiveSchemaWithPartnerVisitor.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/HiveSchemaWithPartnerVisitor.java | BSD-2-Clause |
public R primitive(PrimitiveTypeInfo primitive, P partner) {
return null;
} | Methods to access types in the partner schema corresponding to types in the Hive schema being traversed
@param <P> type of partner schema
@param <FP> type of the field representation in the partner schema | primitive | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/HiveSchemaWithPartnerVisitor.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/HiveSchemaWithPartnerVisitor.java | BSD-2-Clause |
public R union(UnionTypeInfo union, P partner, List<R> results) {
return null;
} | Methods to access types in the partner schema corresponding to types in the Hive schema being traversed
@param <P> type of partner schema
@param <FP> type of the field representation in the partner schema | union | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/HiveSchemaWithPartnerVisitor.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/HiveSchemaWithPartnerVisitor.java | BSD-2-Clause |
static Schema visit(StructTypeInfo typeInfo, Schema schema) {
return HiveSchemaWithPartnerVisitor.visit(typeInfo, schema, new MergeHiveSchemaWithAvro(),
AvroPartnerAccessor.INSTANCE);
} | A {@link HiveSchemaWithPartnerVisitor} which augments a Hive schema with extra metadata from a partner Avro schema
and generates a resultant "merged" Avro schema
1. Fields are matched between Hive and Avro schemas using a case insensitive search by field name
2. Copies field names, nullability, default value, field pr... | visit | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | BSD-2-Clause |
@Override
public Schema struct(StructTypeInfo struct, Schema partner, List<Schema.Field> fieldResults) {
boolean shouldResultBeOptional = partner == null || isNullableType(partner);
Schema result;
if (partner == null || SchemaUtilities.extractIfOption(partner).getType() != Schema.Type.RECORD) {
// i... | A {@link HiveSchemaWithPartnerVisitor} which augments a Hive schema with extra metadata from a partner Avro schema
and generates a resultant "merged" Avro schema
1. Fields are matched between Hive and Avro schemas using a case insensitive search by field name
2. Copies field names, nullability, default value, field pr... | struct | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | BSD-2-Clause |
@Override
public Schema.Field field(String name, TypeInfo field, Schema.Field partner, Schema fieldResult) {
// No need to infer `shouldResultBeOptional`. We expect other visitor methods to return optional schemas
// in their field results if required
if (partner == null) {
// if there was no matchi... | A {@link HiveSchemaWithPartnerVisitor} which augments a Hive schema with extra metadata from a partner Avro schema
and generates a resultant "merged" Avro schema
1. Fields are matched between Hive and Avro schemas using a case insensitive search by field name
2. Copies field names, nullability, default value, field pr... | field | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | BSD-2-Clause |
@Override
public Schema list(ListTypeInfo list, Schema partner, Schema elementResult) {
// if there was no matching Avro list, or if matching Avro list was an option, return an optional list
boolean shouldResultBeOptional = partner == null || isNullableType(partner);
Schema result = Schema.createArray(ele... | A {@link HiveSchemaWithPartnerVisitor} which augments a Hive schema with extra metadata from a partner Avro schema
and generates a resultant "merged" Avro schema
1. Fields are matched between Hive and Avro schemas using a case insensitive search by field name
2. Copies field names, nullability, default value, field pr... | list | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | BSD-2-Clause |
@Override
public Schema map(MapTypeInfo map, Schema partner, Schema keyResult, Schema valueResult) {
Preconditions.checkArgument(SchemaUtilities.extractIfOption(keyResult).getType() == Schema.Type.STRING,
"Map keys should always be non-nullable strings. Found: %s", keyResult);
// if there was no match... | A {@link HiveSchemaWithPartnerVisitor} which augments a Hive schema with extra metadata from a partner Avro schema
and generates a resultant "merged" Avro schema
1. Fields are matched between Hive and Avro schemas using a case insensitive search by field name
2. Copies field names, nullability, default value, field pr... | map | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | BSD-2-Clause |
@Override
public Schema primitive(PrimitiveTypeInfo primitive, Schema partner) {
boolean shouldResultBeOptional = partner == null || isNullableType(partner);
Schema hivePrimitive = hivePrimitiveToAvro(primitive);
// if there was no matching Avro primitive, use the Hive primitive
Schema result = partne... | A {@link HiveSchemaWithPartnerVisitor} which augments a Hive schema with extra metadata from a partner Avro schema
and generates a resultant "merged" Avro schema
1. Fields are matched between Hive and Avro schemas using a case insensitive search by field name
2. Copies field names, nullability, default value, field pr... | primitive | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | BSD-2-Clause |
@Override
public Schema union(UnionTypeInfo union, Schema partner, List<Schema> results) {
if (SchemaUtilities.nullExistInUnion(partner)) {
List<Schema> toAddNull = new ArrayList<>();
toAddNull.add(Schema.create(Schema.Type.NULL));
toAddNull.addAll(results);
return Schema.createUnion(toAdd... | A {@link HiveSchemaWithPartnerVisitor} which augments a Hive schema with extra metadata from a partner Avro schema
and generates a resultant "merged" Avro schema
1. Fields are matched between Hive and Avro schemas using a case insensitive search by field name
2. Copies field names, nullability, default value, field pr... | union | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | BSD-2-Clause |
private Schema checkCompatibilityAndPromote(Schema schema, Schema partner) {
// TODO: Check if schema is compatible with partner
Schema extractedPartnerSchema = SchemaUtilities.extractIfOption(partner);
switch (schema.getType()) {
case BYTES:
if (extractedPartnerSchema.getType().equals(Schema.... | A {@link HiveSchemaWithPartnerVisitor} which augments a Hive schema with extra metadata from a partner Avro schema
and generates a resultant "merged" Avro schema
1. Fields are matched between Hive and Avro schemas using a case insensitive search by field name
2. Copies field names, nullability, default value, field pr... | checkCompatibilityAndPromote | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | BSD-2-Clause |
@Override
public Schema.Field fieldPartner(Schema partner, String fieldName) {
Schema schema = SchemaUtilities.extractIfOption(partner);
return (schema.getType() == Schema.Type.RECORD) ? findCaseInsensitive(schema, fieldName) : null;
} | A {@link PartnerAccessor} which matches the requested field from a partner Avro struct by case insensitive
field name match | fieldPartner | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | BSD-2-Clause |
@Override
public Schema fieldType(Schema.Field partnerField) {
return partnerField.schema();
} | A {@link PartnerAccessor} which matches the requested field from a partner Avro struct by case insensitive
field name match | fieldType | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | BSD-2-Clause |
@Override
public Schema mapKeyPartner(Schema partner) {
Schema schema = SchemaUtilities.extractIfOption(partner);
return (schema.getType() == Schema.Type.MAP) ? MAP_KEY : null;
} | A {@link PartnerAccessor} which matches the requested field from a partner Avro struct by case insensitive
field name match | mapKeyPartner | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | BSD-2-Clause |
@Override
public Schema mapValuePartner(Schema partner) {
Schema schema = SchemaUtilities.extractIfOption(partner);
return (schema.getType() == Schema.Type.MAP) ? schema.getValueType() : null;
} | A {@link PartnerAccessor} which matches the requested field from a partner Avro struct by case insensitive
field name match | mapValuePartner | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | BSD-2-Clause |
@Override
public Schema listElementPartner(Schema partner) {
Schema schema = SchemaUtilities.extractIfOption(partner);
return (schema.getType() == Schema.Type.ARRAY) ? schema.getElementType() : null;
} | A {@link PartnerAccessor} which matches the requested field from a partner Avro struct by case insensitive
field name match | listElementPartner | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | BSD-2-Clause |
@Override
public Schema unionObjectPartner(Schema partner, int ordinal) {
if (partner.getType() != Schema.Type.UNION) {
return null;
}
Schema schema = SchemaUtilities.discardNullFromUnionIfExist(partner);
return schema.getTypes().get(ordinal);
} | A {@link PartnerAccessor} which matches the requested field from a partner Avro struct by case insensitive
field name match | unionObjectPartner | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | BSD-2-Clause |
private Schema.Field findCaseInsensitive(Schema struct, String fieldName) {
Preconditions.checkArgument(struct.getType() == Schema.Type.RECORD);
// TODO: Optimize? This will be called for every struct field, we will run the for loop for every struct field
for (Schema.Field field : struct.getFields()) ... | A {@link PartnerAccessor} which matches the requested field from a partner Avro struct by case insensitive
field name match | findCaseInsensitive | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | BSD-2-Clause |
public Schema hivePrimitiveToAvro(PrimitiveTypeInfo primitive) {
switch (primitive.getPrimitiveCategory()) {
case INT:
case BYTE:
case SHORT:
return Schema.create(Schema.Type.INT);
case LONG:
return Schema.create(Schema.Type.LONG);
case FLOAT:
return Schema.cr... | A {@link PartnerAccessor} which matches the requested field from a partner Avro struct by case insensitive
field name match | hivePrimitiveToAvro | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/MergeHiveSchemaWithAvro.java | BSD-2-Clause |
static Schema relDataTypeToAvroTypeNonNullable(@Nonnull RelDataType relDataType, String recordName) {
Preconditions.checkNotNull(relDataType);
if (relDataType instanceof RelRecordType || relDataType instanceof DynamicRecordType) {
String uniqueNamespace = getUniqueNamespace(relDataType, recordName);
... | This method converts RelDataType to avro data type
The return schema is always non nullable (instead of [null, type]) since the nullability if decided
out of this method
@param relDataType
@return Schema of Avro data type corresponding to input RelDataType | relDataTypeToAvroTypeNonNullable | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelDataTypeToAvroType.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelDataTypeToAvroType.java | BSD-2-Clause |
private static Schema relDataTypeToAvroType(RelDataType relDataType, String recordName) {
final Schema avroSchema = relDataTypeToAvroTypeNonNullable(relDataType, recordName);
// TODO: Current logic ALWAYS sets the inner fields of RelDataType record nullable.
// Modify this to be applied only when RelDataTy... | This method converts RelDataType to avro data type
The return schema is always non nullable (instead of [null, type]) since the nullability if decided
out of this method
@param relDataType
@return Schema of Avro data type corresponding to input RelDataType | relDataTypeToAvroType | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelDataTypeToAvroType.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelDataTypeToAvroType.java | BSD-2-Clause |
private static Schema basicSqlTypeToAvroType(BasicSqlType relDataType) {
Schema schema;
switch (relDataType.getSqlTypeName()) {
case BOOLEAN:
return Schema.create(Schema.Type.BOOLEAN);
case TINYINT:
case INTEGER:
return Schema.create(Schema.Type.INT);
case BIGINT:
... | This method converts RelDataType to avro data type
The return schema is always non nullable (instead of [null, type]) since the nullability if decided
out of this method
@param relDataType
@return Schema of Avro data type corresponding to input RelDataType | basicSqlTypeToAvroType | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelDataTypeToAvroType.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelDataTypeToAvroType.java | BSD-2-Clause |
private static Schema relRecordTypeToAvroType(RelDataType relRecord, List<String> fieldComments, String recordName,
String recordNamespace, String doc) {
final List<Schema.Field> fields = new ArrayList<>();
final Schema avroSchema = Schema.createRecord(recordName, doc, recordNamespace, false);
for (R... | This method converts RelRecordType or DynamicRecordType to Avro type
It iterates each RelDataTypeField in the field list of record type and convert them recursively
@param relRecord RelRecordType or DynamicRecordType to convert to Avro Record type
@param fieldComments documentations of sub-fields in Avro Record type
... | relRecordTypeToAvroType | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelDataTypeToAvroType.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelDataTypeToAvroType.java | BSD-2-Clause |
private static String getUniqueNamespace(RelDataType relDataType, String recordName) {
if (relDataType.getFieldList() == null || relDataType.getFieldCount() == 0) {
return "rel_avro";
}
List<RelDataTypeField> fields = relDataType.getFieldList();
if (fields.stream().anyMatch(field -> field.getName... | This method converts RelRecordType or DynamicRecordType to Avro type
It iterates each RelDataTypeField in the field list of record type and convert them recursively
@param relRecord RelRecordType or DynamicRecordType to convert to Avro Record type
@param fieldComments documentations of sub-fields in Avro Record type
... | getUniqueNamespace | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelDataTypeToAvroType.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelDataTypeToAvroType.java | BSD-2-Clause |
private static String toAvroQualifiedName(String relName) {
return relName.replace("$", "_");
} | This method converts RelRecordType or DynamicRecordType to Avro type
It iterates each RelDataTypeField in the field list of record type and convert them recursively
@param relRecord RelRecordType or DynamicRecordType to convert to Avro Record type
@param fieldComments documentations of sub-fields in Avro Record type
... | toAvroQualifiedName | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelDataTypeToAvroType.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelDataTypeToAvroType.java | BSD-2-Clause |
public Schema convert(@Nonnull RelNode relNode, boolean strictMode, boolean forceLowercase) {
Preconditions.checkNotNull(relNode, "RelNode to convert cannot be null");
Map<RelNode, Schema> schemaMap = new HashMap<>();
relNode.accept(new SchemaRelShuttle(hiveMetastoreClient, schemaMap, strictMode, forceLowe... | This method generates a corresponding avro schema for calcite IR RelNode
@param relNode {@link RelNode} object
@param strictMode configure whether to use strict mode
@param forceLowercase configure whether to return view schema in lowercase mode
@return avro schema for calcite IR RelNode
@throws RuntimeException if c... | convert | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
public Schema convert(@Nonnull RelNode relNode, boolean strictMode) {
return convert(relNode, strictMode, false);
} | This method generates a corresponding avro schema for calcite IR RelNode
@param relNode {@link RelNode} object
@param strictMode configure whether to use strict mode
@return avro schema for calcite IR RelNode
@throws RuntimeException if cannot find table in Hive metastore
@throws RuntimeException if cannot determine a... | convert | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RelNode visit(TableScan tableScan) {
RelNode relNode = super.visit(tableScan);
Schema tableScanSchema = getTableScanSchema(tableScan);
schemaMap.put(tableScan, tableScanSchema);
return relNode;
} | This class extends RelShuttleImp. It's used to generate avro schema while traversing
the calcite IR RelNode in a bottom-up manner
RelShuttle is used to traverse the IR RelNode without modifying it.
For each logical operator type, it's implemented in the following manner:
@Override
public RelNode visit(Logical... | visit | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RelNode visit(TableFunctionScan tableFunctionScan) {
// TODO: implement this method
return super.visit(tableFunctionScan);
} | This class extends RelShuttleImp. It's used to generate avro schema while traversing
the calcite IR RelNode in a bottom-up manner
RelShuttle is used to traverse the IR RelNode without modifying it.
For each logical operator type, it's implemented in the following manner:
@Override
public RelNode visit(Logical... | visit | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RelNode visit(LogicalValues logicalValues) {
// TODO: implement this method
return super.visit(logicalValues);
} | This class extends RelShuttleImp. It's used to generate avro schema while traversing
the calcite IR RelNode in a bottom-up manner
RelShuttle is used to traverse the IR RelNode without modifying it.
For each logical operator type, it's implemented in the following manner:
@Override
public RelNode visit(Logical... | visit | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RelNode visit(LogicalFilter logicalFilter) {
RelNode relNode = super.visit(logicalFilter);
Schema inputSchema = schemaMap.get(logicalFilter.getInput());
schemaMap.put(logicalFilter, inputSchema);
return relNode;
} | This class extends RelShuttleImp. It's used to generate avro schema while traversing
the calcite IR RelNode in a bottom-up manner
RelShuttle is used to traverse the IR RelNode without modifying it.
For each logical operator type, it's implemented in the following manner:
@Override
public RelNode visit(Logical... | visit | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RelNode visit(LogicalProject logicalProject) {
RelNode relNode = super.visit(logicalProject);
Schema inputSchema = schemaMap.get(logicalProject.getInput());
Queue<String> suggestedFieldNames = new LinkedList<>();
for (RelDataTypeField field : logicalProject.getRowType().get... | This class extends RelShuttleImp. It's used to generate avro schema while traversing
the calcite IR RelNode in a bottom-up manner
RelShuttle is used to traverse the IR RelNode without modifying it.
For each logical operator type, it's implemented in the following manner:
@Override
public RelNode visit(Logical... | visit | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RelNode visit(LogicalJoin logicalJoin) {
// TODO: Modify this method to avoid that 2 schema fields share the same name in Avro 1.10, and enable the tests for join
RelNode relNode = super.visit(logicalJoin);
Schema leftInputSchema = schemaMap.get(logicalJoin.getLeft());
Sche... | This class extends RelShuttleImp. It's used to generate avro schema while traversing
the calcite IR RelNode in a bottom-up manner
RelShuttle is used to traverse the IR RelNode without modifying it.
For each logical operator type, it's implemented in the following manner:
@Override
public RelNode visit(Logical... | visit | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RelNode visit(LogicalCorrelate logicalCorrelate) {
RelNode relNode = super.visit(logicalCorrelate);
Schema leftSchema = schemaMap.get(logicalCorrelate.getLeft());
Schema rightSchema = schemaMap.get(logicalCorrelate.getRight());
Schema logicalCorrelateSchema = SchemaUtilitie... | This class extends RelShuttleImp. It's used to generate avro schema while traversing
the calcite IR RelNode in a bottom-up manner
RelShuttle is used to traverse the IR RelNode without modifying it.
For each logical operator type, it's implemented in the following manner:
@Override
public RelNode visit(Logical... | visit | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RelNode visit(LogicalUnion logicalUnion) {
RelNode relNode = super.visit(logicalUnion);
Schema inputSchema1 = schemaMap.get(logicalUnion.getInput(0));
Schema inputSchema2 = schemaMap.get(logicalUnion.getInput(1));
Schema mergedSchema =
SchemaUtilities.mergeUnionRe... | This class extends RelShuttleImp. It's used to generate avro schema while traversing
the calcite IR RelNode in a bottom-up manner
RelShuttle is used to traverse the IR RelNode without modifying it.
For each logical operator type, it's implemented in the following manner:
@Override
public RelNode visit(Logical... | visit | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RelNode visit(LogicalIntersect logicalIntersect) {
// TODO: implement this method
return super.visit(logicalIntersect);
} | This class extends RelShuttleImp. It's used to generate avro schema while traversing
the calcite IR RelNode in a bottom-up manner
RelShuttle is used to traverse the IR RelNode without modifying it.
For each logical operator type, it's implemented in the following manner:
@Override
public RelNode visit(Logical... | visit | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RelNode visit(LogicalMinus logicalMinus) {
// TODO: implement this method
return super.visit(logicalMinus);
} | This class extends RelShuttleImp. It's used to generate avro schema while traversing
the calcite IR RelNode in a bottom-up manner
RelShuttle is used to traverse the IR RelNode without modifying it.
For each logical operator type, it's implemented in the following manner:
@Override
public RelNode visit(Logical... | visit | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RelNode visit(LogicalAggregate logicalAggregate) {
// TODO: Potential need RexShuttle
RelNode relNode = super.visit(logicalAggregate);
Schema inputSchema = schemaMap.get(logicalAggregate.getInput());
SchemaBuilder.FieldAssembler<Schema> logicalAggregateFieldAssembler =
... | This class extends RelShuttleImp. It's used to generate avro schema while traversing
the calcite IR RelNode in a bottom-up manner
RelShuttle is used to traverse the IR RelNode without modifying it.
For each logical operator type, it's implemented in the following manner:
@Override
public RelNode visit(Logical... | visit | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RelNode visit(LogicalMatch logicalMatch) {
// TODO: implement this method
return super.visit(logicalMatch);
} | This class extends RelShuttleImp. It's used to generate avro schema while traversing
the calcite IR RelNode in a bottom-up manner
RelShuttle is used to traverse the IR RelNode without modifying it.
For each logical operator type, it's implemented in the following manner:
@Override
public RelNode visit(Logical... | visit | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RelNode visit(LogicalSort logicalSort) {
// TODO: implement this method
return super.visit(logicalSort);
} | This class extends RelShuttleImp. It's used to generate avro schema while traversing
the calcite IR RelNode in a bottom-up manner
RelShuttle is used to traverse the IR RelNode without modifying it.
For each logical operator type, it's implemented in the following manner:
@Override
public RelNode visit(Logical... | visit | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RelNode visit(LogicalExchange logicalExchange) {
// TODO: implement this method
return super.visit(logicalExchange);
} | This class extends RelShuttleImp. It's used to generate avro schema while traversing
the calcite IR RelNode in a bottom-up manner
RelShuttle is used to traverse the IR RelNode without modifying it.
For each logical operator type, it's implemented in the following manner:
@Override
public RelNode visit(Logical... | visit | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RelNode visit(RelNode relNode) {
// Handles lateral views here
if (relNode instanceof HiveUncollect || relNode instanceof LogicalTableFunctionScan) {
SchemaBuilder.FieldAssembler<Schema> hiveUncollectFieldAssembler =
SchemaBuilder.record("LateralViews").namespace("La... | This class extends RelShuttleImp. It's used to generate avro schema while traversing
the calcite IR RelNode in a bottom-up manner
RelShuttle is used to traverse the IR RelNode without modifying it.
For each logical operator type, it's implemented in the following manner:
@Override
public RelNode visit(Logical... | visit | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
private Schema getTableScanSchema(TableScan tableScan) {
List<String> qualifiedName = tableScan.getTable().getQualifiedName();
String dbName = qualifiedName.get(1);
String tableName = qualifiedName.get(2);
Table baseTable = hiveMetastoreClient.getTable(dbName, tableName);
if (baseTable == ... | This method retrieves avro schema for tableScan
@param tableScan
@return avro schema for tableScan. The schema includes partition columns if table is partitioned
@throws RuntimeException if cannot find table in Hive metastore
@throws RuntimeException if cannot determine avro schema for tableScan | getTableScanSchema | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RexNode visitInputRef(RexInputRef rexInputRef) {
RexNode rexNode = super.visitInputRef(rexInputRef);
appendRexInputRefField(rexInputRef);
return rexNode;
} | This class extends RexShuttle. It's used to generate avro schema while traversing RexNode. | visitInputRef | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RexNode visitLocalRef(RexLocalRef rexLocalRef) {
// TODO: implement this method
return super.visitLocalRef(rexLocalRef);
} | This class extends RexShuttle. It's used to generate avro schema while traversing RexNode. | visitLocalRef | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RexNode visitLiteral(RexLiteral rexLiteral) {
RexNode rexNode = super.visitLiteral(rexLiteral);
RelDataType fieldType = rexLiteral.getType();
appendField(fieldType, true, SchemaUtilities.generateDocumentationForLiteral(rexLiteral));
return rexNode;
} | This class extends RexShuttle. It's used to generate avro schema while traversing RexNode. | visitLiteral | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RexNode visitCall(RexCall rexCall) {
/**
* If the return type of RexCall is based on an ordinal of its input arguments, then leverage SchemaRexShuttle
* to visit the input argument and use the argument's schema as is to infer the return type of the call
*/
if (rexCa... | This class extends RexShuttle. It's used to generate avro schema while traversing RexNode. | visitCall | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RexNode visitOver(RexOver rexOver) {
/**
* For aggregates over window, derive the expected field's schema using RexOver's return type alone.
* Example RexOver:
* ROW_NUMBER() OVER (PARTITION BY colA, colB ORDER BY colC DESC)
*/
appendField(rexOver.getType(),... | For SqlUserDefinedFunction and SqlOperator RexCall, no need to handle it recursively
and just directly use the return type of udf or sql operator as the field's schema | visitOver | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RexNode visitCorrelVariable(RexCorrelVariable rexCorrelVariable) {
// TODO: implement this method
return super.visitCorrelVariable(rexCorrelVariable);
} | For aggregates over window, derive the expected field's schema using RexOver's return type alone.
Example RexOver:
ROW_NUMBER() OVER (PARTITION BY colA, colB ORDER BY colC DESC) | visitCorrelVariable | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RexNode visitDynamicParam(RexDynamicParam rexDynamicParam) {
// TODO: implement this method
return super.visitDynamicParam(rexDynamicParam);
} | For aggregates over window, derive the expected field's schema using RexOver's return type alone.
Example RexOver:
ROW_NUMBER() OVER (PARTITION BY colA, colB ORDER BY colC DESC) | visitDynamicParam | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RexNode visitRangeRef(RexRangeRef rexRangeRef) {
// TODO: implement this method
return super.visitRangeRef(rexRangeRef);
} | For aggregates over window, derive the expected field's schema using RexOver's return type alone.
Example RexOver:
ROW_NUMBER() OVER (PARTITION BY colA, colB ORDER BY colC DESC) | visitRangeRef | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RexNode visitFieldAccess(RexFieldAccess rexFieldAccess) {
RexNode referenceExpr = rexFieldAccess.getReferenceExpr();
Deque<String> innerRecordNames = new LinkedList<>();
while (!(referenceExpr instanceof RexInputRef)) {
if (referenceExpr instanceof RexCall
&& ... | For aggregates over window, derive the expected field's schema using RexOver's return type alone.
Example RexOver:
ROW_NUMBER() OVER (PARTITION BY colA, colB ORDER BY colC DESC) | visitFieldAccess | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
private void handleFieldAccess(RexFieldAccess rexFieldAccess, RexInputRef referenceExpr,
Deque<String> innerRecordNames) {
String oldFieldName = rexFieldAccess.getField().getName();
String suggestNewFieldName = suggestedFieldNames.poll();
String newFieldName = SchemaUtilities.getFieldName(oldF... | For aggregates over window, derive the expected field's schema using RexOver's return type alone.
Example RexOver:
ROW_NUMBER() OVER (PARTITION BY colA, colB ORDER BY colC DESC) | handleFieldAccess | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
private void handleUDFFieldAccess(RexFieldAccess rexFieldAccess, RexCall referenceExpr) {
String oldFieldName = rexFieldAccess.getField().getName();
String suggestNewFieldName = suggestedFieldNames.poll();
String newFieldName = SchemaUtilities.getFieldName(oldFieldName, suggestNewFieldName);
Re... | For aggregates over window, derive the expected field's schema using RexOver's return type alone.
Example RexOver:
ROW_NUMBER() OVER (PARTITION BY colA, colB ORDER BY colC DESC) | handleUDFFieldAccess | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RexNode visitSubQuery(RexSubQuery rexSubQuery) {
// TODO: implement this method
return super.visitSubQuery(rexSubQuery);
} | For aggregates over window, derive the expected field's schema using RexOver's return type alone.
Example RexOver:
ROW_NUMBER() OVER (PARTITION BY colA, colB ORDER BY colC DESC) | visitSubQuery | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RexNode visitTableInputRef(RexTableInputRef rexTableInputRef) {
// TODO: implement this method
return super.visitTableInputRef(rexTableInputRef);
} | For aggregates over window, derive the expected field's schema using RexOver's return type alone.
Example RexOver:
ROW_NUMBER() OVER (PARTITION BY colA, colB ORDER BY colC DESC) | visitTableInputRef | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
@Override
public RexNode visitPatternFieldRef(RexPatternFieldRef rexPatternFieldRef) {
// TODO: implement this method
return super.visitPatternFieldRef(rexPatternFieldRef);
} | For aggregates over window, derive the expected field's schema using RexOver's return type alone.
Example RexOver:
ROW_NUMBER() OVER (PARTITION BY colA, colB ORDER BY colC DESC) | visitPatternFieldRef | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
private void appendRexInputRefField(RexInputRef rexInputRef) {
Schema.Field field = inputSchema.getFields().get(rexInputRef.getIndex());
String oldFieldName = field.name();
String suggestNewFieldName = suggestedFieldNames.poll();
String newFieldName = SchemaUtilities.getFieldName(oldFieldName, s... | For aggregates over window, derive the expected field's schema using RexOver's return type alone.
Example RexOver:
ROW_NUMBER() OVER (PARTITION BY colA, colB ORDER BY colC DESC) | appendRexInputRefField | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
private void appendField(RelDataType fieldType, boolean isNullable, String doc) {
String fieldName = SchemaUtilities.getFieldName("", suggestedFieldNames.poll());
SchemaUtilities.appendField(fieldName, fieldType, doc, fieldAssembler, isNullable);
} | For aggregates over window, derive the expected field's schema using RexOver's return type alone.
Example RexOver:
ROW_NUMBER() OVER (PARTITION BY colA, colB ORDER BY colC DESC) | appendField | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
private Schema.Field getFieldFromTopSchema(@Nonnull Schema topSchema, @Nonnull String fieldName,
@Nonnull Deque<String> innerRecordNames) {
topSchema = SchemaUtilities.extractIfOption(topSchema);
while (topSchema.getType() != Schema.Type.RECORD
|| topSchema.getFields().stream().noneMatch(... | Get the field named `fieldName` in the given `topSchema` which might be nested
@param innerRecordNames contains inner record names, if `topSchema` contains inner record, we need to retrieve the inner record which
is the ancestor of field named `fieldName` | getFieldFromTopSchema | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/RelToAvroSchemaConverter.java | BSD-2-Clause |
static Schema getCasePreservedSchemaForTable(@Nonnull final Table table) {
Preconditions.checkNotNull(table);
Schema avroSchema = getCasePreservedSchemaFromTblProperties(table);
if (avroSchema == null) {
return null;
}
// add partition columns to schema if table is partitioned
Schema tab... | This method return case preserved avro schema including partition columns for table
@param table
@return case preserved avro schema for table including partition columns | getCasePreservedSchemaForTable | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/SchemaUtilities.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/SchemaUtilities.java | BSD-2-Clause |
static Schema getAvroSchemaForTable(@Nonnull final Table table, boolean strictMode) {
Preconditions.checkNotNull(table);
Schema resultTableSchema;
Schema originalTableSchema = SchemaUtilities.getCasePreservedSchemaForTable(table);
if (originalTableSchema == null) {
if (!strictMode) {
LOG.w... | This method return avro schema including partition columns for table
If avro schema exists in table properties, retrieve it from table properties
Otherwise, avro schema is converted from hive schema
@param table
@param strictMode if set to true, we do not fall back to Hive schema
@return Avro schema for table includi... | getAvroSchemaForTable | java | linkedin/coral | coral-schema/src/main/java/com/linkedin/coral/schema/avro/SchemaUtilities.java | https://github.com/linkedin/coral/blob/master/coral-schema/src/main/java/com/linkedin/coral/schema/avro/SchemaUtilities.java | BSD-2-Clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.