Commit Graph

16938 Commits

Author SHA1 Message Date
ff82e2ab59 [improvement](group_commit) Add bvar to monitor the count of replaying wal fail on group commit (#30941) 2024-02-16 10:12:24 +08:00
bbbe3e666a [improvement](group_commit) Rename fail wal to tmp should only use in test P0 scenario (#30959) 2024-02-16 10:12:24 +08:00
b0835b4336 [fix](test) Increase the timeout duration for the test case (#30952) 2024-02-16 10:12:24 +08:00
ad715ab977 [feature](StoragePolicy) Add one http action to add storage policy back (#30879) 2024-02-16 10:12:24 +08:00
ac756075bb Alter workload group queue prop sync for regression test (#30869) 2024-02-16 10:12:24 +08:00
6596f95400 [test](mtmv) Add mtmv increment create case (#30751) 2024-02-16 10:12:24 +08:00
5e6e2f8061 [fix](nereids)should not infer predicate for nullaware anti-join (#30924) 2024-02-16 10:12:24 +08:00
e8f614791e [fix](pipeline) Set the flag of short circuit only when hash join sink finished (#30977) 2024-02-16 10:12:24 +08:00
1437348040 [fix](group_commit) Wal file should be removed from _wal_path_map when renaming it to tmp directory (#30974) 2024-02-16 10:12:24 +08:00
02c37b8ead opt the rf code and remove rf unless code (#30861) 2024-02-16 10:12:24 +08:00
041db03c94 [fix](gc) fix a core introduced by #30854 (#30932)
introduced by #30854, if it is the end of the map _unused_rowsets, program will core.
2024-02-16 10:12:24 +08:00
a1bf00e5ea [fix](nereids)aggregate function cannot contain aggregate parameters (#30928) 2024-02-16 10:12:24 +08:00
c72f634c10 [enhancement](schema change) some types changes (#30919) 2024-02-16 10:12:24 +08:00
7571ecc42f [fix](group_commit)Add bounds checking when reading wal file on group commit (#30940) 2024-02-16 10:12:24 +08:00
abbd1c7ede disable OR predicate for bitmap index (#30951)
There is some problem for OR predicate push down using bitmap index, so disable it.
2024-02-16 10:12:24 +08:00
22cc8342d4 [Enhancement](wal) Optimize group commit manager log (#30849) 2024-02-16 10:12:24 +08:00
36d753eacb [opt](ES catalog) Increase to 3 connect attempts per node (#30957) 2024-02-16 10:12:24 +08:00
5bb8a72626 [fix](group_commit) Fix write column id twice problem on wal file (#30935) 2024-02-16 10:12:24 +08:00
366a6792bf [refactor](scanner) refactoring and optimizing scanner scheduling (#30746) 2024-02-16 10:12:24 +08:00
16cdab816a [refactor](move-memtable) remove phmap and use shared ptr in delta writer v2 (#30949)
* [refactor](move-memtable) remove phmap and use shared ptr in delta writer v2 pool

* ENABLE_FACTORY_CREATOR DeltaWriterV2
2024-02-16 10:12:24 +08:00
de1724ab6a [case](mtmv) MTMV hive case (#30930) 2024-02-16 10:12:24 +08:00
1d10132aa1 [fix](Nereids) should distribute first when do sort enforce on must shuffle (#30948) 2024-02-16 10:12:24 +08:00
34de374e78 [Doc](group commit) Modify group commit doc (#30938) 2024-02-16 10:12:24 +08:00
a3ef8d7bd0 [test](mtmv) Add mtmv negative cases (#30918) 2024-02-16 10:12:24 +08:00
Pxl
e96b3db6f8 [Improvement](memory) clear arena when finalize one row #30788 2024-02-16 10:12:24 +08:00
3017c0a6ff [enhance](mtmv) Limit the number of partitions for table creation (#30867)
- Creating too many partitions is time-consuming, so limiting the number of partitions
- add more case,such as `mor`,`mow`
2024-02-16 10:12:24 +08:00
b01625b7a9 [chore](regression-test) fix legacy use of get tablet info (#30931) 2024-02-16 10:12:24 +08:00
663f748ab7 [fix](multi-catalog)enable use self splitter default (#30846) 2024-02-16 10:12:24 +08:00
2bb477bae7 [feature](agg-func) support corr function #30822 2024-02-16 10:12:24 +08:00
4052746f1c [improvement](balance) fix multiple problems for balance on large cluster (#30713) 2024-02-16 10:12:24 +08:00
5295e16727 [fix](Nereids) make all variables lower case (#30905) 2024-02-16 10:12:23 +08:00
e086d0d719 [test](statistics)Add analyze mtmv test case (#30847) 2024-02-16 10:12:23 +08:00
0442d5dc0e [fix](Variant Type) Add sparse columns meta to fix compaction (#28673)
Co-authored-by: eldenmoon <15605149486@163.com>
2024-02-16 10:12:23 +08:00
32ef6cd4bc [fix](Nereids): fix name of rule EliminateJoinByFK #30884 2024-02-16 10:12:23 +08:00
042934e545 Add auto analyze mv and show task case. (#30894) 2024-02-16 10:12:23 +08:00
517e7a0567 [Fix](load) fix load channel leak when load exception occurs (#30915) 2024-02-16 10:12:23 +08:00
c4a8d5497d [fix](gc) process exception while iteratoring directory (#30850) 2024-02-16 10:12:23 +08:00
b23a785775 [Fix](Variant) support materialize view for variant and accessing variant subcolumns (#30603)
* [Fix](Variant) support materialize view for variant and accessing variant subcolumns
1. fix schema change with path lost and lead to invalid data read
2. support element_at function in BE side and use simdjson to parse data
3. fix multi slot expression
2024-02-16 10:12:23 +08:00
5b343911e8 [log](gc) add log for unused rowsets gc (#30854) 2024-02-16 10:12:23 +08:00
b39cee9c16 [fix](docs) fix log level configuration error in fe.config (#30863)
* Update fe-config.md

* Update fe-config.md
2024-02-16 10:12:23 +08:00
37c36b0491 [fix](regression-test) fixtest_show_export case #30892 2024-02-16 10:12:23 +08:00
cb43ac8ab2 [feature](nereids) using rollup column stats (#30852) 2024-02-16 10:12:23 +08:00
f95d0cf802 [fix](Nereids) should not infer not null from mark join (#30897) 2024-02-16 10:12:23 +08:00
08508d65fd [feature-wip](plsql)(step1) Support PL-SQL (#30817)
# 1. Motivation
PL-SQL (Stored procedure) is a collection of sql, which is defined and used similarly to functions. It supports conditional judgments, loops and other control statements, supports cursor processing of result sets, and can write business logic in SQL.

Hive uses Hplsql to support PL-SQL and is largely compatible with Oracle, Impala, MySQL, Redshift, PostgreSQL, DB2, etc. We support PL-SQL in Doris based on Hplsql to achieve compatibility with Stored procedures of database systems such as Oracle and PostgreSQL.

Reference documentation:
Hive: http://mail.hplsql.org
Oracle: https://docs.oracle.com/en/database/oracle/oracle-database/21/lnpls/plsql-language-fundamentals.html#GUID-640DB3AA-15AF-4825-BD6C-1D4EB5AB7715
Mysql: https://dev.mysql.com/doc/refman/8.0/en/create-procedure.html

# 2. Implementation
Take the following case as an example to explain the process of connecting Doris FE to execute stored procedures using the Mysql protocol.
```
CREATE OR REPLACE PROCEDURE A(IN name STRING, OUT result int)
          select count(*) from test;
          select count(*) into result from test where k = name;
END

declare result INT default = 0;
call A(‘xxx’, result);
print result;
```
![image](https://github.com/apache/doris/assets/13197424/0b78e039-0350-4ef1-bef3-0ebbf90274cd)

1. Add procedure and persist the Procedure Name and Source (raw SQL) into Doris FE metadata.
2. Call procedure, extract the actual parameter Value and Procedure Name in Call Stmt. Use Procedure Name to find the Source in the metadata, extract the Name and Type of the Procedure parameter, and match them with the actual parameter Value to form a complete variable <Name, Type, Value>.
3. Execute Doris Statement
     - Use Doris Logical Plan Builder to parse the Doris Statement syntax in Source, replace parameter variables, remove the into variable clause, and generate a Plan Tree that conforms to Doris syntax.
     - Use stmtExecutor to execute SQL and encapsulate the query result set iterator into QueryResult.
     - Output the query results to Mysql Channel, or write them into Cursor, parameters, and variables.
     - Stored Programs compatible with Mysql protocol support multiple statements.
4. Execute PL-SQL Statement
     - Use Plsql Logical Plan Builder to parse and execute PL-SQL Statement syntax in Source, including Loop, Cursor, IF, Declare, etc., and basically reuse HplSQL.

# 3. TODO
1. Support drop procedure.
2. Create procedure only in `PlSqlOperation`.
3. Doris Parser supports declare variable.
4. Select Statement supports insert into variable.
5. Parameters and fields have the same name.
6. If Cursor exits halfway, will there be a memory leak?
7. Use getOriginSql(ctx) in syntax parsing LogicalPlanBuilder to obtain the original SQL. Is there any problem with special characters?
8. Supports complex types such as Map and Struct.
9. Test syntax such as Package.
10. Support UDF
11. In Oracle, create procedure must have AS or IS after RIGHT_PAREN,
but Mysql and Hive not support AS or IS. Compatibility issues with Oracle will be discussed and resolved later.
12. Built-in functions require a separate management.
13. Doris statement add stmt: egin_transaction_stmt, end_transaction_stmt, commit_stmt, rollback_stmt.
14. Add plsql stmt: cmp_stmt, copy_from_local_stmt, copy_stmt, create_local_temp_table_stmt, merge_stmt.

# 4. Some questions
1. JDBC does not support the execution of stored procedures that return results. You can only Into the execution results into a variable or write them into a table, because when multiple result sets are returned, JDBC needs to use the prepareCall statement to execute, otherwise the Statemnt of the returned result executes Finalize. Send EOF Packet will report an error;
2. Use PL-SQL Cursor to open multiple Query result set iterators at the same time. Doris BE will cache the intermediate status of these Queries (such as HashTable) and query results until the Query result set iteration is completed. If the Cursor is not available for a long time Being used will result in a lot of memory waste.
3. In plsql/Var.defineType(), the corresponding Plsql Var type will be found through the Mysql type name string, and the corresponding relationship between Doris type and Plsql Var needs to be implemented.
4. Currently, PL-SQL Statement will be forwarded to Master FE for creation and calculation, which may affect other services on Doris FE and is limited by the performance of Doris FE. Consider moving it to Doris BE for execution.
5. The format of the result returned by Doris Statement is ```xxxx\n, xxxx\n, 2 rows affected (0.03 sec)```. PL-SQL uses Print to print variable values in an unformatted format, and JDBC cannot easily obtain them. Real results.

# 5. Some thoughts
The above execution of Doris Statement reuses Doris Logical Plan Builder for syntax parsing, parses it from top to bottom into a Plan Tree, and calls stmtExecutor for execution. PL-SQL replacement variables, removal of Into Variable and other operations are coupled in Doris syntax parsing. The advantage is that it is easier to It can be compatible with Doris grammar with a few changes, but the disadvantage is that it will invade the Doris grammar parsing process.
HplSQL performs a syntax parsing independently of Hive to implement variable substitution and other operations, and finally outputs a SQL that conforms to Hive syntax. The following is a simple syntax parsing process for select, where, expression, table name, join, The parsing of agg, order and other grammars must be re-implemented. The advantage is that it is completely independent from the original system, but the changes are too complicated.
![image](https://github.com/apache/doris/assets/13197424/7539e485-0161-44de-9100-1a01ebe6cc07)
2024-02-16 10:12:23 +08:00
c6cd6b125d [nereids] group by key elimination (#30774) 2024-02-16 10:12:23 +08:00
2667e10ba2 [improve](group-commit) Modify some log (#30842) 2024-02-16 10:12:23 +08:00
89695f43d4 [refactor](queryctx) move tg related code to task group (#30829)
init query ctx memtracker in queryctx constructor
set all task group related property during set taskgroup
2024-02-16 10:12:23 +08:00
2cb46eed94 [Feature](auto-inc) Add start value for auto increment column (#30512) 2024-02-16 10:12:23 +08:00
5ca10d95b7 [fix](Docs) Modify the document of data export #30785 2024-02-16 10:12:23 +08:00
5c2a4a80dd [fix](nereids) Fix use aggregate mv wrongly when rewrite query which only contains join (#30858)
the materialized view def is as following:
>            select 
>               o_orderdate, 
>               o_shippriority, 
>               o_comment, 
>               l_orderkey, 
>               o_orderkey, 
>               count(*) 
>             from 
>               orders 
>               left join lineitem on l_orderkey = o_orderkey
>               group by o_orderdate, 
>               o_shippriority, 
>               o_comment, 
>               l_orderkey;

the query should rewrite success by using above materialized view
>             select 
>               o_orderdate, 
>               o_shippriority, 
>               o_comment, 
>               l_orderkey, 
>               ps_partkey, 
>               count(*) 
>             from 
>               orders left 
>               join lineitem on l_orderkey = o_orderkey
>               left join partsupp on ps_partkey = l_orderkey
>               group by
>              o_orderdate, 
>              o_shippriority, 
>              o_comment, 
>              l_orderkey, 
>              ps_partkey;
2024-02-16 10:12:23 +08:00