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

Improve lpad udf by using a GenericStringBuilder #11987

Merged
merged 7 commits into from
Aug 14, 2024

Conversation

Omega359
Copy link
Contributor

@Omega359 Omega359 commented Aug 14, 2024

Which issue does this PR close?

Closes #11984

Rationale for this change

Code cleanup, performance improvement.

What changes are included in this PR?

Code, benchmark.

Are these changes tested?

Yes

Are there any user-facing changes?

No

@Omega359 Omega359 marked this pull request as ready for review August 14, 2024 15:35
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Looks good to me -- thank you @Omega359

group.bench_function(BenchmarkId::new("largeutf8 type", size), |b| {
b.iter(|| criterion::black_box(rpad().invoke(&args).unwrap()))
});
//
Copy link
Contributor

Choose a reason for hiding this comment

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

any reason to leave this commented out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

rpad update with utf8view wasn't committed yet. I know it would work anyways but I think now that rpad update is committed it's good to uncomment.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can make a follow on PR with cleaning up rpad and applying the same pattern. I filed #11997 to track that idea

return exec_err!("lpad requested length {length} too large");
}
let array = if fill_array.is_none() {
let mut builder: GenericStringBuilder<T> = GenericStringBuilder::new();
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

@alamb alamb merged commit 94034be into apache:main Aug 14, 2024
27 checks passed
@Omega359 Omega359 deleted the feature/lpad_utf8view branch August 15, 2024 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve lpad udf by using a GenericStringBuilder
2 participants