[Bug] hll_* errors surface as Comet errors instead of HLL_INVALID_INPUT_SKETCH_BUFFER / HLL_UNION_DIFFERENT_LG_K

未关闭
#7,549 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
rust, scala, spark
领域
backend, testing

调研方向

Start with native/common/src/error.rs and the spark-4.x ShimSparkErrorConverter, then inspect nearby error conversion tests and HLL SQL tests. Reproduce the invalid-buffer query and the different-lgConfigK case against Spark and Comet. Done means both cases expose Spark’s specified error condition and SQLSTATE, with regression coverage.

由索引模型根据 Issue 内容生成。

描述

area:expressions bug priority:low
Describe the bug

When the native HLL expressions fail, Comet raises a plain Comet execution error instead of Spark's SparkRuntimeException with the HLL error condition. Both engines fail on the same inputs, but the error class, SQLSTATE and message differ.

Expression Spark error condition (SQLSTATE)
hll_sketch_estimate, hll_union, hll_union_agg on an invalid buffer HLL_INVALID_INPUT_SKETCH_BUFFER (22546)
hll_union, hll_union_agg with different lgConfigK and allowDifferentLgConfigK = false HLL_UNION_DIFFERENT_LG_K (22000)

native/common/src/error.rs SparkError has no HLL variant, so these errors cannot reach SparkErrorConverter / ShimSparkErrorConverter.

Steps to reproduce
SELECT hll_sketch_estimate(X'0102030405');

Spark 4.x raises [HLL_INVALID_INPUT_SKETCH_BUFFER] Invalid call to hll_sketch_estimate; only valid HLL sketch buffers are supported as inputs ... with SQLSTATE 22546. Comet raises a Comet execution error with a different message.

Expected behavior

Comet raises the same error condition and SQLSTATE as Spark. A likely fix, following https://github.com/apache/datafusion-comet/issues/5072 :

  • add SparkError variants for the two conditions in native/common/src/error.rs;
  • map them in the spark-4.x ShimSparkErrorConverter to QueryExecutionErrors.hllInvalidInputSketchBuffer(function) and QueryExecutionErrors.hllUnionDifferentLgK(left, right, function);
  • cover them with expect_error_class SQL tests or checkSparkError.
Additional context

Surfaced by the HLL audit for https://github.com/apache/datafusion-comet/issues/7396 . The comparison experiment confirmed both engines fail on the same inputs ( https://github.com/apache/datafusion-comet/issues/7396#issuecomment-6703600973 ). The serdes currently list this as an incompatible reason that is never returned; the audit PR moves it to a compatibility note that links here.

Willingness to contribute

I can contribute a fix for this bug independently

主要语言
Scala
星标
1.3k
派生
414
平均合并
3 天 5 小时
30 天内合并 PR
210

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/datafusion-comet 的其他 Issue

查看 apache/datafusion-comet 的全部 Issue

相似的 Issue

更多 Scala Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。