-
Notifications
You must be signed in to change notification settings - Fork 268
chore: Respect to legacySizeOfNull option for size function #3036
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
base: main
Are you sure you want to change the base?
chore: Respect to legacySizeOfNull option for size function #3036
Conversation
This reverts commit 768b3e9.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3036 +/- ##
============================================
+ Coverage 56.12% 59.54% +3.41%
- Complexity 976 1381 +405
============================================
Files 119 167 +48
Lines 11743 15537 +3794
Branches 2251 2576 +325
============================================
+ Hits 6591 9251 +2660
- Misses 4012 4989 +977
- Partials 1140 1297 +157 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| test("size - respect to legacySizeOfNull") { | ||
| val table = "t1" | ||
| withSQLConf(CometConf.COMET_NATIVE_SCAN_IMPL.key -> CometConf.SCAN_NATIVE_ICEBERG_COMPAT) { |
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.
we need to make sure the ansi mode is off here. According to Spark
This function returns -1 for null input only if spark.sql.ansi.enabled is false and spark.sql.legacy.sizeOfNull is true. Otherwise, it returns null for null input. With the default settings, the function returns null for null input.
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.
Thanks @comphead. ANSI mode is disabled by default, but for safety, I've explicitly added the setting.
| for { | ||
| isNotNullExprProto <- createIsNotNullExprProto(expr, inputs, binding) | ||
| sizeScalarExprProto <- scalarFunctionExprToProto("size", arrayExprProto) | ||
| emptyLiteralExprProto <- createLiteralExprProto(expr.legacySizeOfNull) |
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.
should we also refer to ansi mode?
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.
|
Thanks the PR makes sense to me, waiting for the CI |

Which issue does this PR close?
N/A
Rationale for this change
What changes are included in this PR?
How are these changes tested?
Test added as part of this PR.