Skip to content

Commit

Permalink
modify UDF name
Browse files Browse the repository at this point in the history
  • Loading branch information
aastha25 committed Dec 15, 2023
1 parent 03a29bb commit 079d01d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ public boolean isOptional(int i) {
family(SqlTypeFamily.STRING, SqlTypeFamily.ANY, SqlTypeFamily.TIMESTAMP));
createAddUserDefinedFunction("com.linkedin.policy.decoration.udfs.RedactFieldIf", ARG1,
family(SqlTypeFamily.BOOLEAN, SqlTypeFamily.ANY, SqlTypeFamily.STRING, SqlTypeFamily.ANY));
createAddUserDefinedFunction("cast_nullability", new OrdinalReturnTypeInferenceV2(1),
createAddUserDefinedFunction("li_groot_cast_nullability", new OrdinalReturnTypeInferenceV2(1),
family(SqlTypeFamily.ANY, SqlTypeFamily.ANY));

createAddUserDefinedFunction("com.linkedin.policy.decoration.udfs.RedactSecondarySchemaFieldIf", ARG1, family(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1103,16 +1103,17 @@ public void testDivideReturnType() {
}

@Test
public void testCastNullabilityUDF() {
public void testLiGrootCastNullability() {
ViewToAvroSchemaConverter viewToAvroSchemaConverter = ViewToAvroSchemaConverter.create(hiveMetastoreClient);

Schema schemaWithUDF = viewToAvroSchemaConverter
.toAvroSchema("SELECT cast_nullability(Struct_Col, Struct_Col) AS modCol FROM basecomplexnonnullable");
Schema schemaWithUDF = viewToAvroSchemaConverter.toAvroSchema(
"SELECT li_groot_cast_nullability(Struct_Col, Struct_Col) AS modCol FROM basecomplexnonnullable");
Schema schemaWithField =
viewToAvroSchemaConverter.toAvroSchema("SELECT Struct_Col AS modCol FROM basecomplexnonnullable");

Assert.assertEquals(schemaWithUDF.toString(true), TestUtils.loadSchema("testCastNullabilityUDF-expected.avsc"));
Assert.assertEquals(schemaWithField.toString(true), TestUtils.loadSchema("testCastNullabilityUDF-expected.avsc"));
Assert.assertEquals(schemaWithUDF.toString(true), TestUtils.loadSchema("testLiGrootCastNullability-expected.avsc"));
Assert.assertEquals(schemaWithField.toString(true),
TestUtils.loadSchema("testLiGrootCastNullability-expected.avsc"));
}

// TODO: add more unit tests
Expand Down

0 comments on commit 079d01d

Please sign in to comment.