Skip to content

Conversation

@metalmatze
Copy link
Contributor

@metalmatze metalmatze commented May 24, 2023

Rationale for this change

See #35711

What changes are included in this PR?

Adding *BinaryDictionaryBuilder.GetValueIndex(i int) int to get the value's index in the dictionary. Then two methods to get a []byte and string results. Value(i int) []byte and ValueStr(i int) string.

Are these changes tested?

So far I have added very little testing. Mostly some sort of integration test to read back values from the BinaryDictionaryBuilder. We should definitely add some test for the *BinaryMemoTable) Value(i int) []byte.

Are there any user-facing changes?

Just additions, no breaking API changes.

cc @zeroshade

@metalmatze metalmatze requested a review from zeroshade as a code owner May 24, 2023 17:16
@github-actions
Copy link

@github-actions
Copy link

⚠️ GitHub issue #35711 has been automatically assigned in GitHub to PR creator.

Copy link
Member

@zeroshade zeroshade left a comment

Choose a reason for hiding this comment

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

@metalmatze the test failure isn't related to this PR, but could you please rebase to resolve the conflict?

Otherwise this LGTM and I'll merge it once the conflict is resolved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just now, I saw that this actually allocates quite a lot of bytes...

For now, I have moved our code to use the Value(i int) []byte method above and then using bytes.Equal to compared our to bytes converted string with what we read from this builder.

Is there a better way you use to convert these bytes to strings in the arrow project? I'm thinking of the yoloString Prometheus has.

Copy link
Member

Choose a reason for hiding this comment

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

return *(*string)(unsafe.Pointer(&b)) will return the string without copying the bytes. 😄

@metalmatze metalmatze force-pushed the go-builders-getvalue branch from 59e44b8 to 571a42c Compare May 25, 2023 18:08
@metalmatze
Copy link
Contributor Author

Rebased. 🙂

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting review Awaiting review labels May 25, 2023
@zeroshade zeroshade merged commit 762bd2a into apache:main May 30, 2023
@metalmatze metalmatze deleted the go-builders-getvalue branch May 30, 2023 17:36
@ursabot
Copy link

ursabot commented May 31, 2023

Benchmark runs are scheduled for baseline = 422174e and contender = 762bd2a. 762bd2a is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Finished ⬇️0.0% ⬆️0.0%] ec2-t3-xlarge-us-east-2
[Failed ⬇️0.0% ⬆️0.03%] test-mac-arm
[Finished ⬇️0.31% ⬆️2.75%] ursa-i9-9960x
[Failed ⬇️0.0% ⬆️0.0%] ursa-thinkcentre-m75q
Buildkite builds:
[Finished] 762bd2ab ec2-t3-xlarge-us-east-2
[Failed] 762bd2ab test-mac-arm
[Finished] 762bd2ab ursa-i9-9960x
[Failed] 762bd2ab ursa-thinkcentre-m75q
[Finished] 422174e9 ec2-t3-xlarge-us-east-2
[Finished] 422174e9 test-mac-arm
[Finished] 422174e9 ursa-i9-9960x
[Failed] 422174e9 ursa-thinkcentre-m75q
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

zeroshade pushed a commit that referenced this pull request Aug 31, 2023
### Rationale for this change

Similar to the changes we've made in #35744 we need this for the BooleanBuilder too.

### What changes are included in this PR?

Adding the method itself and adjusting a test to test both the Value method on the builder and the final array.

### Are these changes tested?

Yes

### Are there any user-facing changes?

Just an enhancement to get on-par with other builders.

* Closes: #37465

Authored-by: Matthias Loibl <mail@matthiasloibl.com>
Signed-off-by: Matt Topol <zotthewizard@gmail.com>
loicalleyne pushed a commit to loicalleyne/arrow that referenced this pull request Nov 13, 2023
### Rationale for this change

Similar to the changes we've made in apache#35744 we need this for the BooleanBuilder too.

### What changes are included in this PR?

Adding the method itself and adjusting a test to test both the Value method on the builder and the final array.

### Are these changes tested?

Yes

### Are there any user-facing changes?

Just an enhancement to get on-par with other builders.

* Closes: apache#37465

Authored-by: Matthias Loibl <mail@matthiasloibl.com>
Signed-off-by: Matt Topol <zotthewizard@gmail.com>
dgreiss pushed a commit to dgreiss/arrow that referenced this pull request Feb 19, 2024
### Rationale for this change

Similar to the changes we've made in apache#35744 we need this for the BooleanBuilder too.

### What changes are included in this PR?

Adding the method itself and adjusting a test to test both the Value method on the builder and the final array.

### Are these changes tested?

Yes

### Are there any user-facing changes?

Just an enhancement to get on-par with other builders.

* Closes: apache#37465

Authored-by: Matthias Loibl <mail@matthiasloibl.com>
Signed-off-by: Matt Topol <zotthewizard@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ability to read values from (Dictionary) Builders

3 participants