Skip to content

Commit

Permalink
fix sparse
Browse files Browse the repository at this point in the history
  • Loading branch information
eldenmoon committed Aug 15, 2024
1 parent 6441057 commit ded4cb2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
5 changes: 3 additions & 2 deletions be/src/vec/columns/column_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1648,8 +1648,9 @@ void ColumnObject::finalize(FinalizeMode mode) {
continue;
}

// Check and spilit sparse subcolumns
if (mode == FinalizeMode::WRITE_MODE && (entry->data.check_if_sparse_column(num_rows))) {
// Check and spilit sparse subcolumns, not support nested array at present
if (mode == FinalizeMode::WRITE_MODE && (entry->data.check_if_sparse_column(num_rows)) &&
!entry->path.has_nested_part()) {
// TODO seperate ambiguous path
sparse_columns.add(entry->path, entry->data);
continue;
Expand Down
6 changes: 3 additions & 3 deletions regression-test/data/variant_p0/variant_hirachinal.out
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
1.5
[123,{"xx":1}]

-- !sql --
[1,2,3]
-- !sql1 --
12345
[1,2,3]
{"c":456,"d":"null","e":7.111}

-- !sql --
-- !sql2 --
12345
[1,2,3]
{"c":456,"d":"null","e":7.111}
Expand Down
4 changes: 3 additions & 1 deletion regression-test/suites/variant_p0/nested.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ suite("regression_test_variant_nested", "p0,nonConcurrent"){
sql """INSERT INTO var_nested SELECT *, '{"k2":1, "k3": "nice", "k4" : [1234], "k5" : 1.10000, "k6" : [[123]], "nested2" : {"nested1" : [{"a" : 10, "b" : 1.1, "c" : "1111"}]}}' FROM numbers("number" = "5013") where number >= 400;"""
triger_compaction.call()

qt_sql """select * from var_nested where v['k2'] = 'some' order by k limit 10"""
qt_sql """select /*+SET_VAR(batch_size=1024,broker_load_batch_size=16352,disable_streaming_preaggregations=true,enable_distinct_streaming_aggregation=true,parallel_fragment_exec_
parallel_pipeline_task_num=7,parallel_fragment_exec_instance_num=4,profile_level=1,enable_pipeline_engine=true,enable_parallel_scan=false,parallel_scan_max_scanners_count=16
,parallel_scan_min_rows_per_scanner=128,enable_fold_constant_by_be=false,enable_rewrite_element_at_to_slot=true,runtime_filter_type=2,enable_parallel_result_sink=true,sort_phase_num=0,enable_nereids_planner=true,rewrite_or_to_in_predicate_threshold=2,enable_function_pushdown=true,enable_common_expr_pushdown=false,enable_local_exchange=true,partitioned_hash_join_rows_threshold=8,partitioned_hash_agg_rows_threshold=8,partition_pruning_expand_threshold=10,enable_share_hash_table_for_broadcast_join=false,enable_two_phase_read_opt=true,enable_common_expr_pushdown_for_inverted_index=true,enable_delete_sub_predicate_v2=true,min_revocable_mem=1,fetch_remote_schema_timeout_seconds=120,max_fetch_remote_schema_tablet_count=512,enable_join_spill=true,enable_sort_spill=true,enable_agg_spill=true,enable_force_spill=false,data_queue_max_blocks=1,spill_streaming_agg_mem_limit=268435456,external_agg_partition_bits=5) */ * from var_nested where v['k2'] = 'some' order by k limit 10"""
qt_sql """select * from var_nested where v['k2'] = 'some' and array_contains(cast(v['nested1']['nested2']['a'] as array<tinyint>), 10) order by k limit 1;"""

sql """INSERT INTO var_nested SELECT *, '{"k1":1, "k2": "some", "k3" : [1234], "k4" : 1.10000, "k5" : [[123]], "nested1" : {"nested2" : [{"a" : 10, "b" : 1.1, "c" : "1111"}]}}' FROM numbers("number" = "4096") where number > 1024 limit 1024;"""
Expand Down
4 changes: 2 additions & 2 deletions regression-test/suites/variant_p0/variant_hirachinal.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ suite("regression_test_variant_hirachinal", "variant_type"){
qt_sql "select v['c'] from ${table_name} where k = -3 or k = -2 order by k"
qt_sql "select v['b'] from ${table_name} where k = -3 or k = -2"
sql """insert into ${table_name} values (-3, '{"c" : 12345}')"""
qt_sql "select v['c'] from var_rs where k = -3 or k = -2 or (k = 1 and v['c'] = 1024) order by k"
qt_sql "select v['c'] from var_rs where k = -3 or k = -2 or k = 1 order by k, cast(v['c'] as text) limit 3"
order_qt_sql1 "select v['c'] from var_rs where k = -3 or k = -2 or k = -4 or (k = 1 and v['c'] = 1024) order by k"
order_qt_sql2 "select v['c'] from var_rs where k = -3 or k = -2 or k = 1 order by k, cast(v['c'] as text) limit 3"
}

0 comments on commit ded4cb2

Please sign in to comment.