Commit Graph

8510 Commits

Author SHA1 Message Date
aaa89ec768 [bugfix](iceberg)support null values as partition (#35503)
#31442
test in #34929

When null value is used as the partition value, BE will return the "null" string, so this string needs to be processed specially.
2024-05-29 15:03:16 +08:00
646d8eaa73 [fix](restore) Fix restore table name when lower_case_table_names enabled (#35508) 2024-05-29 15:02:08 +08:00
b06794d619 [opt](spill) add session variable of 'enable_force_spill' (#34664) (#35561)
## Proposed changes

pick #34664

<!--Describe your changes.-->
2024-05-29 09:57:31 +08:00
9fae08254d [bugfix](hive)Partition fields in wrong order for 2.1 (#35554)
bp #35322
2024-05-28 22:43:46 +08:00
bddaeb9261 [Fix](JobSchedual) Modify the default value of async_task_consumer_thread_num (#35456)
When `Export` statements are executed concurrently, the background uses
`Job schedule` to manage export tasks. Previously, the default value of
`async_task_consumer_thread_num` was 5, meaning that regardless of the
concurrency setting, a maximum of only 5 threads could execute
concurrently.

On the other hand, not only `Export` uses `Job schedule`, but other
scheduled tasks might also use `Job schedule`, leading to a shortage of
thread resources

Now, we have found that in many scenarios, `Export` needs to be set to a
high concurrency value and run concurrently according to that high
value. Clearly, `async_task_consumer_thread_num = 5` is no longer
sufficient, so we have changed the default value of
`async_task_consumer_thread_num` to 64
2024-05-28 18:54:06 +08:00
72a27a0938 [fix](paimon)fix paimon cache bug (#35309)
Issue Number: close #35024 
This bug is because the fe incorrectly sets the update time of paimon
catalog, causing the be to be unable to update paimon's schema in time.
```c++
    private void initTable() {
        PaimonTableCacheKey key = new PaimonTableCacheKey(ctlId, dbId, tblId, paimonOptionParams, dbName, tblName);
        TableExt tableExt = PaimonTableCache.getTable(key);
        if (tableExt.getCreateTime() < lastUpdateTime) {
            LOG.warn("invalidate cache table:{}, localTime:{}, remoteTime:{}", key, tableExt.getCreateTime(),
                    lastUpdateTime);
            PaimonTableCache.invalidateTableCache(key);
            tableExt = PaimonTableCache.getTable(key);
        }
        this.table = tableExt.getTable();
        paimonAllFieldNames = PaimonScannerUtils.fieldNames(this.table.rowType());
        if (LOG.isDebugEnabled()) {
            LOG.debug("paimonAllFieldNames:{}", paimonAllFieldNames);
        }
    }
```
2024-05-28 18:52:51 +08:00
efdce7e9b3 [fix](binlog) Fix add partition record sql (#35461)
1. support adding a temporary partition
2. remove extra parentheses in the list partition value set
3. support unpartitioned partition item
2024-05-28 18:50:05 +08:00
50e81d9db7 [feat](nereids) add more rules to eliminate empty relation (#34997) -branch-2.1 (#35534)
eliminate empty relations for following patterns:
topn->empty
sort->empty
distribute->empty
project->empty

(cherry picked from commit 8340f23946c0c8e40510ce937acd3342cb2e28b7)

## Proposed changes

Issue Number: close #xxx

<!--Describe your changes.-->

## Further comments

If this is a relatively large or complex change, kick off the discussion
at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why
you chose the solution you did and what alternatives you considered,
etc...
2024-05-28 18:12:42 +08:00
27cf5a667f [enhancement](export) filter empty partition before export table to remote storage (#35389) (#35542)
## Proposed changes

Linked PR : #35389 

<!--Describe your changes.-->

## Further comments

If this is a relatively large or complex change, kick off the discussion
at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why
you chose the solution you did and what alternatives you considered,
etc...
2024-05-28 18:11:12 +08:00
b78dae040a Revert "[fix](nereids) push filter through window, using slot equal-set (#35361)" (#35541)
This reverts commit d2df392994e8dc00dfb5f8e49cca83fca97cb565.

This PR should not pick to branch-2.1, because the infra it relayed on
not in branch-2.1
2024-05-28 17:54:13 +08:00
69da39b43d [improvement](statistics)Use defaultSessionVariable instead of clone a new one. (#34672) (#35531)
backport https://github.com/apache/doris/pull/34672

<!--Describe your changes.-->

## Further comments

If this is a relatively large or complex change, kick off the discussion
at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why
you chose the solution you did and what alternatives you considered,
etc...
2024-05-28 17:19:38 +08:00
aa4fd3fd79 [fix](statistics)Improve analyze timeout. (#33836) (#35530)
backport https://github.com/apache/doris/pull/33836

<!--Describe your changes.-->

## Further comments

If this is a relatively large or complex change, kick off the discussion
at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why
you chose the solution you did and what alternatives you considered,
etc...
2024-05-28 17:12:53 +08:00
63e63e114d [fix](Nereids) could not push down filter through cte producer sometimes (#35507)
pick from master #35463
commit id 0632309209cc3f9b6523ef7054eb1abdb9d0e7d8

when consumer side eliminate some consumers from plan, the size of
consumers is wrong. so we cannot push down some filter in producer side.
this PR fix this problem by update consumer set after rewrite outer side
2024-05-28 16:53:51 +08:00
9d04d18c94 [improvement](statistics)Write audit log while doing drop stats. (#34433) (#35526)
backport https://github.com/apache/doris/pull/34433

<!--Describe your changes.-->

## Further comments

If this is a relatively large or complex change, kick off the discussion
at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why
you chose the solution you did and what alternatives you considered,
etc...
2024-05-28 16:46:27 +08:00
Pxl
87c90094a7 [Bug](materialized-view) fix unmatch mv coz table name (#35444)
fix unmatch mv coz table name
2024-05-28 13:17:33 +08:00
8599e8ee64 [improvement](mtmv) Add id to statistics map in statement context for cost estimation later (#35436)
Add id to statistics map in statement context for cost estimation later
this helps to improve the probability to use materialized view when
query a single table with aggregate and many filter
2024-05-28 13:17:05 +08:00
d2df392994 [fix](nereids) push filter through window, using slot equal-set (#35361)
example:

filter (y=1)
+-- window( ... partition by x)
    +-- project( A as x, A as y)

filter(y=1) is equivalent to filter(x=1),
because x and y are in the same equal-set in window#logicalProperties.
And hence we could push filter(y=1) through window operator
2024-05-28 13:16:53 +08:00
dfcabf8d47 [fix](nereids) set mark join reference for bitmap-in-apply (#35435)
bitmap filter is implemented before mark-join. When support mark-join, we forgot to update the bitmap-filter branch.
when convert a bitmap-apply-in to join, we should set markjoinReference to the join if there are markJoinRefereneces
2024-05-28 13:13:41 +08:00
ac49576229 [Fix](nereids) fix merge aggregate setting top projection bug (#35348)
introduced by #31811

sql like this:

    select col1, col2 from  (select a as col1, a as col2 from mal_test1 group by a) t group by col1, col2 ;

Transformation Description:
In the process of optimizing the query, an agg-project-agg pattern is transformed into a project-agg pattern:
Before Transformation:

LogicalAggregate
+-- LogicalPrject
    +-- LogicalAggregate

After Transformation:

LogicalProject
+-- LogicalAggregate

Before the transformation, the projection in the LogicalProject was a AS col1, a AS col2, and the outer aggregate group by keys were col1, col2. After the transformation, the aggregate group by keys became a, a, and the projection remained a AS col1, a AS col2.

Problem:
When building the project projections, the group by key a, a needed to be transformed to a AS col1, a AS col2. The old code had a bug where it used the slot as the map key and the alias in the projections as the map value. This approach did not account for the situation where aliases might have the same slot.

Solution:
The new code fixes this issue by using the original outer aggregate group by expression's exprId. It searches within the original project projections to find the NamedExpression that has the same exprId. These expressions are then placed into the new projections. This method ensures that the correct aliases are maintained, resolving the bug.
2024-05-28 13:13:31 +08:00
c38c939b52 [bug](Fe) fix potential deadlock in show proc statement (#34988) 2024-05-28 13:12:03 +08:00
f0e883c968 [Fix](executor)Fix backend_active_tasks only scan one be (#35490)
## Proposed changes
Fix ```select * from backend_active_tasks``` but only return one random
be info.
2024-05-28 11:48:42 +08:00
8c4f5af708 [opt](Nereids) auto fallback when insert unsupport catalog (#33353) (#35453)
pick from master #33353
2024-05-27 16:58:35 +08:00
1a52e4f7db [chore](mtmv)Optimize mtmv logs and exception information (#34957) (#35446)
pick from master #34957

1. Change some logs to debug.
2. Error prompt changed from MTMV to async materialized view
2024-05-27 16:35:13 +08:00
a32db25070 [enhance](mtmv) allow add index for MTMV (#34225) (#35443)
Previously, the limitation on whether operations can be performed on materialized views was to determine `opType`.

Now, a `allowOpMTMV()` method is implemented through various `clauses`.

Because some operations have the same `opType`, but some operations allow and some do not.

For example, the `opType` for both `add column` and `create index` is `SCHEMA-CHANGE`, but `add column` is not allowed and `create index` is allowed.
2024-05-27 16:22:16 +08:00
d71e9d34fe [Bugfix] Fix mv column type is not changed when do schema change (#34598) 2024-05-27 15:28:12 +08:00
c44affb43f Add downgrade scan thread num by column num (#35351) 2024-05-27 15:27:12 +08:00
Pxl
82ff29faea [Chore](materialized-view) forbid create mv on row store table (#35360)
forbid create mv on row store table
2024-05-27 15:25:16 +08:00
f98ed4e4c5 [bugfix](hive)Misspelling of class names (#34981) 2024-05-27 15:24:38 +08:00
a82c6e869e [fix](Nereids) LogicalEmptyRelation type is wrong (#35382) 2024-05-27 15:23:46 +08:00
2e20e38523 [improvement](jdbc catalog) remove useless jdbc catalog code (#34986) (#35418) 2024-05-27 14:25:26 +08:00
af986c370b [feat](Nereids): Put the Child with Least Row Count in the First Position of Intersect (#34290) (#35339)
In this pull request, we optimize the ordering of children in the Intersect operator to improve query performance. The proposed change is to place the child with the least row count in the first position of the Intersect operator.

The rationale behind this optimization is that the Intersect operator works by first evaluating the leftmost child and then iterating through the results of the other children to find matching rows. By placing the child with the least row count first, we can minimize the number of iterations required to find the matching rows, thereby reducing the overall execution time of the query.
2024-05-27 11:52:35 +08:00
952875b437 [chore](restore) Add logs about the restore table state (#35363) 2024-05-25 17:47:38 +08:00
41c3a27bce [minor](nereids): remove useless code (#35325) 2024-05-25 17:44:39 +08:00
9c6a6893d9 [fix](mtmv) Fix npe when the id of base table in mv is lager than Integer.MAX_VALUE (#35294) (#35384)
This brought by #34768
2024-05-24 23:27:08 +08:00
9af493f3f9 [fix](mtmv) Fix table id overturn and optimize get table qualifier method (#34768) (#35381)
commitid: 806e241
pr: #34768

Table id may be the same but actually they are different tables. so we optimize the
org.apache.doris.nereids.rules.exploration.mv.mapping.RelationMapping#getTableQualifier with following code:

Objects.hash(table.getDatabase().getCatalog().getId(), table.getDatabase().getId(), table.getId())

table id is long, we identify the table used in mv rewrite is bitSet. the bitSet can only use int, so we mapping the long id to init id in every query when mv rewrite
2024-05-24 21:19:15 +08:00
62998719df [opt](mtmv) Add threshold for relation mapping num when query rewrite (#34694) (#35378)
if query and mv def is as following:

    def mv1_1 = """
        select  t1.L_LINENUMBER,t2.l_extendedprice, t2.L_ORDERKEY
        from lineitem t1
        inner join lineitem t2 on t1.L_ORDERKEY = t2.L_ORDERKEY;
    """
    def query1_1 = """
        select  t1.L_LINENUMBER, t2.L_ORDERKEY
        from lineitem t1
        inner join lineitem t2 on t1.L_ORDERKEY = t2.L_ORDERKEY;
    """

this will generate relation mapping  by Cartesian, if the num of self join is too much, this will cause the performance problem
so we add `materialized_view_relation_mapping_max_count` session varaible, default 8. if actual num is greater than the value, the excess relation mapping is discarded.
2024-05-24 20:36:29 +08:00
cf84998711 Revert "[fix](broker load) Make Config.enable_pipeline_load works as expected for BrokerLoad (#35105)"
This reverts commit e8fb47bec1a1cfc7b07a6ed4eb36283407a4a9fe.
2024-05-24 19:28:34 +08:00
88e2753e40 [fix](Nereids) fix ShowProcedureStatusCommand sendResultSet (#35355) 2024-05-24 17:22:07 +08:00
639c7ee7fb [fix](decimalv2) fix scale of decimalv2 to string (#35222) (#35359)
* [fix](decimalv2) fix scale of decimalv2 to string
2024-05-24 17:20:43 +08:00
ca86ee7b15 [fix](load) fix wrong assert and cancel load error (#35362) 2024-05-24 17:11:01 +08:00
1e07971a98 [Feat](nereids)when dealing insert into stmt with empty table source, fe returns directly (#35333)
* [Feat](nereids) when dealing insert into stmt with empty table source, fe returns directly (#34418)

When a LogicalOlapScan has no partitions, transform it to a LogicalEmptyRelation.
When dealing insert into stmt with empty table source, fe returns directly.

* [Fix](nereids) fix when insert into select empty table

---------

Co-authored-by: feiniaofeiafei <moailing@selectdb.com>
2024-05-24 16:25:00 +08:00
bfe293c725 [fix](nereids) AdjustNullable rule should handle union node with no children (#35074)
The output slot's nullable info is not correctly calculated in union node.
Because old code only get correct result if union node has children.
But the union node may have no children but only have constantExprList.
So in that case, we should calculate output's nullable info byboth children and constantExprList.
2024-05-24 16:23:58 +08:00
f6beeb1ddd [Enhencement](tvf) select tvf supports using resource (#35139)
Create an S3/HDFS resource that TVF can use it directly to access the data source.
2024-05-24 16:23:58 +08:00
d6e8fb7d77 [feature](mtmv) Support agg state roll up and optimize the roll up code (#35026)
agg_state is agg  intermediate state, detail see 
state combinator: https://doris.apache.org/zh-CN/docs/dev/sql-manual/sql-functions/combinators/state

this support agg function roll up as following
 
+---------------------+---------------------------------------------+---------------------+
| query               | materialized view                           | roll up             |
| ------------------- | ------------------------------------------- | ------------------- |
| agg_funtion()       | agg_funtion_unoin()  or agg_funtion_state() | agg_funtion_merge() |
| agg_funtion_unoin() | agg_funtion_unoin() or agg_funtion_state()  | agg_funtion_union() |
| agg_funtion_merge() | agg_funtion_unoin() or agg_funtion_state()  | agg_funtion_merge() |
+---------------------+---------------------------------------------+---------------------+

for example which can be rewritten by mv sucessfully as following

MV defination is

```
            select
            o_orderstatus,
            l_partkey,
            l_suppkey,
            sum_union(sum_state(o_shippriority)),
            group_concat_union(group_concat_state(l_shipinstruct)),
            avg_union(avg_state(l_linenumber)),
            max_by_union(max_by_state(l_shipmode, l_suppkey)),
            count_union(count_state(l_orderkey)),
            multi_distinct_count_union(multi_distinct_count_state(l_shipmode))
            from lineitem
            left join orders
            on lineitem.l_orderkey = o_orderkey and l_shipdate = o_orderdate
            group by
            o_orderstatus,
            l_partkey,
            l_suppkey;
```

Query is

```
            select
            o_orderstatus,
            l_suppkey,
            sum(o_shippriority),
            group_concat(l_shipinstruct),
            avg(l_linenumber),
            max_by(l_shipmode,l_suppkey),
            count(l_orderkey),
            multi_distinct_count(l_shipmode)
            from lineitem
            left join orders 
            on l_orderkey = o_orderkey and l_shipdate = o_orderdate
            group by
            o_orderstatus,
            l_suppkey;
```
2024-05-24 16:23:58 +08:00
bbf502dfcf [fix](create-table)The CREATE TABLE IF NOT EXISTS AS SELECT statement should refrain from performing any INSERT operations if the table already exists (#35210) 2024-05-24 16:23:58 +08:00
bd4dd94c24 [Fix](nereids) add checkBlockRules() check for create view and alter view (#34104) 2024-05-24 16:23:58 +08:00
d85ea83b73 [test](case) Remove sensitive information in k8s deploy test (#35185)
Remove sensitive information from the k8s deployment test, otherwise the code base security check fails.
2024-05-24 16:23:58 +08:00
78fab91d6b [fix](overflow) show backends overflow for backend ids (#35245) 2024-05-24 16:23:58 +08:00
dd567fa774 [fix](function) support return JsonType for If function (#35199)
add a FunctionSignature for If to support return Type is JsonType.
2024-05-24 16:23:58 +08:00
98b2bda660 [opt](Nereids) remove restrict for count(*) in window (#35220)
support count(*) used for window function

CREATE TABLE `t1` (
  `id` INT NULL,
  `dt` TEXT NULL
)
DISTRIBUTED BY HASH(`id`) BUCKETS 10
PROPERTIES (
"replication_allocation" = "tag.location.default: 1"
);

select *, count(*) over() from t1;
2024-05-24 16:23:58 +08:00