This is an automated email from the ASF dual-hosted git repository.
eldenmoon pushed a commit to branch branch-4.2
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.2 by this push:
new 0cc76df1f16 branch-4.2: [fix](regression) Stabilize variant schema
change and SNII cases (#70354)
0cc76df1f16 is described below
commit 0cc76df1f16eae236f3e786638dd865150033eb6
Author: lihangyu <[email protected]>
AuthorDate: Wed Nov 25 15:56:31 2026 +0800
branch-4.2: [fix](regression) Stabilize variant schema change and SNII
cases (#70354)
cherry-pick #70196
Conflicts resolved in var_index_snii.groovy (took parse_to_variant
multi-rowset inserts from the pick).
---
.../test_double_write_when_schema_change.out | 1 -
.../test_double_write_when_schema_change.groovy | 2 +-
.../variant_p0/with_index/var_index_snii.groovy | 61 +++++++++++-----------
3 files changed, 31 insertions(+), 33 deletions(-)
diff --git
a/regression-test/data/variant_p0/schema_change/test_double_write_when_schema_change.out
b/regression-test/data/variant_p0/schema_change/test_double_write_when_schema_change.out
index 1190a5f30bd..b5ed2fe133c 100644
---
a/regression-test/data/variant_p0/schema_change/test_double_write_when_schema_change.out
+++
b/regression-test/data/variant_p0/schema_change/test_double_write_when_schema_change.out
@@ -58,4 +58,3 @@ PullRequestEvent 2489395770 2015-01-01T01:00:02Z
5
[{"sha":"97a402b54bfd562b8cefd11f1361cd5af41b0535","author":{"email":"[email protected]","name":"Mohit"},"message":"init","distinct":true,"url":"https://api.github.com/repos/git4ruby/movie_review1/commits/97a402b54bfd562b8cefd11f1361cd5af41b0535"}]
6
[{"sha":"0fb2391e7aabeb57f358d5d51c70c766e6fa00d1","author":{"email":"[email protected]","name":"Uygun
BODUR"},"message":".","distinct":true,"url":"https://api.github.com/repos/uygunuks/AsalSayiKalibi/commits/0fb2391e7aabeb57f358d5d51c70c766e6fa00d1"}]
6
[{"sha":"fe5a3431a486388f6011fa8db52fba8a53f9aa70","author":{"email":"[email protected]","name":"Cole
Campbell"},"message":"Update
README.md","distinct":false,"url":"https://api.github.com/repos/tlgkccampbell/ultraviolet/commits/fe5a3431a486388f6011fa8db52fba8a53f9aa70"},{"sha":"c71669b93924abc498af58855f8fe86564146673","author":{"email":"[email protected]","name":"Cole
Campbell"},"message":"Added missing u [...]
-
diff --git
a/regression-test/suites/variant_p0/schema_change/test_double_write_when_schema_change.groovy
b/regression-test/suites/variant_p0/schema_change/test_double_write_when_schema_change.groovy
index 576fc0a38ab..cf4ca64089a 100644
---
a/regression-test/suites/variant_p0/schema_change/test_double_write_when_schema_change.groovy
+++
b/regression-test/suites/variant_p0/schema_change/test_double_write_when_schema_change.groovy
@@ -129,7 +129,7 @@ suite("double_write_schema_change_with_variant",
"nonConcurrent") {
order by k, cast(v['id'] as string), cast(v['payload']['push_id'] as
bigint), change_column desc limit 10"""
order_qt_sql """select k, v['payload']['commits'] from github_events
where length(cast(v['payload']['commits'] as text)) > 100 and k > 1
- order by k, length(cast(v['payload']['commits'] as text)) limit 10"""
+ order by k, length(cast(v['payload']['commits'] as text)),
cast(v['payload']['commits'][0]['sha'] as text), cast(v['payload']['commits']
as text) limit 10"""
// createMV("create materialized view xxx as select k, sum(k) from
${table_name} group by k order by k;")
// qt_sql "select v['type'], v['id'], v['created_at'] from ${table_name}
where cast(v['id'] as bigint) != 25061216922 order by k, cast(v['id'] as
bigint) limit 10"
diff --git a/regression-test/suites/variant_p0/with_index/var_index_snii.groovy
b/regression-test/suites/variant_p0/with_index/var_index_snii.groovy
index 3c6f33243bd..f17cc86c0e6 100644
--- a/regression-test/suites/variant_p0/with_index/var_index_snii.groovy
+++ b/regression-test/suites/variant_p0/with_index/var_index_snii.groovy
@@ -15,36 +15,23 @@
// specific language governing permissions and limitations
// under the License.
+import org.apache.doris.regression.action.ProfileAction
+
suite("regression_test_variant_var_index_snii", "p0, nonConcurrent"){
// V2 execution keeps a JSON string as a string Variant value; V1 parsed
it on insert.
def variantV2Function = getFeConfig("enable_variant_v2").toBoolean() ?
"parse_to_variant" : ""
- sql "SET enable_segment_limit_pushdown=true"
sql """ set debug_variant_enable_typed_paths_to_sparse = false """
sql """ set debug_variant_enable_doc_mode = false """
+ // The tables here hold a handful of rows, so a matching row is a large
fraction of its segment
+ // and the BKD reader would decline the index as unselective
(INVERTED_INDEX_BYPASS), leaving
+ // the filtered-row assertions below at 0. A zero threshold turns that
selectivity bypass off,
+ // so the assertions measure index participation rather than how the rows
happen to be laid out.
+ sql """ set inverted_index_skip_threshold = 0 """
- // enable_match_without_inverted_index only gates MATCH_PRED's residual
row-level fallback
- // (see match.cpp / olap_scan_operator.cpp); it has no effect on a plain
`>` predicate, so a
- // correct qt_*_range result alone does not show the SNII native BKD
reader served the query
- // -- it could equally be a full scan reaching the same rows.
- //
- // segment_iterator.apply_inverted_index (demands zero residual predicates
after index
- // application) is NOT the right instrument here: a cast()-wrapped
comparison always leaves
- // the cast expression as a residual, on every storage format, so that
debug point can never
- // pass for these queries regardless of whether the index served them. Use
- // segment_iterator.inverted_index.filtered_rows instead: it fails the
query unless the
- // inverted index actually filtered out exactly the expected number of
rows, which is a direct
- // measurement of index participation rather than a residual-predicate
check.
- def assertRangeFilteredRowCount = { String sqlQuery, int
expectedFilteredRows ->
- def checkpoint = "segment_iterator.inverted_index.filtered_rows"
- try {
- GetDebugPoint().enableDebugPointForAllBEs(checkpoint,
[filtered_rows: "${expectedFilteredRows}"])
- sql "set experimental_enable_parallel_scan = false"
- sql "sync"
- sql "${sqlQuery}"
- } finally {
- GetDebugPoint().disableDebugPointForAllBEs(checkpoint)
- }
- }
+ sql "set enable_profile = true"
+ sql "set profile_level = 2"
+ sql "set enable_condition_cache = false"
+ sql "set enable_sql_cache = false"
// Declared sub-column types: FE validates each path type through
// CreateTableInfo, and the BE gets subcolumn_indexes already initialized.
@@ -63,17 +50,29 @@ suite("regression_test_variant_var_index_snii", "p0,
nonConcurrent"){
properties("replication_num" = "1", "disable_auto_compaction" = "true",
"inverted_index_storage_format" = "SNII");
"""
- sql """insert into ${typed_table} values(1, 'alpha plain',
${variantV2Function}('{"a" : 123, "b" : "xxxyyy", "c" : 111999111}'))"""
- sql """insert into ${typed_table} values(2, 'beta plain',
${variantV2Function}('{"a" : 18811, "b" : "hello world", "c" : 1181111}'))"""
- sql """insert into ${typed_table} values(3, 'alpha other',
${variantV2Function}('{"a" : 18811, "b" : "hello wworld", "c" : 11111}'))"""
- sql """insert into ${typed_table} values(4, 'gamma plain',
${variantV2Function}('{"a" : 1234, "b" : "hello xxx world", "c" : 8181111}'))"""
+ // Separate writes exercise the index check across multiple rowsets.
+ sql """insert into ${typed_table} values
+ (1, 'alpha plain', ${variantV2Function}('{"a" : 123, "b" :
"xxxyyy", "c" : 111999111}')),
+ (2, 'beta plain', ${variantV2Function}('{"a" : 18811, "b" :
"hello world", "c" : 1181111}'))"""
+ sql """insert into ${typed_table} values
+ (3, 'alpha other', ${variantV2Function}('{"a" : 18811, "b" :
"hello wworld", "c" : 11111}')),
+ (4, 'gamma plain', ${variantV2Function}('{"a" : 1234, "b" :
"hello xxx world", "c" : 8181111}'))"""
sql """set enable_match_without_inverted_index = false"""
qt_typed_match """select k from ${typed_table} where cast(v["b"] as
string) match 'hello' order by k"""
qt_typed_range """select k from ${typed_table} where cast(v["a"] as int) >
1000 order by k"""
- // typed_table has 4 rows with a = 123, 18811, 18811, 1234; `> 1000`
filters out exactly the
- // a=123 row (k=1), so the index must report filtered_rows: 1.
- assertRangeFilteredRowCount("select k from ${typed_table} where
cast(v[\"a\"] as int) > 1000 order by k", 1)
+ // Check the completed query profile, since the debug point runs once per
segment
+ // and its cumulative counter may not yet include all rowsets.
+ def profileToken = "snii_typed_range_" + UUID.randomUUID().toString()
+ sql """select /* ${profileToken} */ k from ${typed_table}
+ where cast(v["a"] as int) > 1000 order by k"""
+ def profile = new ProfileAction(context).getProfileBySql(profileToken,
["RowsInvertedIndexFiltered"])
+ def matches = (profile =~ /RowsInvertedIndexFiltered:\s*([0-9,]+)/)
+ long filteredRows = 0
+ while (matches.find()) {
+ filteredRows += Long.parseLong(matches.group(1).replace(",", ""))
+ }
+ assertTrue(filteredRows > 0, "Expected inverted index to filter rows,
profile: ${profile}")
qt_typed_both """select k from ${typed_table} where cast(v["a"] as int) >
123 and cast(v["b"] as string) match 'hello' and cast(v["c"] as int) > 1024
order by k"""
// A plain column and a variant column carry SNII indexes in one table:
the plain one is
// keyed by its own index id, the variant sub-columns by suffix path under
theirs.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]