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

[GLUTEN-8921][GLUTEN-8922][CH] Fix checkDecimalOverflowSparkOrNull and lead function #8929

Merged
merged 1 commit into from
Mar 8, 2025

Conversation

lwz9103
Copy link
Contributor

@lwz9103 lwz9103 commented Mar 7, 2025

…d lead function

What changes were proposed in this pull request?

(Please fill in changes proposed in this fix)

(Fixes: #8921, #8922)

How was this patch tested?

(Please explain how this patch was tested. E.g. unit tests, integration tests, manual tests)

(If this patch involves UI changes, please attach a screenshot; otherwise, remove this)

Copy link

github-actions bot commented Mar 7, 2025

#8921

@lwz9103 lwz9103 changed the title [GLUTEN-8921][GLUTEN-8922][CH] Fix checkDecimalOverflowSparkOrNull an… [GLUTEN-8921][GLUTEN-8922][CH] Fix checkDecimalOverflowSparkOrNull and lead function Mar 7, 2025
Copy link

github-actions bot commented Mar 7, 2025

Run Gluten Clickhouse CI on x86

Copy link

github-actions bot commented Mar 7, 2025

Run Gluten Clickhouse CI on x86

@baibaichen
Copy link
Contributor

@CodiumAI-Agent /review

@baibaichen
Copy link
Contributor

@CodiumAI-Agent /improve

@CodiumAI-Agent
Copy link

PR Code Suggestions ✨

CategorySuggestion                                                                                                                                    Impact
Possible issue
Add null pointer check

Add a null pointer check for arg0_col before accessing its properties to avoid
potential segmentation faults.

cpp-ch/local-engine/Parser/aggregate_function_parser/LeadLagParser.cpp [79]

 const auto * arg0_col = parseExpression(actions_dag, arg0);
+if (!arg0_col) {
+    throw std::runtime_error("Failed to parse expression for arg0.");
+}
Suggestion importance[1-10]: 5

__

Why: This suggestion enhances robustness by ensuring that a null pointer is caught before being dereferenced; while not essential if parseExpression is guaranteed non-null, the added safety check can prevent potential runtime errors.

Low
General
Remove duplicate tests

Consolidate duplicate test cases or clearly differentiate their purposes to avoid
redundancy.

backends-clickhouse/src/test/scala/org/apache/gluten/execution/compatibility/GlutenClickhouseFunctionSuite.scala [445-459]

-test("GLUTEN-8921: Type mismatch at checkDecimalOverflowSparkOrNull") {
+test("GLUTEN-8921: Type mismatch - scenario 1") {
   compareResultsAgainstVanillaSpark(
     """
       |select l_shipdate, avg(l_quantity), count(0) over() COU,
       |SUM(-1.1) over() SU, AVG(-2) over() AV,
       |max(-1.1) over() MA, min(-3) over() MI
       |from lineitem
       |where l_shipdate <= date'1998-09-02'
       |group by l_shipdate
       |order by l_shipdate
     """.stripMargin,
     true,
     { _ => }
   )
 }
+// Consider parameterizing similar tests into one.
Suggestion importance[1-10]: 4

__

Why: The suggestion proposes renaming and consolidating similar test cases to reduce redundancy, which is a useful stylistic improvement but not critical to functionality.

Low

Copy link

github-actions bot commented Mar 7, 2025

Run Gluten Clickhouse CI on x86

@CodiumAI-Agent
Copy link

PR Code Suggestions ✨

No code suggestions found for the PR.

Copy link
Contributor

@taiyang-li taiyang-li left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

github-actions bot commented Mar 8, 2025

Run Gluten Clickhouse CI on x86

@baibaichen baibaichen merged commit 26cde39 into apache:main Mar 8, 2025
8 checks passed
yikf pushed a commit to yikf/incubator-gluten that referenced this pull request Mar 13, 2025
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.

[CH] Coredump at checkDecimalOverflowSparkOrNull due to type mismatch
4 participants