-
Notifications
You must be signed in to change notification settings - Fork 174
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 arrays_overlap function #1312
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1312 +/- ##
============================================
- Coverage 34.72% 34.56% -0.16%
+ Complexity 992 965 -27
============================================
Files 117 117
Lines 45046 45077 +31
Branches 9901 9939 +38
============================================
- Hits 15640 15581 -59
- Misses 26253 26332 +79
- Partials 3153 3164 +11 ☔ View full report in Codecov by Sentry. |
@@ -2300,6 +2300,12 @@ object QueryPlanSerde extends Logging with ShimQueryPlanSerde with CometExprShim | |||
expr.children(1), | |||
inputs, | |||
(builder, binaryExpr) => builder.setArrayAppend(binaryExpr)) | |||
case ArraysOverlap(leftArrayExpr, rightArrayExpr) => |
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.
Do we support this for all input data types?
@@ -2568,4 +2568,21 @@ class CometExpressionSuite extends CometTestBase with AdaptiveSparkPlanHelper { | |||
} | |||
} | |||
} | |||
|
|||
test("arrays_overlap") { |
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.
Could you add tests where one or both input expressions evaluate to null on some rows? This can be achieved with a CASE expression as in some of the other array tests
Which issue does this PR close?
Related to Epic: #1042
arrays_overlap
:select arrays_overlap(array('hello', '-', 'world'), array('hello'))
=>true
DataFusion' s array_has_any has same behavior with Spark 's arrays_overlap function
Spark:
https://docs.databricks.com/en/sql/language-manual/functions/arrays_overlap.htmlDataFusion:
https://datafusion.apache.org/user-guide/sql/scalar_functions.html#array-has-anyRationale for this change
Defined under Epic: #1042
What changes are included in this PR?
planner.rs:
Maps Spark 'sarrays_overlap
function to DataFusionarray_has_any
physical expression from Spark physical expression with return type: DataType::Boolean,expr.proto:
arrays_overlap message has been added,QueryPlanSerde.scala:
arrays_overlap pattern matching case has been added,CometExpressionSuite.scala:
A new UT has been added for arrays_overlap function.How are these changes tested?
A new UT has been added.