forked from StarRocks/starrocks
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BugFix] Use repeated_ancestor_def_level in parquet writer (StarRocks…
…#28884) This PR introduces `repeated_ancestor_def_level` to determine whether an undefined value has a slot in the leaf column. More specifically, - `def_level < repeated_ancestor_def_level` means undefined and not having a slot - `repeated_ancestor_def_level <= def_level < max_def_level` means undefined and having a slot - `def_level = max_def_level` means defined and (surely) having a slot Previously, we rely on `def_level = max_def_level` to determine both, but unfortunately, this is wrong. A simple case would be a null struct, whose def_level is zero but also have slots in child columns. Example: ``` mysql> create table ice_struct1(a int,b struct<col_int int, col_string string, col_date date>); Query OK, 0 rows affected (0.43 sec) mysql> insert into ice_struct1 values(1,row(0,'ABC',null)),(2,null),(3,row(null,null,'2003-09-13')); Query OK, 3 rows affected (0.33 sec) {'label':'FAKE_ICEBERG_SINK_LABEL', 'status':'VISIBLE', 'txnId':'-1'} mysql> select * from ice_struct1 order by 1; +------+----------------------------------------------------+ | a | b | +------+----------------------------------------------------+ | 1 | {"col_int":0,"col_string":"ABC","col_date":null} | | 2 | NULL | | 3 | {"col_int":null,"col_string":null,"col_date":null} | +------+----------------------------------------------------+ 3 rows in set (0.04 sec) ``` Fixed with this PR: <img width="1421" alt="image" src="https://github.com/StarRocks/starrocks/assets/16740944/df4e9356-2e0e-4336-8f86-ca331323a784"> More complex test cases are tested as well.
- Loading branch information
1 parent
4a4fe7a
commit 2a15678
Showing
2 changed files
with
75 additions
and
87 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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