Skip to content
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

[multistage] Fixing the bytes literal usage in leaf stage #11732

Closed

Conversation

xiangfu0
Copy link
Contributor

@xiangfu0 xiangfu0 commented Oct 3, 2023

The literal bytes passed from planner is a wrapped proto ByteString. This should be converted to Pinot internal ByteArray at inside LiteralOperand to ensure the bytes RexExpression returns same internal type.

  1. Deserialize proto ByteString to Pinot internal ByteArray
  2. cleanup the usage of proto ByteString

@xiangfu0 xiangfu0 changed the title Fixing the bytes literal usage in leaf stage [multistage] Fixing the bytes literal usage in leaf stage Oct 3, 2023
@xiangfu0 xiangfu0 added bugfix multi-stage Related to the multi-stage query engine labels Oct 3, 2023
@xiangfu0 xiangfu0 force-pushed the fixing-binary-literal-leaf-stage branch 3 times, most recently from d145798 to de1fe30 Compare October 3, 2023 21:39
@codecov-commenter
Copy link

codecov-commenter commented Oct 3, 2023

Codecov Report

Merging #11732 (a52c914) into master (c96221f) will decrease coverage by 48.64%.
The diff coverage is 0.00%.

@@              Coverage Diff              @@
##             master   #11732       +/-   ##
=============================================
- Coverage     63.11%   14.48%   -48.64%     
+ Complexity     1115      201      -914     
=============================================
  Files          2342     2342               
  Lines        125899   125907        +8     
  Branches      19364    19367        +3     
=============================================
- Hits          79464    18237    -61227     
- Misses        40780   106120    +65340     
+ Partials       5655     1550     -4105     
Flag Coverage Δ
integration 0.00% <0.00%> (-0.01%) ⬇️
integration1 ?
integration2 0.00% <0.00%> (ø)
java-11 14.42% <0.00%> (-48.64%) ⬇️
java-17 14.41% <0.00%> (-48.56%) ⬇️
java-20 14.47% <0.00%> (-48.48%) ⬇️
temurin 14.48% <0.00%> (-48.64%) ⬇️
unittests 14.48% <0.00%> (-48.63%) ⬇️
unittests1 ?
unittests2 14.48% <0.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...inot/query/planner/logical/RexExpressionUtils.java 0.00% <0.00%> (-73.95%) ⬇️
...pache/pinot/common/utils/request/RequestUtils.java 0.00% <0.00%> (-59.55%) ⬇️
...t/query/planner/serde/ProtoSerializationUtils.java 0.00% <0.00%> (-83.64%) ⬇️

... and 1514 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@xiangfu0 xiangfu0 force-pushed the fixing-binary-literal-leaf-stage branch 2 times, most recently from d89d213 to 1f1b572 Compare October 3, 2023 22:38
@xiangfu0 xiangfu0 force-pushed the fixing-binary-literal-leaf-stage branch 6 times, most recently from 4424df9 to e7290eb Compare October 4, 2023 06:19
@xiangfu0 xiangfu0 force-pushed the fixing-binary-literal-leaf-stage branch from e7290eb to 4db5ef6 Compare October 4, 2023 07:55
server1.start();
// Start server1 to ensure the next server will have a different port.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this change for?

Copy link
Contributor Author

@xiangfu0 xiangfu0 Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw port AlreadyBind issue from here in the tests.

@@ -28,7 +29,22 @@ public class LiteralOperand implements TransformOperand {

public LiteralOperand(RexExpression.Literal rexExpression) {
_resultType = rexExpression.getDataType();
_value = rexExpression.getValue();
_value = convert(rexExpression.getValue());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to convert the value to the internal type. I think TIMESTAMP might not be handled correctly right now, where the raw value is not really the external value format Timestamp, so we may add a special case for that and add a TODO to fix that in the future

Suggested change
_value = convert(rexExpression.getValue());
_value = _resultType.toInternal(rexExpression.getValue());

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1. this and the rest of the places, ProtoSer/De only provide an identical mapping from ser/de perspective. for this particular situation, we need to leverage the RexExpression.Literal structure, which not only encode the value but also the type

we also need to make sure that proto ser/de only accepts particular type -->
if the data is ByteArray, byte[], or ByteString which can all ser/de into ByteString we should not allow that --> e.g. need to make sure the Ser/De is symmetrics

particularly in this case we should not allow the object to be GeogeorianCalendar --> it shouldl explicitly converted into long before setting it into the Literal

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the proto serde to generate internal data type directly

@xiangfu0 xiangfu0 force-pushed the fixing-binary-literal-leaf-stage branch 4 times, most recently from 8b2ddfe to 5923197 Compare October 4, 2023 20:08
@xiangfu0 xiangfu0 force-pushed the fixing-binary-literal-leaf-stage branch from 5923197 to a52c914 Compare October 4, 2023 21:14
@xiangfu0 xiangfu0 closed this Oct 4, 2023
@xiangfu0 xiangfu0 deleted the fixing-binary-literal-leaf-stage branch October 4, 2023 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix multi-stage Related to the multi-stage query engine
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants