Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions regression-test/data/variant_p0/sparse_promotion_compaction.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !before_compaction --
1 id open {"text_info":{"open":{"tag_id":"id","tag_name":"open"}}}
2 \N \N \N

-- !after_compaction --
1 id open {"text_info":{"open":{"tag_id":"id","tag_name":"open"}}}
2 \N \N \N
3 id3 open3 {"text_info":{"open":{"tag_id":"id3","tag_name":"open3"}}}
4 id4 open4 {"text_info":{"open":{"tag_id":"id4","tag_name":"open4"}}}
5 id5 open5 {"text_info":{"open":{"tag_id":"id5","tag_name":"open5"}}}
6 id6 open6 {"text_info":{"open":{"tag_id":"id6","tag_name":"open6"}}}

-- !newer_rows --
3 id3 open3
4 id4 open4

Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

suite("sparse_promotion_compaction", "p0") {
// CIR-22588: compaction promotes sparse paths to materialized subcolumns by a raw-byte
// lower_bound. Sparse keys written in component order are missed, filled with NULL, and
// then removed from sparse, so the values disappear from the output file. The writer must
// publish sparse keys in raw-byte order; after full compaction the promoted values must
// still be present.
setFeConfigTemporary([enable_variant_v2: true]) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P1] Remove the obsolete enable_variant_v2 configuration wrapper

At this head enable_variant_v2 is not a registered FE configuration. setFeConfigTemporary first calls getFeConfig, which reads [0].Value from SHOW FRONTEND CONFIG LIKE 'enable_variant_v2'; that result is empty, so every run throws before CREATE TABLE or any assertion executes. Remove the obsolete wrapper so the regression can actually run on this branch.

sql "SET default_variant_enable_doc_mode = false"
sql "SET enable_sql_cache = false"

def tableName = "sparse_promotion_compaction"
sql "DROP TABLE IF EXISTS ${tableName}"
sql """
CREATE TABLE ${tableName} (
id INT NOT NULL,
v VARIANT<PROPERTIES("variant_max_subcolumns_count"="2")>
) ENGINE = OLAP
UNIQUE KEY(id)
DISTRIBUTED BY HASH(id) BUCKETS 1
PROPERTIES (
"replication_num" = "1",
"enable_unique_key_merge_on_write" = "true",
"disable_auto_compaction" = "true"
)
"""

sql """INSERT INTO ${tableName} VALUES
(1, parse_to_variant('{"hot_a":1,"hot_b":1,"tag-labeling":{"text_info":{"open":{"tag_id":"id","tag_name":"open"}}},"tag-labeling-0-1-2":{"x":1,"y":2,"z":3}}')),
(2, parse_to_variant('{"hot_a":2,"hot_b":2}'))
"""

def projection = """SELECT id,
CAST(v['tag-labeling']['text_info']['open']['tag_id'] AS STRING) AS tag_id,
CAST(v['tag-labeling']['text_info']['open']['tag_name'] AS STRING) AS tag_name,
CAST(v['tag-labeling'] AS STRING) AS parent
FROM ${tableName} ORDER BY id"""
qt_before_compaction projection

// More rows make the promoted paths frequent enough for full compaction to rewrite
// them; row 1 is not updated or overwritten.
sql """INSERT INTO ${tableName} VALUES
(3, parse_to_variant('{"tag-labeling":{"text_info":{"open":{"tag_id":"id3","tag_name":"open3"}}}}')),
(4, parse_to_variant('{"tag-labeling":{"text_info":{"open":{"tag_id":"id4","tag_name":"open4"}}}}')),
(5, parse_to_variant('{"tag-labeling":{"text_info":{"open":{"tag_id":"id5","tag_name":"open5"}}}}')),
(6, parse_to_variant('{"tag-labeling":{"text_info":{"open":{"tag_id":"id6","tag_name":"open6"}}}}'))
"""
trigger_and_wait_compaction(tableName, "full", 1800)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] Verify that the full compaction succeeded

Once the obsolete config wrapper is removed, an asynchronous compaction that fails in merge_input_rowsets() before modify_rowsets() leaves the original rowsets readable. trigger_and_wait_compaction returns when either the full-success or full-failure timestamp changes, so all subsequent expected rows still match in that case and the suite passes without checking any promoted output. Check each tablet's last full status (and preferably rowset replacement), as the neighboring sparse_ancestor_promotion suites do, before the after-compaction queries.


qt_after_compaction projection

def newerRows = """SELECT id,
CAST(v['tag-labeling']['text_info']['open']['tag_id'] AS STRING) AS tag_id,
CAST(v['tag-labeling']['text_info']['open']['tag_name'] AS STRING) AS tag_name
FROM ${tableName} WHERE id IN (3, 4) ORDER BY id"""
qt_newer_rows newerRows
}
}
Loading