Skip to content

Conversation

@Ariznawlll
Copy link
Contributor

@Ariznawlll Ariznawlll commented Nov 3, 2025

User description

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

rm tag 19998
issue ##19998

What this PR does / why we need it:

rm tag 19998


PR Type

Bug fix, Tests


Description


Diagram Walkthrough

flowchart LR
  A["Issue #19998<br/>Mixed Types in IF/GROUPING"] --> B["Remove Issue Tag<br/>from Test"]
  A --> C["Add Test Cases<br/>for Mixed Types"]
  B --> D["Update rollup.sql<br/>Remove @bvt:issue#19998"]
  C --> E["Create sales_mixed_types<br/>Test Table"]
  E --> F["Add 6 Test Queries<br/>IF/GROUPING Scenarios"]
  F --> G["Update rollup.result<br/>with Expected Output"]
Loading

File Walkthrough

Relevant files
Tests
rollup.sql
Add comprehensive tests for mixed type IF/GROUPING handling

test/distributed/cases/window/rollup.sql

+93/-2   
rollup.result
Update expected results for issue #19998 tests                     

test/distributed/cases/window/rollup.result

  • Replaced [unknown result because it is related to issue#19998] with
    actual expected output
  • Added 15 rows of expected results for the first test case
  • Added 132 lines of expected output for 6 new test queries
  • Results demonstrate correct varchar return type and proper GROUPING
    behavior
+139/-1 

@Ariznawlll Ariznawlll requested a review from heni02 as a code owner November 3, 2025 09:55
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Ariznawl@163.com seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@qodo-merge-pro
Copy link

qodo-merge-pro bot commented Nov 3, 2025

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status:
No auditing: The added SQL test queries execute DDL/DML without any audit logging or verification of
audit trail outputs, though as tests this may be acceptable in this context.

Referred Code
create table sales_mixed_types (
    year int,
    quarter int,
    region text,
    amount decimal(10, 2)
);

insert into sales_mixed_types (year, quarter, region, amount) values
(2021, 1, 'North', 10000),
(2021, 1, 'South', 15000),
(2021, 2, 'North', 20000),
(2021, 2, 'South', 25000),
(2022, 1, 'North', 30000),
(2022, 1, 'South', 35000),
(2022, 2, 'North', 40000),
(2022, 2, 'South', 45000);

-- Test 1: IF with string literal and numeric column (the original failing case)
select
    if(grouping(year), 'All years', year) AS year_label,
    if(grouping(quarter), 'All quarters', quarter) as quarter_label,


 ... (clipped 68 lines)
Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status:
No error checks: The new test queries do not include explicit validation or handling for potential
execution errors or empty result sets, which might be acceptable for deterministic SQL
test fixtures.

Referred Code
-- Test 1: IF with string literal and numeric column (the original failing case)
select
    if(grouping(year), 'All years', year) AS year_label,
    if(grouping(quarter), 'All quarters', quarter) as quarter_label,
    region,
    sum(amount) as total_sales
from
    sales_mixed_types
group by
    year,
    quarter,
    region with rollup
order by year_label, quarter_label, region;

-- Test 2: Mixed types in different order (number first, string second)
select
    if(grouping(year) = 0, year, 'Grand Total') AS year_label,
    sum(amount) as total_sales
from
    sales_mixed_types
group by


 ... (clipped 49 lines)
Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status:
Test data trust: The SQL inserts and selects rely on static test data without validation or
parameterization, which is typical for tests but offers no explicit safeguards against
injection or unsafe inputs.

Referred Code
insert into sales_mixed_types (year, quarter, region, amount) values
(2021, 1, 'North', 10000),
(2021, 1, 'South', 15000),
(2021, 2, 'North', 20000),
(2021, 2, 'South', 25000),
(2022, 1, 'North', 30000),
(2022, 1, 'South', 35000),
(2022, 2, 'North', 40000),
(2022, 2, 'South', 45000);

-- Test 1: IF with string literal and numeric column (the original failing case)
select
    if(grouping(year), 'All years', year) AS year_label,
    if(grouping(quarter), 'All quarters', quarter) as quarter_label,
    region,
    sum(amount) as total_sales
from
    sales_mixed_types
group by
    year,
    quarter,


 ... (clipped 59 lines)
  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@mergify mergify bot requested a review from XuPeng-SH November 3, 2025 09:56
@qodo-merge-pro
Copy link

qodo-merge-pro bot commented Nov 3, 2025

PR Code Suggestions ✨

No code suggestions found for the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/wip kind/bug Something isn't working Review effort 2/5 size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants