Skip to content

[SPARK-53991][SQL][TEST][FOLLOW-UP] Improve KLL quantile errors by removing internal details - #53702

Closed
dtenedor wants to merge 10 commits into
apache:masterfrom
dtenedor:kll-quantiles-golden-files
Closed

[SPARK-53991][SQL][TEST][FOLLOW-UP] Improve KLL quantile errors by removing internal details#53702
dtenedor wants to merge 10 commits into
apache:masterfrom
dtenedor:kll-quantiles-golden-files

Conversation

@dtenedor

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This PR improves error messages from the new KLL quantile sketch functions added in #52800.

Why are the changes needed?

The previous error messages reported internal DataSketches library state which was not meaningful for end users of the SQL/DF functions in Apache Spark.

Does this PR introduce any user-facing change?

Yes, error messages are improved. For example, before this change, we observed the following:

SELECT kll_sketch_get_rank_bigint(agg, 5) AS wrong_type
FROM (
SELECT kll_sketch_agg_float(col1) AS agg
FROM t_float_1_5_through_7_11
)
> For function `kll_sketch_get_rank_bigint`, invalid KLL sketch binary data: reqOffset: 40, reqLength: 56, (reqOff + reqLen): 96, allocSize: 60"

Now the error message becomes:

> "Invalid call to `kll_sketch_get_rank_bigint`; only valid KLL sketch buffers are supported as inputs (such as those produced by the `kll_sketch_agg` function)."

How was this patch tested?

This PR updates golden file test coverage to show the improved error messages.

Was this patch authored or co-authored using generative AI tooling?

No.

@github-actions

Copy link
Copy Markdown

JIRA Issue Information

=== Sub-task SPARK-53991 ===
Summary: Add support for KLL quantiles functions based on DataSketches
Assignee: Daniel Tenedorio
Status: Resolved
Affected: ["4.1.0"]


This comment was automatically generated by GitHub Actions

@dtenedor

Copy link
Copy Markdown
ContributorAuthor

cc @cboumalh@cloud-fan

@@ -4293,7 +4293,7 @@
},
"KLL_SKETCH_INVALID_INPUT" : {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We may want to consider updating this to: KLL_INVALID_INPUT_SKETCH_BUFFER to stay consistent with the errors for Theta and HLL since we also updated the function name below

@cboumalh

Copy link
Copy Markdown
Contributor

Just one comment above, else LGTM. Thank you!

@HyukjinKwonHyukjinKwon changed the title [SPARK-53991][SQL][TEST][FOLLOWUP] Improve KLL quantile errors by removing internal details[SPARK-53991][SQL][TEST][FOLLOW-UP] Improve KLL quantile errors by removing internal detailsJan 6, 2026
@dtenedor
dtenedor requested review from cboumalh and cloud-fan and removed request for cboumalhJanuary 6, 2026 23:18
@cloud-fan

Copy link
Copy Markdown
Contributor

The SparkThrowableSuite failure looks real.

@dtenedor

Copy link
Copy Markdown
ContributorAuthor

The SparkThrowableSuite failure looks real.

Thanks, it was! I pushed a fix, let's run the CI again.

@dtenedor

Copy link
Copy Markdown
ContributorAuthor

OK, all CI is passing now. Merging to master and 4.1.

dtenedor added a commit that referenced this pull request Jan 7, 2026
…moving internal details
### What changes were proposed in this pull request?
This PR improves error messages from the new KLL quantile sketch functions added in #52800.
### Why are the changes needed?
The previous error messages reported internal DataSketches library state which was not meaningful for end users of the SQL/DF functions in Apache Spark.
### Does this PR introduce _any_ user-facing change?
Yes, error messages are improved. For example, before this change, we observed the following:
```
SELECT kll_sketch_get_rank_bigint(agg, 5) AS wrong_type
FROM (
SELECT kll_sketch_agg_float(col1) AS agg
FROM t_float_1_5_through_7_11
)
> For function `kll_sketch_get_rank_bigint`, invalid KLL sketch binary data: reqOffset: 40, reqLength: 56, (reqOff + reqLen): 96, allocSize: 60"
```
Now the error message becomes:
```
> "Invalid call to `kll_sketch_get_rank_bigint`; only valid KLL sketch buffers are supported as inputs (such as those produced by the `kll_sketch_agg` function)."
```
### How was this patch tested?
This PR updates golden file test coverage to show the improved error messages.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes#53702 from dtenedor/kll-quantiles-golden-files.
Authored-by: Daniel Tenedorio <daniel.tenedorio@databricks.com>
Signed-off-by: Daniel Tenedorio <daniel.tenedorio@databricks.com>
(cherry picked from commit 9aea212)
Signed-off-by: Daniel Tenedorio <daniel.tenedorio@databricks.com>
Sign up for freeto 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.

3 participants

@dtenedor@cboumalh@cloud-fan