Skip to content

Use Block#bytesCompare for comparisions with strings#17995

Merged
raunaqmorarka merged 1 commit intotrinodb:masterfrom
raunaqmorarka:slice-compare
Jun 26, 2023
Merged

Use Block#bytesCompare for comparisions with strings#17995
raunaqmorarka merged 1 commit intotrinodb:masterfrom
raunaqmorarka:slice-compare

Conversation

@raunaqmorarka
Copy link
Member

@raunaqmorarka raunaqmorarka commented Jun 21, 2023

Description

Avoids overhead of creating a Slice from VariableWidthBlock for LESS_THAN and LESS_THAN_OR_EQUAL comparisions with constant strings

Before
Benchmark                          Mode  Cnt     Score    Error  Units
BenchmarkPageProcessor.compiled   thrpt   50  3956.935 ± 96.529  ops/s
BenchmarkPageProcessor.handCoded  thrpt   50  4515.943 ± 35.327  ops/s

After
Benchmark                          Mode  Cnt     Score     Error  Units
BenchmarkPageProcessor.compiled   thrpt   50  6258.105 ± 172.675  ops/s
BenchmarkPageProcessor.handCoded  thrpt   50  7024.419 ± 116.318  ops/s

Additional context and related issues

Release notes

( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text:

# Section
* Fix some things. ({issue}`issuenumber`)

Avoids overhead of creating a Slice from VariableWidthBlock for
LESS_THAN and LESS_THAN_OR_EQUAL comparisions with constant strings

Before
Benchmark                          Mode  Cnt     Score    Error  Units
BenchmarkPageProcessor.compiled   thrpt   50  3956.935 ± 96.529  ops/s
BenchmarkPageProcessor.handCoded  thrpt   50  4515.943 ± 35.327  ops/s

After
Benchmark                          Mode  Cnt     Score     Error  Units
BenchmarkPageProcessor.compiled   thrpt   50  6258.105 ± 172.675  ops/s
BenchmarkPageProcessor.handCoded  thrpt   50  7024.419 ± 116.318  ops/s
@cla-bot cla-bot bot added the cla-signed label Jun 21, 2023
@raunaqmorarka raunaqmorarka requested review from dain and sopel39 June 21, 2023 18:58
if (operatorConvention.callingConvention().getArgumentConventions().equals(List.of(BLOCK_POSITION, BLOCK_POSITION))) {
comparisonCallingConvention = simpleConvention(FAIL_ON_NULL, BLOCK_POSITION, BLOCK_POSITION);
}
else if (operatorConvention.callingConvention().getArgumentConventions().equals(List.of(NEVER_NULL, BLOCK_POSITION))) {
Copy link
Member

Choose a reason for hiding this comment

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

what if type does not implement that convention?

Copy link
Member

Choose a reason for hiding this comment

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

The code below passes tis convention to adaptOperator, which will look for the exact a function with that exact convention, and if not found it will ask for the (NEVER_NULL, NEVER_NULL ) version and adapt that to (NEVER_NULL, BLOCK_POSITION) using the scalar function adapter

if (operatorConvention.callingConvention().getArgumentConventions().equals(List.of(BLOCK_POSITION, BLOCK_POSITION))) {
comparisonCallingConvention = simpleConvention(FAIL_ON_NULL, BLOCK_POSITION, BLOCK_POSITION);
}
else if (operatorConvention.callingConvention().getArgumentConventions().equals(List.of(NEVER_NULL, BLOCK_POSITION))) {
Copy link
Member

Choose a reason for hiding this comment

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

The code below passes tis convention to adaptOperator, which will look for the exact a function with that exact convention, and if not found it will ask for the (NEVER_NULL, NEVER_NULL ) version and adapt that to (NEVER_NULL, BLOCK_POSITION) using the scalar function adapter

@raunaqmorarka raunaqmorarka merged commit c19629d into trinodb:master Jun 26, 2023
@raunaqmorarka raunaqmorarka deleted the slice-compare branch June 26, 2023 05:58
@github-actions github-actions bot added this to the 421 milestone Jun 26, 2023
@raunaqmorarka
Copy link
Member Author

No noticeable change in TPC
Slice bytesCompare parquet unpartitioned sf1k.pdf

@colebow colebow added the no-release-notes This pull request does not require release notes entry label Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed no-release-notes This pull request does not require release notes entry

Development

Successfully merging this pull request may close these issues.

4 participants