Skip to content

[UT] sqltest case optimization #76167

Merged
huailiu1122 merged 6 commits into
StarRocks:branch-4.0from
tiannan-sr:branch-4.0
Jul 10, 2026
Merged

[UT] sqltest case optimization #76167
huailiu1122 merged 6 commits into
StarRocks:branch-4.0from
tiannan-sr:branch-4.0

Conversation

@tiannan-sr

@tiannan-sr tiannan-sr commented Jul 10, 2026

Copy link
Copy Markdown

Why I'm doing:

branch-4.0 nightly SQL-tester runs (2026-07-08/09, both shared-nothing and shared-data) failed on a batch of cases. None of the failures are product regressions on this branch; they fall into three categories: (a) behavior-change backports that landed without their test updates, (b) cases synced from main that depend on main-only features/failpoints, and (c) stale or broken case text that main has since rewritten.

What I'm doing:

1. Adapt expectations to behavior-change backports already on branch-4.0 (b6b3fde, 453650c)

2. Adapt cases that carry main-only content (453650c, e782150)

3. Remove cases whose prerequisites are not on branch-4.0 (b6b3fde, 453650c, db57a5f, 9534397)

Also fixes sr_sql_lib.py _wait_for_query_detail to escape single quotes so query details containing 'root'@'%' can be embedded in parse_json() literals.

Fixes #issue

What type of PR is this:

  • BugFix
  • Feature
  • Enhancement
  • Refactor
  • UT
  • Doc
  • Tool

Does this PR entail a change in behavior?

  • Yes, this PR will result in a change in behavior.
  • No, this PR will not result in a change in behavior.

If yes, please specify the type of change:

  • Interface/UI changes: syntax, type conversion, expression evaluation, display information
  • Parameter changes: default values, similar parameters but with different default values
  • Policy changes: use new policy to replace old one, functionality automatically enabled
  • Feature removed
  • Miscellaneous: upgrade & downgrade compatibility, etc.

Checklist:

  • I have added test cases for my bug fix or my new feature
  • This pr needs user documentation (for new or modified features or behaviors)
    • I have added documentation for my new feature or new function
    • This pr needs auto generate documentation
  • This is a backport pr

Bugfix cherry-pick branch check:

  • I have checked the version labels which the pr will be auto-backported to the target branch
    • 4.1
    • 4.0
    • 3.5

🤖 Generated with Claude Code

tiannan-sr and others added 5 commits July 10, 2026 10:46
…r changes

Port the applicable subset of the branch-4.1 fixes (bd2a0b8): only
the categories whose causing behavior-change PRs are present on
branch-4.0.

- regexp_extract_all group-0/out-of-range semantics (backport StarRocks#75798,
  on 4.0 as StarRocks#75880): update test_regex expected results.
- SQLTester strict empty-result validation (backport StarRocks#71982, on 4.0 as
  StarRocks#71995): add the approx_top_k empty-input row and the udtfstring("")
  two-empty-rows result.
- CTAS preserves declared varchar length (backport StarRocks#73498, on 4.0 as
  StarRocks#74821): test_hive_comment now expects varchar(20).
- Deployment-mode output tolerance (safe in both modes): regex-tolerate
  the COMMENT/PROPERTIES section in test_expr_str2date show-create and
  the optional warehouse property in test_show_create_routine_load
  (regex rebuilt on 4.0's recorded output: backticked WHERE column,
  pause_on_fatal_parse_error property), and normalize CLOUD_NATIVE*
  object types in test_object_dependencies.
- Escape single quotes in _wait_for_query_detail so query details
  containing userIdentity ('root'@'%') can be embedded in
  parse_json('...') SQL literals.
- Remove test_spill_sort_cancel: it needs the spill_submit_error fail
  point from StarRocks#74587, which is not on branch-4.0.

Not ported because the causing PRs are absent on branch-4.0: struct
backtick error messages (StarRocks#68967), REFRESH_TYPE ASYNC (StarRocks#74342),
refresh_mode=auto rejection (StarRocks#72313), storage-volume access check
(StarRocks#70053), flat-json counter rename (StarRocks#68780), variant parquet lazy
materialization (StarRocks#75003). test_mv_iceberg_replace_partition_field does
not exist on 4.0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The branch-4.0 test tree contains cases synced from main whose driving
features/formatting never landed on 4.0. Adapt them to 4.0 behavior:

- ORDER BY ALL is not in the 4.0 grammar: rewrite to ORDER BY 1 in
  test_cte_in_where_subquery and to ORDER BY 1..8 in
  test_skew_join_with_pre_topn (order feeds LIMIT 3 there).
- Key-type/distribution error message on 4.0 is "... must use hash
  distribution" (CreateTableAnalyzer), not main's "... cannot use
  random distribution": update test_random_distribution.
- SHOW CREATE on 4.0 prints the routine-load WHERE column without
  backticks and iceberg partition clause without parentheses: make
  backticks optional in the test_show_create_routine_load regex
  (self-tested against both variants) and expect
  "PARTITION BY `k3`" in test_iceberg_view.
- 4.0 explain-costs prints scan predicates as "pk IS NOT NULL", not
  main's typed "[.. INT, true] IS NOT NULL": update
  test_window_skew_rewrite_with_null.
- 4.0 parser error tokens differ: update the expected token list in
  test_skew_join_v2.
- ANALYZE TABLE returns a status row (with a uuid db name): mark the
  two statements [UC] in test_join_predicate_reuse_feedback.
- decimal256 overflow rows are filtered under strict insert on 4.0 too
  (nightly evidence: "Insert has filtered data"): port the 4.1
  insert_max_filter_ratio=1 pin to test_read_write_decimal256.
- Remove cases whose prerequisites are main-only:
  test_iceberg_equality_delete_null_key (CALL procedure, StarRocks#61856),
  test_non_partitioned/partitioned_mv_with_dropped_partitions
  (Iceberg DELETE), and the STRUCT_CAST_BY_NAME section of
  test_jvm_struct_udf (StarRocks#69845) while keeping the position-based
  coverage.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Shared-data-run failures, all test-side or missing-backport issues:

- test_load_brpc_reached_timeout / test_load_ha: tag @Native. Main makes
  the brpc-timeout case work in shared-data via StarRocks#67019, which adds the
  tablets_channel_add_chunk_wait_write_block trigger to
  lake_tablets_channel.cpp; branch-4.0 lacks that BE change, so the lake
  write path never blocks and the load succeeds (error_msg NULL).
  test_load_ha got @Native in the same main commit. Drop the
  test_load_brpc_reached_timeout tag if StarRocks#67019 is backported.
- test_flat_json_predicate: sync T/R from main (StarRocks#68780). The profile
  views now filter zero counters ("not like '- %: 0'"), tolerating that
  shared-data profiles have no GinFilterRows line (no GIN on lake
  tables).
- test_table_sample: tag @Native per main (StarRocks#67319); by_block sampling
  does not apply to lake tables and falls back to a full scan
  (655350 rows instead of the 6144-row sample).
- test_timetravel: sync T/R from main's unstable-UT hardening
  (StarRocks#64386/StarRocks#65675/StarRocks#65993/StarRocks#68728): disable iceberg metadata cache
  (the stale cached branch snapshot returned 1,2,55 after the insert
  overwrite wrote 111), retry_execute_sql on HMS-flaky writes, explicit
  db location plus ossutil cleanup. Only the fractional-percent
  additions of main's test_table_sample were NOT ported (that percent
  parsing fix is main-only).

test_spill_sort_cancel (failpoint chunk_sorter_spill_on_set_finishing
missing on 4.0 BE) was already removed in the previous commit; the
shared-data failure has the same root cause.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two deep-dive verdicts from the 2026-07-09 nightly, both stale-case
issues rather than product bugs:

- test_mv_refresh_list_partitions_with_nullable: align with main's
  StarRocks#62014 rewrite (delete with_nullable, add with_nullable1, sync
  with_nullable2). The case predates the rewrite (branch-4.0 forked
  6 days before it) and its non-null-safe retention condition
  ("dt > '2024-01-01'") was recorded against the old string-compare
  behavior for NULL partition values; after backport StarRocks#66353 (StarRocks#65923)
  NULL partitions evaluate as not-retained and are filtered during
  refresh, deterministically dropping the NULL rows the R file expects.
- test_random_distribution/test_async_mv: port main's StarRocks#72130 rewrite.
  The old R section refreshed the ASYNC MV without sync mode and
  immediately selected from it, racing the async task run (empty-table
  failure); T and R had also drifted apart. The new section asserts
  show-create properties and queries the base table only.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Supersedes the @Native tag from the previous commit: retire the case
entirely instead of keeping it shared-nothing-only. It depends on the
lake_tablets_channel failpoint trigger from StarRocks#67019 (40f214e), which
is not on branch-4.0. Restore the case (T/R identical to main) if
StarRocks#67019 is backported.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…4821

The CTAS-varchar backport (StarRocks#73498 -> StarRocks#74821) carried the R file of
test_files_schema_insert (no T counterpart), which exercises the FILES()
"schema" parameter from StarRocks#72033 — a feature not on branch-4.0
(TableFunctionTable has no PROPERTY_SCHEMA). Restore from main if
StarRocks#72033 is ever backported.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@huailiu1122 huailiu1122 merged commit 9b5c829 into StarRocks:branch-4.0 Jul 10, 2026
41 of 42 checks passed
@tiannan-sr

Copy link
Copy Markdown
Author

@Mergifyio backport branch-4.0.13

@mergify

mergify Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

backport branch-4.0.13

✅ Backports have been created

Details

huailiu1122 pushed a commit that referenced this pull request Jul 10, 2026
Co-authored-by: tiannan-sr <90588513+tiannan-sr@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.

2 participants