Commit Graph

5832 Commits

Author SHA1 Message Date
e09e030652 [fix](Nereids) mv in select materialized_view should disable show table (#24104)
mv in select materialized_view should disable show table,
because Nereids planner can output the string such as
slot#[0] in toSql() of SlotRef. Note this is only a
temporary solution, will use an expression translator later
2023-09-09 21:57:52 +08:00
21e30d4374 [fix](planner)ctas's query part is not analyzed correctly (#24111)
* [fix](planner)ctas's query part is not analyzed correctly
2023-09-09 20:55:09 +08:00
8c2a721873 [opt](nereids)push down filter through window #23935
select rank() over (partition by A, B) as r, sum(x) over(A, C) as s from T;
A is a common partition key for all windowExpressions, that is A is intersection of {A,B} and {A, C}
we could push filter A=1 through this window, since A is a common Partition key:
select * from (select a, row_number() over (partition by a) from win) T where a=1;
origin plan:

----filter((T.a = 1))
----------PhysicalWindow
------------PhysicalQuickSort
--------------PhysicalProject
------------------PhysicalOlapScan[win]
transformed to

----PhysicalWindow
------PhysicalQuickSort
--------PhysicalProject
----------filter((T.a = 1))
------------PhysicalOlapScan[win]
But C=1 can not be pushed through window.
2023-09-09 20:53:31 +08:00
7b62013d21 [refactor](nereids) print "ifnull" instead of "nvl" in explain #23979
'ifnull' is used more general.
2023-09-09 20:33:23 +08:00
6b9698a248 [bugfix](insert into) should not send profile during report process (#24127)
Co-authored-by: yiguolei <yiguolei@gmail.com>
2023-09-09 17:12:35 +08:00
153c7982f3 [Optimize](invert index) Optimize multiple terms conjunction query (#23871) 2023-09-09 01:52:58 +08:00
b5e1e36750 [fix](pipeline)add logs for unstable cases #24073
Issue Number: close #xxx

ShowTableStmtTest.testNoDb and DropDbStmtTest.testNoPriv are unstable cases,error msg is:

java.lang.Exception: Unexpected exception, expected<org.apache.doris.common.AnalysisException> but was<mockit.internal.expectations.invocation.MissingInvocation>
we can not know what is missing ,and this issue cannot be reproduced locally,so add some log
2023-09-09 00:49:40 +08:00
7abd23cad1 [fix](tablet clone) fix be load rebalancer choose candidate tablets #23915
When be load reblancer choose candidate tablets, it will try moving tablets from high load backends to low backend backends. If the higher HIGH BE has no available slot num, it should try next HIGH BE.
2023-09-09 00:48:27 +08:00
2fb4c818da [fix](tablet clone) delete tablet check other catchup #24038
Sometimes FE replica's version is unreliable. FE's replica may bigger than BE's real version. Need check if BE missing version (last failed version > 0).
2023-09-09 00:42:32 +08:00
3e7f531d2b [fix](sec)upgrade org.yaml:snakeyaml to 2.0 #24057 2023-09-09 00:37:07 +08:00
69cc6fee97 [fix](explain) fix explain physical plan with external table issue (#23845)
The `SelectedPartitions` can not be null, or it will throw NPE and fallback to origin planner.
2023-09-08 21:11:48 +08:00
894aa48743 [fix](Nereids) remove PARTITIONS from non-reserved list (#24110)
according to PR #24053, it removed partitions from non-reserved list in
legacy planner's parser. For consistency, remove it from Nereids' parser
too.
2023-09-08 20:47:07 +08:00
929a9ad143 [Fix](RoutineLoad) Delete duplicate attribute in job property #24037 2023-09-08 20:42:28 +08:00
5c2f9eb92e [Improvement] (pipeline) Cancel related query if backend restarts or dead (#23863) 2023-09-08 20:30:52 +08:00
01ea024497 [fix](nereids) runtimefilter not generated after postprocessor (#23948)
fix bug: rf not generated
2023-09-08 17:37:04 +08:00
161520feb4 [feature](Nereids): enable convert CASE WHEN to IF (#24050)
enable rule to convert CASE WHEN to IF.
2023-09-08 16:58:33 +08:00
c0a41dc0f8 [fix](nereids) external scan use STORAGE_ANY instead of ANY as distibution (#24039) 2023-09-08 16:25:35 +08:00
d8bdd6c137 [fix](nereids) avoid throw analysis exception for unsupported type to make ext table goes nereids (#24089)
void throw analysis ex for unsupported type to make ext table goes nereids.
this will improve the nereids' availability for external table if unsupported type is in the basic table schema but not referenced in the real sql.

tested in external table env.

Consider the following case:
select pu.pk_ct_pu as id
  from fms_rd_nc65_zb.NC65P.CT_PU pu
  left join fms_rd_nc65_zb.NC65P.PUB_WF_INSTANCE pwi
    on pu.pk_ct_pu = pwi.billid 
    and pu.vtrantypecode=pwi.billtype
 left join fms_rd_nc65_zb.NC65P.SM_USER su
    on pu.creator = su.cuserid
 where pu.pk_ct_pu='1001A110000000K8XPVN'; 

PUB_WF_INSTANCE table has a BLOB type column and currently it will throw analysis exception and fallback to old optimizer, although this column is not referenced in the real sql. The old optimizer doesn't have the outer join -> inner join rule and the "pu.pk_ct_pu='1001A110000000K8XPVN'; " is not pushed down and the performance will drop down. After the pr, we add the unsupported type instead of throw exception directly, it will decide the unused case and can continue goes nereids and use all advanced optimization for the sql.
2023-09-08 15:56:29 +08:00
82dc970916 [feature](insert) Support group commit insert (#22829) 2023-09-08 15:51:03 +08:00
84c1f5692e [Fix](autobucket) use single replica partition size to calc bucket number #24045 2023-09-08 14:54:02 +08:00
576855acb2 [fix](Nereids): fix regression-test (#24065) 2023-09-08 14:14:48 +08:00
c68e6a9ca8 [Fix](catalog) Doris datetime type conversion failed (#23906)
1. The catalog is connected to an old version of Doris, and an error is reported when using the datetime field type on the Doris surface .
2. error message [fe]:
  Caused by: java.lang.NumberFormatException: For input string: "DATETIM"
  at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[?:1.8.0_291]
  at java.lang.Integer.parseInt(Integer.java:580) ~[?:1.8.0_291]
  at java.lang.Integer.parseInt(Integer.java:615) ~[?:1.8.0_291]
  at org.apache.doris.datasource.jdbc.client.JdbcMySQLClient.dorisTypeToDoris(JdbcMySQLClient.java:401) ~[doris-fe.jar:1.2- 
 SNAPSHOT]
2023-09-08 10:49:35 +08:00
a27349c83a [fix](Export) Concatenation the outfile sql for Export (#23635)
In the original logic, the `Export` statement generates `Selectstmt` for execution. But there is no way to make the `SelectStmt` use the new optimizer.

Now, we change the `Export` statement to generate the `outfile SQL`, and then use the new optimizer to parse the SQL so that outfile can use the new optimizer.
2023-09-08 10:20:18 +08:00
Pxl
ac6028a731 [Bug](partition) fix cannot delete from partitions (#24053) 2023-09-08 10:11:30 +08:00
0bdd078b41 [fix](jdbc catalog) fixed the sqlserver jdbc url parm concatenation error (#23841) 2023-09-08 09:58:20 +08:00
fb5a77b726 [Fix](statistics)Handle external table in statistics cleaner. (#23843)
Before, Statistics Cleaner only handles olap db and table.
External db and tables would be removed without verification. So that external stats could stored no more than 2 days, which is the interval of Stats cleaner thread.
This pr is to add verification for external db and tables.
2023-09-08 09:43:46 +08:00
cb43f07487 [Improvement](statistics)Support basic jdbc external table stats collection (#23963)
Support jdbc external table stats collection.
2023-09-08 09:40:13 +08:00
0dee7246bc Revert "[opt](stats) remove table stats when table has been removed (#23803)" (#24058)
This reverts commit 66d3371400207f568c7ff6ff6bf5f4f0da32bd2c.
Reverts #23803
2023-09-07 23:25:09 +08:00
26337543bf [fix](Nereids) make TVF's distribution spec always be RANDOM (#24020)
Nereids make TVF number as Gather distribution if backend num = 1.
But coordinator could not process gather fragment with scan node.
In the long run, we need to get coordinators to support this scenario.
But it is need a lot of refactor. So, we just forbid Gather distribution
for ScanNode now.
2023-09-07 22:06:45 +08:00
Pxl
ab7c2b9d22 [Bug](type) fix wildcard char's tostring get wrong result (#24041)
fix wildcard char's tostring get wrong result
2023-09-07 20:25:38 +08:00
f0bd2c9c53 [opt](Nereids) optimize error msg of unbound slot (#23933)
for example:
```sql
select avg(c3) from (select c2 from t2) v;
```
the error msg before this PR
```
Invalid call to c3.getDataType() on unbound object
```
the error msg after this PR
```
Unknown column 'c3' in 'table list' in AGGREGATE clause
```
2023-09-07 20:15:59 +08:00
b2ca281395 [fix](Nereids) record wrong best plan properties (#23973)
when output meet order by not meet distribution. we use a trick way to
do enforce by set current output to any. but when we do enforce later,
we still use the old output. So when we do choose best plan, we could
not find the older output's plan, since we have replace it by any.
For example:

```
  lowest Plan(cost, properties, plan, childrenRequires)

    18.0 ANY
     id:138#4 cost=0 [0/0/0/] estRows=4 children=[@0 ] (plan=PhysicalWindow[139]@4 ( windowFrameGroup=(Funcs=[row_number() WindowSpec(PARTITION BY b#1, a#0 ROWS BETWEEN UNBOUNDED_PRECEDING AND CURRENT_ROW) AS `r1`#2], PartitionKeys=[b#1, a#0], OrderKeys=[], WindowFrame=WindowFrame(ROWS, UNBOUNDED_PRECEDING, CURRENT_ROW)), requiredProperties=[DistributionSpecHash ( orderedShuffledColumns=[1, 0], shuffleType=REQUIRE, tableId=-1, selectedIndexId=-1, partitionIds=[], equivalenceExprIds=[[1], [0]], exprIdToEquivalenceSet={0=1, 1=0} ) Order: ([b#1 asc, a#0 asc])], stats=null ))
     [DistributionSpecHash ( orderedShuffledColumns=[0], shuffleType=NATURAL, tableId=3547296, selectedIndexId=3547297, partitionIds=[3547295], equivalenceExprIds=[[0]], exprIdToEquivalenceSet={0=0} ) Order: ([b#1 asc, a#0 asc])]

    32.01171875 DistributionSpecHash ( orderedShuffledColumns=[1], shuffleType=REQUIRE, tableId=-1, selectedIndexId=-1, partitionIds=[], equivalenceExprIds=[[1]], exprIdToEquivalenceSet={1=0} ) Order: ([b#1 asc])
     id:161#4 cost=14 [4/4/4/] estRows=4 children=[@4 ] (plan=PhysicalQuickSort[162]@4 ( orderKeys=[b#1 asc], phase=LOCAL_SORT, stats=null ))
     [DistributionSpecHash ( orderedShuffledColumns=[0], shuffleType=NATURAL, tableId=3547296, selectedIndexId=3547297, partitionIds=[3547295], equivalenceExprIds=[[0]], exprIdToEquivalenceSet={0=0} ) Order: ([b#1 asc, a#0 asc])]

    32.01171875 DistributionSpecHash ( orderedShuffledColumns=[1], shuffleType=EXECUTION_BUCKETED, tableId=-1, selectedIndexId=-1, partitionIds=[], equivalenceExprIds=[[1]], exprIdToEquivalenceSet={1=0} ) Order: ([b#1 asc])
     id:161#4 cost=14 [4/4/4/] estRows=4 children=[@4 ] (plan=PhysicalQuickSort[162]@4 ( orderKeys=[b#1 asc], phase=LOCAL_SORT, stats=null ))
     [DistributionSpecHash ( orderedShuffledColumns=[1], shuffleType=EXECUTION_BUCKETED, tableId=-1, selectedIndexId=-1, partitionIds=[], equivalenceExprIds=[[1]], exprIdToEquivalenceSet={1=0} ) Order: ([])]

    18.01171875 DistributionSpecHash ( orderedShuffledColumns=[1], shuffleType=EXECUTION_BUCKETED, tableId=-1, selectedIndexId=-1, partitionIds=[], equivalenceExprIds=[[1]], exprIdToEquivalenceSet={1=0} ) Order: ([])
     id:157#4 cost=0 [0/0/0/] estRows=4 children=[@4 ] (plan=PhysicalDistribute[158]@4 ( distributionSpec=DistributionSpecHash ( orderedShuffledColumns=[1], shuffleType=EXECUTION_BUCKETED, tableId=-1, selectedIndexId=-1, partitionIds=[], equivalenceExprIds=[[1]], exprIdToEquivalenceSet={1=0} ), stats=null ))
     [DistributionSpecHash ( orderedShuffledColumns=[0], shuffleType=NATURAL, tableId=3547296, selectedIndexId=3547297, partitionIds=[3547295], equivalenceExprIds=[[0]], exprIdToEquivalenceSet={0=0} ) Order: ([b#1 asc, a#0 asc])]
```

the last one require a natural shuffle type property from this group.
but this property already been removed when we do
enforceDistributionButMeetSort. So, such exception will be thrown

```
Caused by: org.apache.doris.nereids.exceptions.AnalysisException: Failed to choose best plan
    at org.apache.doris.nereids.NereidsPlanner.chooseBestPlan(NereidsPlanner.java:340) ~[classes/:?]
    at org.apache.doris.nereids.NereidsPlanner.chooseBestPlan(NereidsPlanner.java:323) ~[classes/:?]
    ... 18 more
Caused by: org.apache.doris.nereids.exceptions.AnalysisException: lowestCostPlans with physicalProperties(DistributionSpecHash ( orderedShuffledColumns=[0], shuffleType=NATURAL, tableId=3547296, selectedIndexId=3547297, partitionIds=[35
47295], equivalenceExprIds=[[0]], exprIdToEquivalenceSet={0=0} ) Order: ([b#1 asc, a#0 asc])) doesn't exist in root group
    at org.apache.doris.nereids.NereidsPlanner.lambda$chooseBestPlan$1(NereidsPlanner.java:318) ~[classes/:?]
    at java.util.Optional.orElseThrow(Optional.java:408) ~[?:?]
    at org.apache.doris.nereids.NereidsPlanner.chooseBestPlan(NereidsPlanner.java:317) ~[classes/:?]
    at org.apache.doris.nereids.NereidsPlanner.chooseBestPlan(NereidsPlanner.java:323) ~[classes/:?]
    ... 18 more
```
2023-09-07 20:12:53 +08:00
20b3e5eafe [feature](Datetime) add from_microsecond / from_millisecond function (#23902) 2023-09-07 19:03:49 +08:00
66d3371400 [opt](stats) remove table stats when table has been removed (#23803) 2023-09-07 18:02:44 +08:00
fdb7a44f57 Revert "[Feature](partitions) Support auto partition" (#24024)
* Revert "[Feature](partitions) Support auto partition (#23236)"

This reverts commit 6c544dd2011d731b8c9c51384c77bcf19c017981.

* Update config.h
2023-09-07 17:08:26 +08:00
4a455f6a4c [feature](Nereids) multi array contains to array overlap (#23864)
transform

```
 array_contains ( c_array, '1' )
 OR array_contains ( c_array, '2' )
```

to

```
array_overlap(c_array, ['1', '2'])
```
2023-09-07 15:00:40 +08:00
7adab1138c [improvement](index) support CANCEL BUILD INDEX (#23760)
Currently, BUILD INDEX can not be canceled. 
This pr add CANCEL BUILD INDEX as follows:
`CANCEL BUILD INDEX index_name ON table_name [(jobid1,jobid2)]`
2023-09-07 14:48:13 +08:00
e40a4d4ae3 [fix](auth)Fix create user no permissions of information_schema database (#23898)
When creating a new user, this user does not have the information_schema database permission.
2023-09-07 12:55:52 +08:00
xy
45dfbeb8b3 [feature](agg) add the aggregation function 'array_agg' #23474
This function requires one arguments just as ARRAY_AGG(col) and col means the column whose values you want to aggregate.
This function Aggregates the values including NULL in a column into an array and returns a value of the ARRAY data type.
2023-09-07 10:21:55 +08:00
a532a08944 [Feature](Nereids)support insert overwrite for Nereids (#23682)
- support insert overwrite for Nereids
- Solving the problem of table ID changing(When no partition is specified,automatically specify all partitions for table )

todo: 
- Under the current processing logic, if the master restarts midway, it will generate dirty data (temp partition)
- for old planner ,insert overwrite table ,table id will change
2023-09-06 22:48:15 +08:00
6c544dd201 [Feature](partitions) Support auto partition (#23236)
Co-authored-by: zhangstar333 <2561612514@qq.com>
2023-09-06 16:26:45 +08:00
cb9acf4918 [fix](planner)fix 'char' function's toSql implementation is wrong (#23860) 2023-09-06 16:16:16 +08:00
df1f4f843a [feature](nereids)push runtime filter to right child of left outer join #23767
A inner join (B left outer join C)

runtimer filter A->C is valid, and can be pushed to C.
2023-09-06 15:47:00 +08:00
Pxl
a96adc01aa [Chore](function) refactor of quantile_state (#23862)
refactor of quantile_state
2023-09-06 15:39:19 +08:00
3047d7dd07 [fix](Nereids) fix or to in rule (#23940)
or expression context can't propagation cross or expression.

for example:
```
select (a = 1 or a = 2 or a = 3) + (a = 4 or a = 5 or a = 6)
= select a in [1, 2, 3] + a in [4,5,6]
!= select a in [1, 2, 3] + a in [1, 2, 3, 4, 5, 6]
```
2023-09-06 14:58:20 +08:00
dc28878f0e [FIX](function) fix size function for array map (#23920)
Issue Number: close #xxx
now we use select size(map(1, 2)); which will make be core
and we can make size function handle array & map column both
2023-09-06 14:32:06 +08:00
45fd23c153 [feature](Nereids) transform outer join to anti join with is null condition (#23833)
create table t1(c1 int not null, c2 int not null) distributed by hash(c1) buckets 3 PROPERTIES ("replication_allocation" = "tag.location.default: 1");

create table t2(c1 int not null, c2 int not null) distributed by hash(c1) buckets 3 PROPERTIES ("replication_allocation" = "tag.location.default: 1");

select t2.* from t1 left outer t2 where t2.c1 is null
==>
t1 right anti t2
2023-09-06 11:31:57 +08:00
aee773502b [opt](Nereids) avoid generate some array in BindExpression (#23854) 2023-09-06 11:12:32 +08:00
728ee90462 [improvement](deploy) Forbid LocalDeployManager drop node (#23875)
Forbid LocalDeployManager drop nodes to prevent errors in the cluster.info file from causing nodes to be dropped.
2023-09-06 08:58:25 +08:00
b885ac5df3 [fix](statistics)Set default database while forwarding stmt to master. #23938
Set default database while forwarding request to master. Avoid No database selected error.
2023-09-06 08:53:30 +08:00