Skip to content

support sum_int in TiFlash#10695

Merged
ti-chi-bot[bot] merged 3 commits intopingcap:feature/release-8.5-materialized-viewfrom
windtalker:feature/materialized_view
Feb 13, 2026
Merged

support sum_int in TiFlash#10695
ti-chi-bot[bot] merged 3 commits intopingcap:feature/release-8.5-materialized-viewfrom
windtalker:feature/materialized_view

Conversation

@windtalker
Copy link
Contributor

@windtalker windtalker commented Jan 30, 2026

What problem does this PR solve?

Issue Number: close #10720

Problem Summary:

What is changed and how it works?


Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

None

Summary by CodeRabbit

  • New Features

    • Added SumInt aggregation function support for integer sum calculations.
  • Chores

    • Updated Docker container image references to new registry paths.
    • Improved branch name sanitization in Docker deployment scripts to handle special characters properly.

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 30, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 30, 2026

📝 Walkthrough

Walkthrough

This PR adds support for the SumInt aggregation function in TiFlash by extending aggregation handlers to recognize and process SumInt expressions, adding comprehensive test coverage, and updating Docker image registry paths with branch name sanitization in test scripts.

Changes

Cohort / File(s) Summary
SumInt Aggregation Support
contrib/tipb, dbms/src/Debug/MockExecutor/AggregationBinder.cpp, dbms/src/Debug/MockExecutor/FuncSigMap.cpp, dbms/src/Flash/Coprocessor/DAGUtils.cpp
Extended aggregation function handling to treat SumInt identically to Sum by adding mapping entries, updating conditional checks in buildAggFunc, and including SumInt in aggregation-function recognition in DAGUtils.
SumInt Aggregation Tests
dbms/src/Flash/Coprocessor/tests/gtest_sum_int_agg_func.cpp
New GoogleTest file covering SumInt expression mapping, string rendering, partial result handling, and return type inference for integer inputs across multiple aggregation modes.
Docker Registry Updates
tests/docker/cluster.yaml, tests/docker/cluster_disable_new_collation.yaml, tests/docker/cluster_new_collation.yaml, tests/docker/cluster_tidb_fail_point.yaml, tests/docker/tiflash-tagged-image.yaml
Updated container image references from hub.pingcap.net registry to us-docker.pkg.dev/pingcap-testing-account registry for pd, tikv, tidb, and tiflash services.
Test Script Branch Sanitization
tests/docker/run.sh, tests/docker/util.sh
Added environment variable exports that sanitize branch and tag names by replacing forward slashes with dashes for PD_BRANCH, TIKV_BRANCH, TIDB_BRANCH, and TAG variables.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • kolafish
  • JinheLin

Poem

🐰 Hop hooray! SumInt arrives in TiFlash today,
Aggregations aligned in every single way,
Tests sing and dance with return types true,
While Docker containers pull fresh and new! 🌟

🚥 Pre-merge checks | ✅ 3 | ❌ 3
❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Most changes are in-scope for sum_int support, but updates to Docker image registries in cluster YAML and shell scripts appear unrelated to the sum_int feature implementation. Move Docker registry updates to a separate PR or provide justification for including them with the sum_int feature implementation.
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description uses the required template structure but leaves critical sections incomplete: the problem summary and commit message are empty, and no detailed explanation of changes is provided. Complete the 'Problem Summary' and 'What is changed and how it works' sections with specific details about the sum_int implementation.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'support sum_int in TiFlash' clearly and concisely describes the main objective of the PR, which is adding support for the sum_int aggregation function in TiFlash.
Linked Issues check ✅ Passed The code changes properly implement sum_int support across TiFlash components: AggregationBinder, FuncSigMap, DAGUtils, and include comprehensive unit tests covering type handling and partial result behavior.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into feature/release-8.5-materialized-view

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@wuhuizuo
Copy link
Contributor

wuhuizuo commented Feb 5, 2026

/retest

Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
@windtalker windtalker force-pushed the feature/materialized_view branch from 9aeb24b to 10aa386 Compare February 13, 2026 02:17
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Feb 13, 2026
Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
@windtalker windtalker changed the title [DNM] for test support sum_int in TiFlash Feb 13, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
dbms/src/Debug/MockExecutor/AggregationBinder.cpp (1)

205-210: ⚠️ Potential issue | 🟡 Minor

SumInt should infer output type signedness from input type, not set ColumnFlagUnsigned unconditionally.

In buildAggFunc (lines 205-210), SumInt is grouped with Count and Sum to set the output type to TypeLongLong with both ColumnFlagUnsigned and ColumnFlagNotNull. However, based on the return type tests in dbms/src/Flash/Coprocessor/tests/gtest_sum_int_agg_func.cpp, the output signedness should match the input: summing Int64 should produce Int64, not UInt64. The current unconditional ColumnFlagUnsigned is incorrect. Consider examining the input type and only setting the unsigned flag when the input type is unsigned.

Additionally, compileAggregation (lines 272–293) does not handle the "sum_int" function name in its checks. While tests currently bypass this via buildAggFunc, adding "sum_int" to the conditions alongside "sum" would improve consistency.

🧹 Nitpick comments (2)
dbms/src/Flash/Coprocessor/DAGExpressionAnalyzer.cpp (1)

1738-1743: Log level escalation from TRACE to DEBUG may increase log noise in production.

Implicit casts are common in query processing; logging each one at DEBUG level could be verbose. If this change is a temporary debugging aid (consistent with the "[DNM] for test" PR title), consider reverting to TRACE before merging.

dbms/src/Flash/Coprocessor/tests/gtest_sum_int_agg_func.cpp (1)

37-47: Unused template parameter TExpectedOutput.

TExpectedOutput is declared but never referenced in checkSumIntReturnType. The actual verification uses string comparison. Either remove the unused parameter or use it for a type-level assertion (e.g., verifying nested->getReturnType() matches DataTypeNumber<TExpectedOutput>).

♻️ Option A: Remove unused parameter
-template <typename TInput, typename TExpectedOutput>
+template <typename TInput>
 void checkSumIntReturnType(const String & expected_output, const String & expected_output_nullable)

Then update callers:

-    checkSumIntReturnType<Int8, Int64>("Int64", "Nullable(Int64)");
+    checkSumIntReturnType<Int8>("Int64", "Nullable(Int64)");

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Feb 13, 2026
@wuhuizuo
Copy link
Contributor

wait for #10721

Signed-off-by: xufei <xufeixw@mail.ustc.edu.cn>
Copy link
Contributor

@xzhangxian1008 xzhangxian1008 left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot bot added the lgtm label Feb 13, 2026
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Feb 13, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gengliqi, xzhangxian1008

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Feb 13, 2026
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Feb 13, 2026

[LGTM Timeline notifier]

Timeline:

  • 2026-02-13 02:42:38.536452892 +0000 UTC m=+159111.616443597: ☑️ agreed by gengliqi.
  • 2026-02-13 05:38:06.081915435 +0000 UTC m=+169639.161906140: ☑️ agreed by xzhangxian1008.

@wuhuizuo
Copy link
Contributor

/retest

@ti-chi-bot ti-chi-bot bot merged commit dae3888 into pingcap:feature/release-8.5-materialized-view Feb 13, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants