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

executor: use EncodeBytes in countOriginDistinct #10107

Closed
wants to merge 2 commits into from

Conversation

XuHuaiyu
Copy link
Contributor

What problem does this PR solve?

fix issue #10099

What is changed and how it works?

Use EncodeBytes to encode string values in countOriginalWithDistinct.
Before this commit, string values are encoded with true values.
e.g.
encode("1", "122") --> "1122"
encode("11", "22") --> "1222"
These are not comparable.

Check List

Tests

  • Integration test

Code changes

  • Has exported function/method change

Side effects

N/A

Related changes

  • Need to cherry-pick to the release branch

@XuHuaiyu XuHuaiyu added type/bugfix This PR fixes a bug. sig/execution SIG execution labels Apr 10, 2019
Copy link
Contributor

@eurekaka eurekaka left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -329,7 +331,7 @@ func (e *countOriginalWithDistinct) evalAndEncode(
if err != nil || isNull {
break
}
encodedBytes = appendString(encodedBytes, buf, val)
encodedBytes = codec.EncodeBytes(encodedBytes, hack.Slice(val))
Copy link
Contributor

@eurekaka eurekaka Apr 11, 2019

Choose a reason for hiding this comment

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

Looks like appendJSON has risk as well theoretically?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I'll change it.
But it a little difficult to write tests for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I checked the encode and decode functions for JSON.
The encoded result for JSONs seems to be not comparable.
I create an issue #10215 to record this, this would be fixed in an individual PR.

@codecov
Copy link

codecov bot commented Apr 22, 2019

Codecov Report

Merging #10107 into master will decrease coverage by 0.0011%.
The diff coverage is 100%.

@@               Coverage Diff               @@
##            master     #10107        +/-   ##
===============================================
- Coverage   77.952%   77.9509%   -0.0012%     
===============================================
  Files          407        407                
  Lines        83264      83296        +32     
===============================================
+ Hits         64906      64930        +24     
- Misses       13549      13555         +6     
- Partials      4809       4811         +2

@XuHuaiyu XuHuaiyu closed this Apr 22, 2019
@XuHuaiyu XuHuaiyu deleted the count_distinct branch April 22, 2019 09:35
@XuHuaiyu XuHuaiyu restored the count_distinct branch April 22, 2019 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants