-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[feature] [null support # 1] selection only literal in broker null support #10376
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #10376 +/- ##
=============================================
+ Coverage 13.97% 64.09% +50.12%
- Complexity 237 6090 +5853
=============================================
Files 2016 2016
Lines 109575 109491 -84
Branches 16778 16759 -19
=============================================
+ Hits 15315 70181 +54866
+ Misses 93012 34172 -58840
- Partials 1248 5138 +3890
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1348 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
If false -> if true?
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.
Good catch. Updated the comment.
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.
(Object) value -> (Object) null?
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.
The value should already be null here. but yeah, it is more clear we pas in a null. updated the code.
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 can avoid branching here and simply return "null"
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.
done
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.
There are like one thousand places where FieldSpec.DataType, which is specially problematic in switch. Here the datatype I proposed in #10361 may be useful, but we decided to drop it.
Have you checked the impact of this new literal in these switch? Or do you plan to do that in another PR?
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.
Yeah. this PR just adds the interface needed and handles the broker logic.
Adding an extra type makes sure the code will error out when there is an error. instead of using some existing type to hide the error.
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.
My point is that this PR does add UNKNOWN literal into FieldSpec.DataType, but doesn't changes any of the places where FieldSpec.DataType was used. This is specially important on switches. If they include a default case, the new literal will fall on that case, which will usually throw exceptions. In case of switchs without default case it can even be worse.
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.
Oh. I''ll add the handling later since null literal isn't supported today anyway
|
Can some contributor approve the workflow please? Otherwise we cannot see the result of the tests. |
gortiz
left a comment
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.
LGTM
Jackie-Jiang
left a comment
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.
LGTM otherwise
| return expression; | ||
| } | ||
|
|
||
| public static Expression getUnknownLiteralExpression() { |
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.
(minor)
| public static Expression getUnknownLiteralExpression() { | |
| public static Expression getNullLiteralExpression() { |
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.
done
| for (int i = 0; i < numOperands; i++) { | ||
| arguments[i] = function.getOperands().get(i).getLiteral().getFieldValue(); | ||
| Literal literal = function.getOperands().get(i).getLiteral(); | ||
| if (literal.getSetField() == Literal._Fields.NULL_VALUE) { |
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.
(minor)
| if (literal.getSetField() == Literal._Fields.NULL_VALUE) { | |
| if (literal.isSetNullValue) { |
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.
done
| OBJECTS[rowId] = isNull ? null : RANDOM.nextDouble(); | ||
| dataTableBuilder.setColumn(colId, OBJECTS[rowId]); | ||
| break; | ||
| case UNKNOWN: |
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.
(nit) Move it to the end
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.
done
| Assert.assertEquals(ObjectSerDeUtils.deserialize(customObject), OBJECTS[rowId], ERROR_MESSAGE); | ||
| } | ||
| break; | ||
| case UNKNOWN: |
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.
(nit) Move it to the end
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.
done
| Object nulValue = newDataTable.getCustomObject(rowId, colId); | ||
| Assert.assertNull(nulValue, ERROR_MESSAGE); |
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.
(nit)
| Object nulValue = newDataTable.getCustomObject(rowId, colId); | |
| Assert.assertNull(nulValue, ERROR_MESSAGE); | |
| Assert.assertNull(newDataTable.getCustomObject(rowId, colId), ERROR_MESSAGE); |
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.
done
Support null literal in broker logic for selection only query.
Scalar functions are categorized as null tolerant vs intolerant.
intolerant scalar functions return null when any of the arg is null.
Introduce null columnDataType as passing used to pass broker response back to user.