Commit Graph

2550 Commits

Author SHA1 Message Date
f3f1bbc48c [fix](agg)disallow group by bitmap or hll data type (#11782)
* [fix](agg)disallow group by bitmap or hll data type
2022-08-16 09:25:02 +08:00
d2d4423c88 [feature](schema change) Light schema change support rollup (#11494)
1. Move max colUniqueId from OlapTable to IndexMeta.
2. Add updateSlotUniqueId.
2022-08-15 21:39:27 +08:00
5104982614 [enhancement](tracing) append the profile counter to trace. (#11458)
1. append the profile counter and infos to span attributes.
2. output traceid to audit log.
2022-08-15 21:36:38 +08:00
8f98357c0b [fix](array-type) disable cast function to array type on origin exec engine. (#11602)
This commit disable cast to array type on origin exec engine, except cast varchar to array type.
2022-08-15 21:30:56 +08:00
fef37990a3 [fix](array-type) Fix incorrect in function-set for array type (#11585)
There is some wrong logic in FunctionSet.java and it may causes potential risks for array functions invoke.
2022-08-15 21:29:57 +08:00
910d51c76f [fix](update) Fix where clause is not reanalyzed after rewrite (#11723) 2022-08-15 13:24:57 +08:00
1e6b8cd1a9 [feature](nereids): SimplifyCastRule (#11630)
Remove redundant cast like
```
cast(1 as int) -> 1
```
2022-08-15 12:41:36 +08:00
66116b78d1 fix multJoin bug (#11772)
In MultiJoin transform, if there is no condition, we should generate cross join instead of inner join
2022-08-15 11:59:09 +08:00
854b4b1b47 [fix](storage-policy) fix bug that missing field when refreshing storage policy (#11580)
1. Change all required fields to optional
    Although they all "required", but it not recommended to use `required`, because it is hard to modify in future.
2. Fix a missing field bug
2022-08-12 20:11:54 +08:00
ed47a3bb6d [enhancement](Nereids)refactor sort plan in nereids (#11673)
1. rename PhysicalHeapSort to PhysicalQuickSort
2. add LogicalTopN and PhysicalTopN
3. add implementation rule for LogicalTopN
4. add a interface Sort for both logical and physical sort
5. add a interface TopN for both logical and physical top-n
6. add a AbstractPhysicalSort as super class of PhysicalQuickSort and PhysicalTopN
2022-08-12 17:08:23 +08:00
887de4b465 [fix](Nereids)memo copy in cannot rewrite current plan with its child (#11717)
When we do write current plan with its child. Currently, nereids memo do nothing indeed.
This PR fix this situation by add a predicate in rewrite that only replaced target group and set newGroupExpressionGenerated to false when target is null or target is same with existed group expression's group.

here we need to handle one situation that original target is not the same with
existedGroupExpression.getOwnerGroup(). In this case, if we change target to
existedGroupExpression.getOwnerGroup(), we could not rewrite plan as we expected and the plan
will not be changed anymore.
Think below example:
We have a plan like this:
```
Original (Group 2 is root):
Group2: Project(outside)
Group1: |---Project(inside)
Group0:     |---UnboundRelation

and we want to rewrite group 2 by Project(inside, GroupPlan(group 0))

After rewriting we should get (Group 2 is root):
Group2: Project(inside)
Group0: |---UnboundRelation
Group1: Project(inside)
```

After rewriting, Group 1's GroupExpression is not in GroupExpressionsMap anymore and Group 1 is unreachable.
Merge Group 1 into Group 2 is better, but in consideration of there is others way to let a Group take into
unreachable. There's no need to complicate to add a merge step. Instead, we need to have a clear step to
remove unreachable groups and GroupExpressions after rewrite.
2022-08-12 16:20:46 +08:00
ec4347ad39 [enhancement](Nereids) support StatementContext, SET_VAR, and Plan pre/post processor (#11654)
1. add StatementContext, and PlannerContext is renamed to CascadsContext. CascadsContext belong to a StatementContext, and StatementContext belong to a ConnectionContext, and the lifecycle increases in turn. StatementContext can wrap some statement's lifecycle-related state, such as ExpressionId, TableLock. MemoTestUtil can simplify create a CascadesContext and Memo for test.
2. add PlanPreprocessor to process parsed logical plan before copy into memo. and add a PlanPostprocessor to process physical plan after copy out from memo.
3. utilize PlanPreprocessor to process SET_VAR hint, the class is EliminateLogicalSelectHint
4. pass the limit clause in regression test case, in set_var.groovy
2022-08-12 14:49:11 +08:00
a3ae1494ef [Enhancement](admin show replica distribution) size percent should be 0.00% when size is zero #11711
Co-authored-by: wuhangze <wuhangze@jd.com>
2022-08-12 13:58:56 +08:00
800bc100af [feature-wip](unique-key-merge-on-write) show enable_unique_key_merge_on_write property when get ddl (#11664)
* [feature-wip](unique-key-merge-on-write) show enable_unique_key_merge_on_write property when get ddl

* update
2022-08-12 12:14:04 +08:00
7d97aa194b [feature-wip](datev2) Support to use datev2 as partition column (#11618) 2022-08-12 11:54:01 +08:00
6c6328fc6d [fix](join)fix outer join bug when a subquery as nullable side #11700 2022-08-12 11:50:15 +08:00
32e451e6ad [minor](recycle) add log to observe bug (#11687) 2022-08-12 11:40:20 +08:00
Pxl
f5fe622a1b [Bug](materialized view) fix create materialized view fail
1. remove referenced_column(seems unused now).
2. fix mv slot ref id wrong.
3. add type check for hll_hash.
4. enable non-nullable column change to nullable column.
2022-08-12 09:49:16 +08:00
5d66839035 [feature-wip](unique-key-merge-on-write) push down runtime filter on unique key with merge on write table (#11695) 2022-08-11 22:50:13 +08:00
2d5ffac590 [fix](optimization) InferFiltersRule bug: a self inner join on a view, which contains where clause, will cause mis-inference. (#11566) 2022-08-11 17:13:26 +08:00
9214346603 [Bug] fix cancel fragment bug (#11683)
Co-authored-by: chenjie <chenjie@cecdat.com>
2022-08-11 16:48:18 +08:00
aa24c8f973 [Feature](multi-catalog) Support refresh catalog metadata (#11656) 2022-08-11 15:14:05 +08:00
7e828ad85b [Enhancement](profile format) Print fragment and instance in a better format (#11671) 2022-08-11 14:05:41 +08:00
180cc35815 [Feature](nereids) support sub-query and alias in FromClause (#11035)
Support sub-query and alias for TPC-H,for example:
select * from (select * from (T1) A join T2 as B on T1.id = T2.id) T;
2022-08-11 12:42:19 +08:00
d831322806 [refactor](planner): make Table abstract. (#11642) 2022-08-11 12:07:25 +08:00
56ce8c0c5c [feature](http) add api for showing current queries and kill query (#11657) 2022-08-11 10:32:46 +08:00
04d26ddf22 [feature-wip](multi-catalog)Support use catalog.db and show databases from catalog stmt (#11338)
Support use catalog.db and show databases from catalog stmt.
2022-08-11 09:50:32 +08:00
02a3f21b65 [fix](analyzer) InferFilterRule bug: equations in on clause of outer/anti join are not inferable. (#11515) 2022-08-11 09:36:43 +08:00
d8427037be [Bug](doe) Fix some bug (#11594) 2022-08-10 21:00:05 +08:00
976e7685db [minor](*): remove redundant log and unused code. (#11620) 2022-08-10 19:28:04 +08:00
8c344d33e6 [Enhancement](meta) sort result by tablename when show tables like show data (#11638)
* [improvement] sort result by tablename when show tables like 'show data'
2022-08-10 19:26:30 +08:00
c8418d13b5 [improvement](config)Use session variable to replace configuration for 'enable_function_pushdown' (#11641) 2022-08-10 19:25:02 +08:00
89d3809a0e [feature](Nereids): Enable the costAndEnforcerJob (#11604)
1. Enable the costAndEnforcerJob
2. Fix some bug of enforcer.
3. polish property name and method
2022-08-10 15:17:15 +08:00
ae90d45594 [Bug](show data skew)fix show data skew logic (#11616)
Co-authored-by: wuhangze <wuhangze@jd.com>
2022-08-10 08:18:39 +08:00
169996d8e4 [feature](information_schema) add rowsets table into information_s… (#11266)
* [feature](information_schema) add 'segments' table into information_schema
2022-08-09 18:15:54 +08:00
7b67661262 add plan checker (#11619)
This PR proposes to add a plan checker to facilitate plan checking in unit tests.

Usage of plan checker is like below:
```java
new PlanChecker()
  .plan(myPlan)
  .applyBottomUp(myRule)
  .matches(expectedPattern);
```
2022-08-09 17:19:30 +08:00
cc6c92935a [minor](log) add a warn log to observer invalid query profile (#11588)
I try to fix the bug in #10095. the error occurred when I first create a empty table and query it.
But I can't reproduced it again.
So I add a warn log here to observer
2022-08-09 14:10:03 +08:00
2cadf85988 [improvement](alter) modify table's default replica if table is unpartitioned (#11550)
Before, if a table is unpartitioned, when executing following alter stmt:
```
alter table tbl1 set ("replication_num" = "1");
```
Only the tbl1 partition's replication_num is changed
(for unpartitioned table, it also has a single partition with same name as table's)
But the table's default replication_num is unchanged.
So when executing `show create table tbl1`, you will find that the replication_num is still the origin value.

This CL mainly changes:
1. For unpartitioned table, if user change it's replication num, both table's and partition's replication_num will be changed.
2022-08-09 14:09:38 +08:00
436ee0dd1d [feature-wip](statistics) step4.1: manually inject statistics for a table or column (#11030)
This pr mainly to supplement the syntax of the previous pr(#8861),
it supports users to manually inject statistics, including table, partition, and column statistics. 

table/partition stats type:
- row_count
- data_size

column stats type:
- ndv
- avg_size
- max_size
- num_nulls
- min_value
- max_value

Modify table or partition statistics:
```
ALTER TABLE table_name 
SET STATS ('k1' = 'v1', ...) [PARTITIONS(p_name1, p_name2...)]
```

Modify column statistics:
```
ALTER TABLE table_name MODIFY COLUMN columnName 
SET STATS ('k1' = 'v1', ...) [PARTITIONS(p_name1, p_name2...)]
```

Some notes:
- Only support statistics injected into olap type tables.
- Statistics injected into temporary partitions are not supported.
- When injecting statistics, if it is a partitioned table, users need to specify a partition name.
- If multiple partitions are specified, the same stats will be injected on multiple partitions.
- The current code also has mock statistics @zhengshij
2022-08-09 11:24:23 +08:00
2b918eaccd [fix](Doris On ES) Fix es not support aliases error (#11547)
1. Fix es not support aliases error
2. Fix multicatalog query es error
3. add ut
2022-08-09 09:36:05 +08:00
f9b151744d optimize topn query if order by columns is prefix of sort keys of table (#10694)
* [feature](planner): push limit to olapscan when meet sort.

* if olap_scan_node's sort_info is set, push sort_limit, read_orderby_key
and read_orderby_key_reverse for olap scanner

* There is a common query pattern to find latest time serials data.
 eg. SELECT * from t_log WHERE t>t1 AND t<t2 ORDER BY t DESC LIMIT 100

If the ORDER BY columns is the prefix of the sort key of table, it can
be greatly optimized to read much fewer data instead of read all data
between t1 and t2.

By leveraging the same order of ORDER BY columns and sort key of table,
just read the LIMIT N rows for each related segment and merge N rows.

1. set read_orderby_key to true for read_params and _reader_context
   if olap_scan_node's sort info is set.
2. set read_orderby_key_reverse to true for read_params and _reader_context
   if is_asc_order is false.
3. rowset reader force merge read segments if read_orderby_key is true.
4. block reader and tablet reader force merge read rowsets if read_orderby_key is true.

5. for ORDER BY DESC, read and compare in reverse order
5.1 segment iterator read backward using a new BackwardBitmapRangeIterator and
    reverse the result block before return to caller.
5.2 VCollectIterator::LevelIteratorComparator, VMergeIteratorContext return
    opposite result for _is_reverse order in its compare function.

Co-authored-by: jackwener <jakevingoo@gmail.com>
2022-08-09 09:08:44 +08:00
b9f7f63c81 [Fix](planner) Fix wrong planner with count(*) optmizer for cross join optimization (#11569) 2022-08-09 09:01:25 +08:00
7c950c7cd5 [feature](Nereids) support cross join in Nereids (#11502)
support cross join in Nereids

1. add PhysicalNestedLoopJoin
2. Translate PhysicalNestedLoopJoin to CrossJoinNode in PhysicalPlanTranslator
2022-08-08 22:14:27 +08:00
1701ffa7c0 [fix](planner)push constant expr in predicate to outer join's other conjuncts by mistake (#11527)
constant expr in predicate should not be pushed to outer join's other conjuncts
2022-08-08 20:56:08 +08:00
4f60b37402 [feature](Nereids):refactor and add outer join LAsscom. (#11531)
refactor and add outer join LAsscom.
Extract the common function to LAsscomHelper.
2022-08-08 20:08:12 +08:00
Fy
647b6e843a [feature](nereids)add InPredicate in expressions (#11264)
1. Add InPredicate expression parser and translator
2. Add regression-test for In predicate (in nereids_syntax)
3. Support NOT EqualTo and NOT InPredicate in ExpressionTranslator#visitNot()
2022-08-08 19:59:54 +08:00
c1c635e944 [Refactor](Nereids) Fix expression constant and improve SlotExtractor (#11513)
1. Fix expression constant and add unit test.
2. Improve logic in SlotExtractor and remove useless class IterationVisitor.
2022-08-08 17:36:21 +08:00
411254c128 [Enhancement](hdfs) Support loading hdfs config from hdfs-site.xml (#11571) 2022-08-08 14:18:28 +08:00
4f5db35990 [fix](date) fix the value may be changed during the parsing of date and datetime types (#11573)
* [fix](date) fix the value may be changed during the parsing of date and datetime types
2022-08-08 08:58:30 +08:00
8802a41918 fix profile may cause query slow (#11386)
Co-authored-by: Wang Bo <wangbo36@meituan.com>
2022-08-07 20:52:52 +08:00