Coral-Spark: Build awareness in Coral for coalsce_struct UDF#193
Coral-Spark: Build awareness in Coral for coalsce_struct UDF#193ljfgem merged 12 commits intolinkedin:masterfrom
Conversation
|
Should the coalesce_struct UDF be part of Coral? |
wmoustafa
left a comment
There was a problem hiding this comment.
Should both Spark and Trino be handled in the same PR?
coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/HiveReturnTypes.java
Outdated
Show resolved
Hide resolved
coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/HiveReturnTypes.java
Outdated
Show resolved
Hide resolved
coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/HiveReturnTypes.java
Outdated
Show resolved
Hide resolved
coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/HiveReturnTypes.java
Outdated
Show resolved
Hide resolved
coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/HiveReturnTypes.java
Outdated
Show resolved
Hide resolved
Why is that if that is going to be a Hive UDF, or do you think it should be statically defined in Coral and being loaded into engines when being used ? |
Before the change, only Spark IR Transformer (during IR -> Spark RelNode) handles the |
I meant the GenericUDF definition, yes. But, I think it is okay if the function is not part of Coral. |
Ok, makes sense. We can restrict |
|
@wmoustafa Can you take a second look ? thanks ! |
coral-spark/src/test/java/com/linkedin/coral/spark/TestUtils.java
Outdated
Show resolved
Hide resolved
ljfgem
left a comment
There was a problem hiding this comment.
Thanks @autumnust for this PR!
coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoalesceStructUtility.java
Outdated
Show resolved
Hide resolved
coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoalesceStructUtility.java
Outdated
Show resolved
Hide resolved
coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoalesceStructUtility.java
Outdated
Show resolved
Hide resolved
coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/HiveReturnTypes.java
Outdated
Show resolved
Hide resolved
...hive/src/test/java/com/linkedin/coral/hive/hive2rel/functions/CoalesceStructUtilityTest.java
Outdated
Show resolved
Hide resolved
...hive/src/test/java/com/linkedin/coral/hive/hive2rel/functions/CoalesceStructUtilityTest.java
Outdated
Show resolved
Hide resolved
...ive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/StaticHiveFunctionRegistry.java
Outdated
Show resolved
Hide resolved
coral-spark/src/test/java/com/linkedin/coral/spark/CoralSparkTest.java
Outdated
Show resolved
Hide resolved
coral-spark/src/test/java/com/linkedin/coral/spark/TestUtils.java
Outdated
Show resolved
Hide resolved
|
Looks like the Github action is failing with weird reason: @ljfgem have you seen this ? this failure couldn't be reproduced locally and the error message doesn't seem to make sense since there's only one |
...hive/src/test/java/com/linkedin/coral/hive/hive2rel/functions/CoalesceStructUtilityTest.java
Outdated
Show resolved
Hide resolved
ljfgem
left a comment
There was a problem hiding this comment.
Thanks @autumnust for this patch!
coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoalesceStructUtility.java
Outdated
Show resolved
Hide resolved
coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoalesceStructUtility.java
Show resolved
Hide resolved
coral-hive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/CoalesceStructUtility.java
Show resolved
Hide resolved
...ive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/StaticHiveFunctionRegistry.java
Outdated
Show resolved
Hide resolved
...ive/src/main/java/com/linkedin/coral/hive/hive2rel/functions/StaticHiveFunctionRegistry.java
Outdated
Show resolved
Hide resolved
coral-hive/src/test/java/com/linkedin/coral/hive/hive2rel/HiveTableTest.java
Show resolved
Hide resolved
...hive/src/test/java/com/linkedin/coral/hive/hive2rel/functions/CoalesceStructUtilityTest.java
Outdated
Show resolved
Hide resolved
...hive/src/test/java/com/linkedin/coral/hive/hive2rel/functions/CoalesceStructUtilityTest.java
Show resolved
Hide resolved
coral-spark/src/main/java/com/linkedin/coral/spark/IRRelToSparkRelTransformer.java
Show resolved
Hide resolved
ljfgem
left a comment
There was a problem hiding this comment.
LGTM, thanks
@wmoustafa @funcheetah PTAL if you get a chance.
… seems to require the PR concerning on IR type first
…on in type conversion within HiveReturnTypes.java
…into coral-hive package; Addressed the comments by adding nested union unit test cases and verifying the RelDataType of coalesce_struct's output
funcheetah
left a comment
There was a problem hiding this comment.
Thanks @autumnust ! LGTM
This patch includes change to swap
extract_unionUDF withcoalesce_structUDF in Coral-Spark during CoralRelNode-> SparkRelNode.In #192, we have changed the interpretation of union field in IR to a struct that aligns with Trino's after-explosion schema. The output struct which contains
tagfield and names each member field asfieldNis backward incompatible with the schema fromextract_unionUDF. This patch is need to bridge the schema difference between both.Note that
coalesce_structUDF will be statically registered.