-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support array_append #1072
Changes from 3 commits
2e7843c
1715e49
f4d8447
923f7f9
7c300f0
dd64271
5e5c888
6724821
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2313,4 +2313,25 @@ class CometExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelper { | |
} | ||
} | ||
} | ||
|
||
test("array_append") { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be good to also have a test where the first argument to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch, I think I managed to create a test which creates this scenario:
Should I create an issue on the DataFusion repo? Or is it unlikely that they will support it because their implementation seems to match the one of Postgres? Datafusion / Postgres
Spark
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting. Let's handle this in Comet rather than modify DataFusion. One option is to fork the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have now updated the branch with a version which adds a case statement to check for NULL. In my opinion it is less effort that way than fork that part of the DataFusion code. |
||
assume(isSpark34Plus) | ||
Seq(true, false).foreach { dictionaryEnabled => | ||
withTempDir { dir => | ||
val path = new Path(dir.toURI.toString, "test.parquet") | ||
makeParquetFileAllTypes(path, dictionaryEnabled = dictionaryEnabled, 10000) | ||
val df = spark.read.parquet(path.toString) | ||
checkSparkAnswerAndOperator(df.select(array_append(array(col("_1")), false))) | ||
checkSparkAnswerAndOperator( | ||
df.select(array_append(array(col("_2"), col("_3"), col("_4")), 4))) | ||
checkSparkAnswerAndOperator( | ||
df.select(array_append(array(col("_2"), col("_3"), col("_4")), null))) | ||
checkSparkAnswerAndOperator(df.select(array_append(array(col("_6"), col("_7")), 6.5))) | ||
checkSparkAnswerAndOperator(df.select(array_append(array(col("_8")), "test"))) | ||
checkSparkAnswerAndOperator(df.select(array_append(array(col("_19")), col("_19")))) | ||
checkSparkAnswerAndOperator( | ||
df.select(array_append(expr("CASE WHEN _2=_3 THEN array(_4) END"), col("_4")))) | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use
?
rather thanunwrap
here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I have added a commit to use ? instead of unwrap