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

Convert to Java Strings only for sketch metric columns of StringType #45

Merged
merged 1 commit into from
Sep 27, 2023

Conversation

vivek-balakrishnan-rovio
Copy link
Collaborator

@vivek-balakrishnan-rovio vivek-balakrishnan-rovio commented Sep 25, 2023

PR avoids the performance degradation due to too many object creation as noticed in #44.
With this change, only String metric columns used in sketches are converted to Java String type.

value = new String(((UTF8String) value).getBytes(), StandardCharsets.UTF_8);
if (value != null && segmentSpec.getComplexMetricColumns().contains(columnName) && sqlType == DataTypes.StringType) {
// Convert to Java String as Spark return UTF8String which is not compatible with Druid sketches.
value = value.toString();
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is this change about (this line)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

calling toString() on UTF8String object is same as the previous code.
I changed to toString() to simplify the code to avoid checking if object is instance of UTF8String.

@vivek-balakrishnan-rovio vivek-balakrishnan-rovio merged commit 532fd22 into main Sep 27, 2023
1 check passed
@vivek-balakrishnan-rovio vivek-balakrishnan-rovio deleted the fix_sketch_string_conversion branch September 27, 2023 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants