[test](expr opt) Cover narrow decimal cast nullability - #67893
Open
morrySnow wants to merge 1 commit into
Open
Conversation
### What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary: Narrow numeric casts can introduce NULL even when their input slot is declared NOT NULL. Range-based comparison simplification must therefore preserve the cast as the nullability witness. For example, casting a non-null INT value of 100 or -100 to DECIMALV3(2, 0) yields NULL, so comparisons against the decimal bounds also yield NULL. Existing tests covered a BIGINT-to-TINYINT conversion but did not permanently cover the INT-to-narrow-DECIMAL path or its end-to-end projection and filter behavior. Add exact Cast and TryCast rewrite assertions, a safe decimal widening control, and a regression matrix with rule-disabled results as the oracle.
### Release note
None
### Check List (For Author)
- Test: Unit Test, Regression test, and Manual test
- Extended the comparison simplification unit test with narrow and widening DecimalV3 conversions.
- Added projection, filter, plan-shape, overflow, and rule-disabled regression coverage for Cast and TryCast.
- Ran the focused FE unit test, full FE build with checkstyle, and the generated-output and normal regression runs on a rebuilt local deployment.
- Behavior changed: No. This change adds permanent coverage for existing correct behavior and does not modify production code.
- Does this need documentation: No
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
8 tasks
Contributor
TPC-H: Total hot run time: 16912 ms |
Contributor
TPC-DS: Total hot run time: 81146 ms |
Contributor
ClickBench: Total hot run time: 14.67 s |
hello-stephen
pushed a commit
that referenced
this pull request
Sep 12, 2026
…67897) Since today every `Doris_DorisCloudRegression_VaultP0` run dies in the `run` step before executing a single test, e.g. #67883 (TeamCity build 39010) and #67881 / #67882 / #67885 / #67886 / #67892 / #67893: ``` doris-external--minio Pulling doris-external--minio Error Error response from daemon: pull access denied for minio/minio, repository does not exist or may require 'docker login': denied: requested access to the resource is denied ERROR: start minio docker twice failed ``` MinIO stopped publishing container images in October 2025 (the project is a source-only distribution now, see minio/minio#21647) and the `minio/minio` and `minio/mc` repositories have since been removed from Docker Hub altogether (`https://hub.docker.com/v2/repositories/minio/minio/` answers 404, same for `minio/mc`). The few VaultP0 runs that still pass do so only on agents that have the image cached locally (their logs have no `Pulling` line). The iceberg, hudi and polaris third-party fixtures, `test_file_cache_warmup_read_metrics_docker` (which runs a `docker run minio/minio` itself), the all-in-one `cloud.yml` and the datalake samples reference the same images and are one cache eviction away from the same failure. `quay.io/minio/minio` and `quay.io/minio/mc` still serve every tag we use -- `RELEASE.2024-11-07T00-52-20Z`, `RELEASE.2025-01-20T14-49-07Z`, mc `RELEASE.2025-01-17T23-25-50Z`, the two 2022 tags of the samples and `latest` -- and MinIO keeps pushing hotfix tags there (latest one dated 2026-04). `docker manifest inspect` resolves all of them (amd64 / arm64 / ppc64le). So every reference gets the `quay.io/` prefix and the tags stay exactly as they were: same builds, different registry. The CI agents already pull from quay.io for the OceanBase fixture. A longer-term option is to mirror these three tags into the project's own `doristhirdpartydocker` namespace, which already hosts hive / zookeeper / kafka / trinodb; that needs someone with push access to that Docker Hub organization and can follow separately.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Narrow numeric casts can return NULL for out-of-range values even when the source slot is NOT NULL. A range simplification that uses only the source-slot nullability can incorrectly replace a nullable comparison with a non-null Boolean constant. Existing coverage did not permanently exercise the INT-to-DECIMALV3(2, 0) path end to end.
Root cause
The production fix already preserves a cast that may introduce NULL as the nullability witness for range-derived constants. The remaining gap was test coverage: the focused unit test used BIGINT-to-TINYINT, and there was no permanent SQL regression proving that positive and negative decimal overflow stay NULL in both projections and filters.
Reproduction
Use a NOT NULL INT column containing -100, -99, 0, 99, and 100. Cast it to DECIMALV3(2, 0) and compare it with 99 or -99. The values outside the decimal range cast to NULL, so every comparison on those rows must remain NULL and WHERE must filter those rows out. The same semantics apply to TryCast.
Fix
Tests
./run-fe-ut.sh --run org.apache.doris.nereids.rules.expression.rules.SimplifyComparisonPredicateTest— 14 tests, 0 failures, 0 errors, 0 skipped.DISABLE_BUILD_UI=ON ./build.sh --fe— full FE reactor build passed; checkstyle reported 0 violations.-forceGenOutagainst the rebuilt sandbox — 1 suite passed.