Commit Graph

17990 Commits

Author SHA1 Message Date
5ecce2fff2 [fix](plsql) Fix regression test execute the same name procedure in parallel #33234 2024-04-10 15:53:17 +08:00
16f8afc408 [refactor](coordinator) split profile logic and instance report logic (#32010)
Co-authored-by: yiguolei <yiguolei@gmail.com>
2024-04-10 15:51:32 +08:00
b85bf3b6b0 [test](cast) add test for stream load cast (#33189) 2024-04-10 15:26:09 +08:00
7fae123b01 [FIX](inverted_index) fix inverted index write array with _doc is empty (#33170) 2024-04-10 15:26:09 +08:00
96867ff3fd [fix](Nereids) support update without filter (#33214) 2024-04-10 15:26:09 +08:00
2b1ab89b5b [fix](memory) Fix memory log compile by ASAN (#33162)
ASAN compiles BE, add markers in memory logs
2024-04-10 15:26:09 +08:00
b696909775 [fix](plsql) Fix plsql variable initialization (#33186) 2024-04-10 15:26:09 +08:00
edd1701963 [fix](Nereids) convert agg state type failed in some cases (#33208) 2024-04-10 15:26:09 +08:00
9670422d61 [fix](inverted index) fix the incorrect result issue of COUNT_ON_INDEX for key columns (#33164) 2024-04-10 15:26:09 +08:00
5e59c09a60 [Fix](nereids) modify the binding aggregate function in order by (#32758)
modify the bind logical to make the order by has same behavior with mysql when sort child is aggregate.
when an order by Expr has aggregate function, all slots in this order by Expr should bind the LogicalAggregate non-AggFunction outputs first, then bind the LogicalAggregate Child
e.g.
select 2*abs(sum(c1)) as c1, c1,sum(c1)+c1 from t_order_by_bind_priority group by c1 order by sum(c1)+c1 asc;
in this sql, the two c1 in order by all bind to the c1 in t_order_by_bind_priority
2024-04-10 15:26:09 +08:00
67bb519613 [Fix](nereids) forward the user define variables to master (#33013) 2024-04-10 15:26:08 +08:00
2e40e39584 [chore](spill) add timers for performance tuning (#33185) 2024-04-10 15:26:08 +08:00
Pxl
8fd6d4c41b [Chore](build) add -Wconversion and remove some unused code (#33127)
add -Wconversion and remove some unused code
2024-04-10 15:26:08 +08:00
6798a24a27 [Enhencement](Nereids) reduce child output rows if agg child is literal (#32188)
with group by:
select max(1) from t1 group by c1; -> select 1 from (select c1 from t1 group by c1);
without group by:
select max(1) from t1; -> select max(1) from (select 1 from t1 limit 1) tmp;
2024-04-10 15:26:08 +08:00
0ab8b57db7 [enhance](mtmv)support create mtmv with other mtmv (#32984) 2024-04-10 15:26:08 +08:00
77ad3f6a19 [feature](hive)Get updated information from coordinate and commit (#32441) (#33466)
issue: #31442
1. Get updated information from coordinate and commit
2. refresh table after commit

Co-authored-by: wuwenchi <wuwenchihdu@hotmail.com>
2024-04-10 15:07:18 +08:00
9bc7902e5a [fix](Nereids) fix bind group by int literal (#33117)
This sql will failed because

    2 in the group by will bind to 1 as col2 in BindExpression
    ResolveOrdinalInOrderByAndGroupBy will replace 1 to MIN (LENGTH (cast(age as varchar)))
    CheckAnalysis will throw an exception because group by can not contains aggregate function

select MIN (LENGTH (cast(age as varchar))), 1 AS col2
from test_bind_groupby_slots
group by 2

we should move ResolveOrdinalInOrderByAndGroupBy into BindExpression

(cherry picked from commit 3fab4496c3fefe95b4db01f300bf747080bfc3d8)
2024-04-10 14:59:46 +08:00
cc363f26c2 [fix](Nereids) fix group concat (#33091)
Fix failed in regression_test/suites/query_p0/group_concat/test_group_concat.groovy

select
group_concat( distinct b1, '?'), group_concat( distinct b3, '?')
from
table_group_concat
group by
b2

exception:

lowestCostPlans with physicalProperties(GATHER) doesn't exist in root group

The root cause is '?' is push down to slot by NormalizeAggregate, AggregateStrategies treat the slot as a distinct parameter and generate a invalid PhysicalHashAggregate, and then reject by ChildOutputPropertyDeriver.

I fix this bug by avoid push down literal to slot in NormalizeAggregate, and forbidden generate stream aggregate node when group by slots is empty
2024-04-10 14:59:46 +08:00
38d580dfb7 [fix](Nereids) fix link children failed (#33134)
#32617 introduce a bug: rewrite may not working when plan's arity >= 3.
this pr fix it

(cherry picked from commit 8b070d1a9d43aa7d25225a79da81573c384ee825)
2024-04-10 14:59:45 +08:00
ff990eb869 [enhancement](Nereids) refactor expression rewriter to pattern match (#32617)
this pr can improve the performance of the nereids planner, in plan stage.

1. refactor expression rewriter to pattern match, so the lots of expression rewrite rules can criss-crossed apply in a big bottom-up iteration, and rewrite until the expression became stable. now we can process more cases because original there has no loop, and sometimes only process the top expression, like `SimplifyArithmeticRule`.
2. replace `Collection.stream()` to `ImmutableXxx.Builder` to avoid useless method call
3. loop unrolling some codes, like `Expression.<init>`, `PlanTreeRewriteBottomUpJob.pushChildrenJobs`
4. use type/arity specified-code, like `OneRangePartitionEvaluator.toNereidsLiterals()`, `PartitionRangeExpander.tryExpandRange()`, `PartitionRangeExpander.enumerableCount()`
5. refactor `ExtractCommonFactorRule`, now we can extract more cases, and I fix the deed loop when use `ExtractCommonFactorRule` and `SimplifyRange` in one iterative, because `SimplifyRange` generate right deep tree, but `ExtractCommonFactorRule` generate left deep tree
6. refactor `FoldConstantRuleOnFE`, support visitor/pattern match mode, in ExpressionNormalization, pattern match can criss-crossed apply with other rules; in PartitionPruner, visitor can evaluate expression faster
7. lazy compute and cache some operation
8. use int field to compare date
9. use BitSet to find disableNereidsRules
10. two level loop usually faster then build Multimap when bind slot in Scope, so I revert the code
11. `PlanTreeRewriteBottomUpJob` don't need to clearStatePhase any more

### test case
100 threads parallel continuous send this sql which query an empty table, test in my mac machine(m2 chip, 8 core), enable sql cache
```sql
select  count(1),date_format(time_col,'%Y%m%d'),varchar_col1
from tbl
where  partition_date>'2024-02-15'  and (varchar_col2 ='73130' or varchar_col3='73130') and time_col>'2024-03-04'
  and  time_col<'2024-03-05'
group by date_format(time_col,'%Y%m%d'),varchar_col1
order by date_format(time_col,'%Y%m%d') desc, varchar_col1 desc,count(1) asc
limit 1000
```

before this pr: 3100 peak QPS, about 2700 avg QPS
after this pr: 4800 peak QPS, about 4400 avg QPS

(cherry picked from commit 7338683fdbdf77711f2ce61e580c19f4ea100723)
2024-04-10 14:59:45 +08:00
6c5dd820c0 [improvement](spill) improve spill timers (#33156) 2024-04-10 14:55:11 +08:00
7f2fdf78ac [Enhancement](inverted index) set need to read data only when delete predicate contains the column (#33172) 2024-04-10 14:53:56 +08:00
c61d6ad1e2 [Feature] support function uuid_to_int and int_to_uuid #33005 2024-04-10 14:53:56 +08:00
bf022f9d8d [enhancement](function truncate) truncate can use column as scale argument (#32746)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-04-10 14:53:56 +08:00
a69f3eb870 [fix](fe) partitionInfo is null, fe can not start (#33108) 2024-04-10 14:53:56 +08:00
8b1d174b13 [Optimize] Move strings_pool from individual tree nodes to the tree itself (#33089)
Previously, strings_pool was allocated within each tree node. However, due to the Arena's alignment of allocated chunks to at least 4K, this allocation size was excessively large for a single tree node. Consequently, when there are numerous nodes within the SubcolumnTree, a significant portion of memory was wasted. Moving strings_pool to the tree itself optimizes memory usage and reduces wastage, improving overall efficiency.
2024-04-10 14:53:56 +08:00
02b24abed2 [Fix](Nereids) ntile function should check argument (#32994)
Problem:
when ntile using 0 as parameter, be would core because no checking of parameter
Solved:
check parameter in fe analyze
2024-04-10 14:53:56 +08:00
a7c8abe58c [feature](nereids) support common sub expression by multi-layer projections (fe part) (#33087)
* cse fe part
2024-04-10 14:53:56 +08:00
1b3a11a02b [Enhancement](merge-on-write) Support dynamic delete bitmap cache (#32991)
* The default delete bitmap cache is set to 100MB, which can be insufficient and cause performance issues when the amount of user data is large. To mitigate the problem of an inadequate cache, we will take the larger of 5% of the total memory and 100MB as the delete bitmap cache size.
2024-04-10 14:53:56 +08:00
3b42dc73af [improvement](spill) avoid spill if memory is enough (#33075) 2024-04-10 14:53:27 +08:00
517c12478f [improvement](spill) spill trigger improvement (#32641) 2024-04-10 14:52:46 +08:00
b0b5f84e40 [feature](load) support compressed JSON format data for broker load (#30809) 2024-04-10 14:20:53 +08:00
1a2177adb9 [Fix](test) add sync to ensure data synchronization in test_set_operater (#32993) 2024-04-10 12:01:02 +08:00
Pxl
09db427eed [Feature](materialized-view) support ignore not slot is null when count(slot) not has key in mv (#32912)
support ignore not slot is null when count(slot) not has key in mv
2024-04-10 11:59:36 +08:00
1d0908e80d [feature](profile) make WaitForLocalExchangeBuffer timer merge (#32946)
make WaitForLocalExchangeBuffer timer merge
2024-04-10 11:57:57 +08:00
Pxl
e4993a19e5 [Chore](column) remove ColumnVectorHelper (#33036)
remove ColumnVectorHelper
2024-04-10 11:56:41 +08:00
8e19cdd745 [featrue](expr) support common subexpression elimination be part (#32673) 2024-04-10 11:56:21 +08:00
61e214c327 [Fix](Hive-Metastore) fix that if JDBC reads the NULL value, it will cause NPE (#32831) 2024-04-10 11:55:17 +08:00
5116724494 [Fix](hive-writer) Fix the issue of block was not copied to do filtering when hive partition writer write block to file. (#32775) (#33447)
backport #32775
2024-04-10 11:42:23 +08:00
4963d60a07 [Fix](multi-catalog)Fix the issue of not initializing the writer caused by refactoring and add hive writing regression test. (#32721) (#33446)
backport #32721.
2024-04-10 11:42:22 +08:00
caea45586f fix compile 2024-04-10 11:42:22 +08:00
cf7595d423 [opt](memory) Optimize mem tracker accuracy (#32039) (#33140) 2024-04-10 11:42:19 +08:00
39fba884fb [fix](typo) typo fix for 'delete bimap' changing to 'delete bitmap' (#32341) 2024-04-10 11:34:30 +08:00
3243053fcd [fix](memory) Fix MemTableWriter flush_async attach task in thread context (#33071) 2024-04-10 11:34:30 +08:00
285e2fcb5a [fix] (vectorization) regexp all_pass string (#32515) 2024-04-10 11:34:30 +08:00
fb910e5304 [fix](planner) retain groupingSlotIds as materialized for aggregate (#33060) 2024-04-10 11:34:30 +08:00
c5a3af5c27 [partitionsort](fix) Fix DCHECK failure (#33035) 2024-04-10 11:34:30 +08:00
c5ab7ca573 [fix](planner) remove and retain input slot for aggregate slot which is not materialized (#33033)
Signed-off-by: nextdreamblue <zxw520blue1@163.com>
2024-04-10 11:34:30 +08:00
Pxl
5b162a80f2 [Improvement](materialized-view) The materialized view can not involved auto increment column (#32885)
The materialized view can not involved auto increment column
2024-04-10 11:34:30 +08:00
35fa9f98e9 1 Add running query num/waiting query num (#33024)
1 Add running query num/waiting query num
2 Fix auth regression test
2024-04-10 11:34:30 +08:00