Commit Graph

3155 Commits

Author SHA1 Message Date
7b44e7ff94 [Doc-fix] fix doc issue (#6315)
in be_config.md, there is wrong description about `tablet_rowset_stale_sweep_time_sec`
with "磁盘时间不足时“ as below, instead,it should be ”磁盘空间不足时“。
2021-07-26 09:41:10 +08:00
bf0ba1d8ce [Doc-fix] change min_bytes_per_broker_scanner's Chinese translation. (#6310)
min_bytes_per_broker_scanner should be the "最小"
2021-07-26 09:40:22 +08:00
75d954ced5 [Feature] Modify the cost evaluation algorithm of Broadcast and Shuffle Join (#6274)
issue #6272

After modifying the Hash Table memory cost estimation algorithm, TPC-DS query-72 etc. can be passed, avoiding OOM.
2021-07-26 09:38:41 +08:00
13ef2c9e1d [Function][Enhance] lower/upper case transfer function vectorized (#6253)
Currently, the function lower()/upper() can only handle one char at a time.
A vectorized function has been implemented, it makes performance 2 times faster. Here is the performance test:

The length of char: 26, test 100 times
vectorized-function-cost: 99491 ns
normal-function-cost: 134766 ns

The length of char: 260, test 100 times
vectorized-function-cost: 179341 ns
normal-function-cost: 344995 ns
2021-07-26 09:38:07 +08:00
8d1c1ef1e6 [Community] Fix PR labeling github action workflow (#6279)
My change is the fix and improvement for github action which labels approved PRs (introduced in this [PR](https://github.com/apache/incubator-doris/pull/6239)).

It is inspired by solution introduced and tested in [Apache Airflow](https://github.com/apache/airflow) (thanks @potiuk @ashb 🚀 )

Corresponding Apache Airflow workflows on which I based this PR:
 - https://github.com/apache/airflow/blob/main/.github/workflows/label_when_reviewed.yml
 - https://github.com/apache/airflow/blob/main/.github/workflows/label_when_reviewed_workflow_run.yml

Problems which were solved in this PR:

 - **Permissions**.
  @morningman opened a related bug: [[Help] Error: Resource not accessible by integration](https://github.com/TobKed/label-when-approved-action/issues/7). It is related to limited permissions of workflows being triggered by `pull_request_review` (`GITHUB_TOKEN` has read-only permissions). More information about it you can find in the article:  [Keeping your GitHub Actions and workflows secure: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/).
   TL;DR:  On pull request review event (`on: pull_request_review` ) "dummy" workflow `Label when reviewed` triggers another workflow `Label when approved workflow run` which has sufficient permissions (`on:  workflow_run:  workflows: ["Label when reviewed"]`).

 - **Safe use of 3rd-party Github Actions by using submodules pattern.**  It is decribed in:    
 https://cwiki.apache.org/confluence/display/BUILDS/GitHub+Actions+status

    >  NEVER use 3rd-party actions directly in your workflows - use the "submodule" pattern.
    
    This pattern is successfully used by projects like:
     - [Apache Airflow](https://github.com/apache/airflow) ([PR](https://github.com/apache/airflow/pull/13514#))
     - [Apache Beam](https://github.com/apache/beam) ([PR](https://github.com/apache/beam/pull/13736))
     - [Apache Superset](https://github.com/apache/superset) ([PR](https://github.com/apache/superset/pull/12709))
2021-07-25 22:22:09 +08:00
02a00cdf35 [Bug] Fix the bug in from_date_format_str function (#6273) 2021-07-21 12:31:37 +08:00
7771233f30 [BUG] GROUPING func and ORDER BY are used at the same time to report NullPointerException (#6266)
fix #6265

The reason for the error is that the `Grouping Func Exprs` is substituted twice. In the first substitution, `VirtualSlotRef` is used to replace the original `SlotRef`, and in the second substitution, `VirtualSlotRef` is reported in the `getTable()` Times Null pointer. IN
```
} else if (((SlotRef) child).getDesc().getParent().getTable().getType()
```
For the first substitution, the List of executable exprs in select clause has been substituted.
```
groupingInfo = new GroupingInfo(analyzer, groupByClause.getGroupingType());
            groupingInfo.substituteGroupingFn(resultExprs, analyzer);
```
In the second substitution, actually only need to substitute the unique expr in Ordering exprs.
```
createSortInfo(analyzer);
        if (sortInfo != null && CollectionUtils.isNotEmpty(sortInfo.getOrderingExprs())) {
            if (groupingInfo != null) {
                groupingInfo.substituteGroupingFn(sortInfo.getOrderingExprs(), analyzer);
            }
        }
```
change into:
```
createSortInfo(analyzer);
        if (sortInfo != null && CollectionUtils.isNotEmpty(sortInfo.getOrderingExprs())) {
            if (groupingInfo != null) {
                List<Expr> orderingExprNotInSelect = sortInfo.getOrderingExprs().stream()
                        .filter(item -> !resultExprs.contains(item)).collect(Collectors.toList());
                groupingInfo.substituteGroupingFn(orderingExprNotInSelect, analyzer);
            }
        }
```
2021-07-21 12:31:20 +08:00
327e31c227 [Feature] Support setting concurrency for thread pool token (#6237)
Now we can submit a group of tasks using thread pool token, and limit
the max concurrency of this task group
2021-07-21 12:30:43 +08:00
7592f52d2e [Feature][Insert] Add transaction for the operation of insert #6244 (#6245)
## Proposed changes
Add transaction for the operation of insert. It will cost less time than non-transaction(it will cost 1/1000 time) when you want to insert a amount of rows.
### Syntax

```
BEGIN [ WITH LABEL label];
INSERT INTO table_name ...
[COMMIT | ROLLBACK];
```

### Example
commit a transaction:
```
begin;
insert into Tbl values(11, 22, 33);
commit;
```
rollback a transaction:
```
begin;
insert into Tbl values(11, 22, 33);
rollback;
```
commit a transaction with label:
```
begin with label test_label;
insert into Tbl values(11, 22, 33);
commit;
```

### Description
```
begin:  begin a transaction, the next insert will execute in the transaction until commit/rollback;
commit:  commit the transaction, the data in the transaction will be inserted into the table;
rollback:  abort the transaction, nothing will be inserted into the table;
```
### The main realization principle:
```
1. begin a transaction in the session. next sql is executed in the transaction;
2. insert sql will be parser and get the database name and table name, they will be used to select a be and create a pipe to accept data;
3. all inserted values will be sent to the be and write into the pipe;
4. a thread will get the data from the pipe, then write them to disk;
5. commit will complete this transaction and make these data visible;
6. rollback will abort this transaction
```

### Some restrictions on the use of update syntax.
1. Only ```insert``` can be called in a transaction.
2. If something error happened, ```commit``` will not succeed, it will ```rollback``` directly;
3. By default, if part of insert in the transaction is invalid, ```commit``` will only insert the other correct data into the table.
4. If you need ```commit``` return failed when any insert in the transaction is invalid, you need execute ```set enable_insert_strict = true``` before ```begin```.
2021-07-21 10:54:11 +08:00
acad8e6367 [Doc] Add a catalog of best practices, and the implementation of Doris FE load balancing (#6231)
Add a catalog of best practices, and the implementation of Doris FE load balancing
2021-07-21 10:51:50 +08:00
8ae129967e [ODBC] Support ODBC external table of SQLServer and revise the doc. (#6223)
Support ODBC external table of SQLServer
2021-07-21 10:50:56 +08:00
2d78c31d49 [Enhance] improve performance of init_scan_key by sharing the schema (#6099)
Co-authored-by: huangmengbin <huangmengbin@bytedance.com>
2021-07-21 10:50:31 +08:00
94c50012b2 [Performance] Optimize the performance of tabletReport (#6200)
1. Use parallelStream to speed up tabletReport.
2. Add partitionIdInMemorySet to speed up tabletToInMemory check.
3. Add disable_storage_medium_check to disable storage medium check when user doesn't care what tablet's storage medium is, and remove enable_strict_storage_medium_check config to fix some potential migration task failures.

Co-authored-by: caiconghui <caiconghui@xiaomi.com>
2021-07-19 20:26:14 +08:00
a1a37c8cba [Feature] Support calc constant expr by BE (#6233)
At present, some constant expression calculations are implemented on the FE side,
but they are incomplete, and some expressions cannot be completely consistent with
the value calculated by BE (such as part of the time function)

Therefore, we provide a way to pass all the constants in SQL to BE for calculation,
and then begin to analyze and plan SQL. This method can also solve the problem that some
complex constant calculations issued by BI cannot be processed on the FE side.

Here through a session variable enable_fold_constant_by_be to control this function,
which is disabled by default.
2021-07-19 10:25:53 +08:00
5de79ec3f0 [Feature] Support data encrypt/decrypt (#6115)
Add support for data encryption/decryption.
2021-07-19 09:27:08 +08:00
92d41f91b8 [UT] Fix CreateMaterializedViewStmtTest failed (#6258)
In PR #6226, we open the debug level of unit test, it cause some
unexpected exception.
2021-07-18 22:16:56 +08:00
7a8837c962 [Maven][Dependency][Bug][DOE] fix sync es metadata issue on jdk 13 (#6250) 2021-07-18 22:16:38 +08:00
b53ff15ef2 [Config] set spark load and odbc table feature enable by default (#6212)
1. Also use BufferedReader to speed up orc reader
2021-07-18 22:15:13 +08:00
a4b1622ceb [HttpV2] Add more httpv2 APIs (#6210)
1. /api/cluster_overview to view some statistic info of the cluster
2. /api/meta/ to view the database/table schema
3. /api/import/file_review to review the file content with format CSV or PARQUET.
2021-07-18 22:14:42 +08:00
afce23a2fd [DOC] Add docs of Runtime Filter (#6154) 2021-07-18 22:14:24 +08:00
e21bb504a2 [LOG] Errors during mysql connection establishment should be warned (#6257)
* Errors during mysql connection establishment should be warned

Co-authored-by: yuzhou.zk <yuzhou.zk@alibaba-inc.com>
2021-07-18 20:54:40 +08:00
c6e442e926 [MINOR] Fix the comment about usage of build.sh (#6254)
* [BUILD] Fix comment about usage of build.sh

Co-authored-by: yuzhou.zk <yuzhou.zk@alibaba-inc.com>
2021-07-18 20:53:42 +08:00
fae3eff2e6 [Bug] Fix the bug of cast string to datetime return not null (#6228) 2021-07-17 10:55:08 +08:00
66f1ddaa72 [BDBJE] Add a tool to view the data in BEBJE (#6209)
When the config "enable_bdbje_debug_mode" of FE is set to true,
start FE and enter debug mode.
In this mode, only MySQL server and http server will be started.
After that, users can log in to Doris through the web front-end or MySQL client,
and then use "show proc "/bdbje"" to view the data in bdbje.

Co-authored-by: chenmingyu <chenmingyu@baidu.com>
2021-07-17 10:45:51 +08:00
e39e1571ec [Feature] Add an indicator called errorRowsAfterResumed to distinguish between … (#6092)
1. [enhancement] add an indicator called errorRowsAfterResumed to distinguish between totalErrorRows(called errorRows) and errorRowsAfterResumed. (#6092)
2. [Refactor] separate some indicators from RoutineLoadJob class to avoid changing FeMetaVersion while modifying indicators of RoutineLoadJob.(#6092)
2021-07-17 10:43:59 +08:00
8de09cbd21 [Bug-fix] Decimal Divide, Mod Zero Result Should be NULL. (#6051) 2021-07-17 10:43:06 +08:00
bf5db6eefe [BUG][Timeout][QueryLeak] Fixed memory not released in time (#6221)
* Revert "[Optimize] Put _Tuple_ptrs into mempool when RowBatch is initialized (#6036)"

This reverts commit f254870aeb18752a786586ef5d7ccf952b97f895.

* [BUG][Timeout][QueryLeak] Fixed memory not released in time, Fix Core dump in bloomfilter
2021-07-16 12:32:10 +08:00
c2695e9716 [Bug][RoutineLoad] Can not match whole json in routine load (#6213)
Support using json path "$" to match the whole json in routine load

Co-authored-by: chenmingyu <chenmingyu@baidu.com>
2021-07-16 09:21:27 +08:00
19cd42ccbd [BUG] avoid std::function copy in client cache (#6186)
* [BUG] avoid std::function copy in client cache

* Refactor ClientFactory Name
2021-07-16 09:20:28 +08:00
15c5896f41 [Docs] Add like, regexp function documents (#6182)
* [Docs] Add like, regexp function documents

* Reconstruct

* Fix compile error
2021-07-15 13:16:21 +08:00
409cee0fdb [Bug][RoutineLoad] Fix bug that routine load thread on BE may be blocked (#6215)
* [Bug][RoutineLoad] Fix bug that routine load thread on BE may be blocked

This bug will cause the routine load job throw TOO MANY TASK error, and routine
load job is blocked.

* fix ut

Co-authored-by: chenmingyu <chenmingyu@baidu.com>
2021-07-15 11:21:01 +08:00
68f988b78a [Optimize] Use flat_hash_set to replace unorderd_set in InPredicate (#6216)
Co-authored-by: chenmingyu <chenmingyu@baidu.com>
2021-07-15 11:15:11 +08:00
d5cd3ae5ee [Compatibility] Change the response body of load info api in httpv2. (#6208)
1. To be compatible with response body of GetLoadInfoAction in httpv1.
2. Not drop partition by force in dynamic partition scheduler.

Change-Id: I50864ddadf1a1c25efa16a465940a1129f937d3d

Co-authored-by: chenmingyu <chenmingyu@baidu.com>
2021-07-15 11:14:45 +08:00
7e77b5ed7f [Optimize] Using custom conf dir to save log config of Spring (#6205)
The log4j-config.xml will be generated at startup of FE and also when modifying FE config.
But in some deploy environment such as k8s, the conf dir is not writable.

So change the dir of log4j-config.xml to Config.custom_conf_dir.

Also fix some small bugs:

1. Typo "less then" -> "less than"
2. Duplicated `exec_mem_limit` showed in SHOW ROUTINE LOAD
3. Allow MAXVALUE in single partition column table.
4. Add IP info for "intolerate index channel failure" msg.

Change-Id: Ib4e1182084219c41eae44d3a28110c0315fdbd7d

Co-authored-by: chenmingyu <chenmingyu@baidu.com>
2021-07-15 11:13:51 +08:00
7c34dbbc5b [Bug-Fix] Fix bug that show view report "Unresolved table reference" error (#6184) 2021-07-15 10:55:15 +08:00
39945aba1e [s3][bug] Remove log4j1 (#6211)
There are jar package conflict

Co-authored-by: chenmingyu <chenmingyu@baidu.com>
2021-07-15 10:47:59 +08:00
e905dd84c8 [Community] Add an github action to auto add 'approved' label (#6239)
1. If any committer APPROVE a PR, the label 'approved' will be added.
2. If any other reviewed APPROVE a PR, the label 'reviewed' will be added.
2021-07-14 21:12:42 +08:00
f4c5c6ccc6 [Doc] Optimize dynamic partition docs (#6217)
optimize dynamic partition docs.
add feature introduced in #6129
2021-07-14 14:02:33 +08:00
cbc42db010 [JoinReorder] Implement a better join reorder algorithm. (#6226)
The current JoinReorder algorithm mainly sorts according to the star model,
and only considers the query association relationship between the table and the table.
The problems are following:
1. Only applicable to user data whose data model is a star model, data of other models cannot be sorted.
2. Regardless of the cost of the table, it is impossible to determine the size of the join table relationship,
   and the real query optimization ability is weak.
3. It is impossible to avoid possible time-consuming joins such as cross joins by sorting.

The new JoinReorder algorithm mainly introduces a new sorting algorithm for Join
The new ranking algorithm introduces the cost evaluation model to Doris.

The sorting algorithm is mainly based on the following three principles:
1. The order is: Largest node, Smallest node. . . Second largest node
2. Cross join is better than Inner join
3. The right children of Outer join, semi join, and anti join do not move

PlanNode's cost model evaluation mainly relies on two values: cardinality and selectivity.
cardinality: cardinality, can also be simply understood as the number of rows.
selectivity: selectivity, a value between 0 and 1. Predicate generally has selectivity.
The cost model generally calculates the final cardinality of a PlanNode based on the pre-calculated
cardinality of PlanNode and the selectivity of the predicate to which it belongs.

Currently, you can configure "enable_cost_based_join_reorder" to control the opening and closing of JoinReorder.
When the configuration is turned on, the new sorting algorithm will take effect, when it is turned off,
the old sorting algorithm will take effect, and it is turned off by default.

The new sorting algorithm currently has no cost base evaluation for external tables (odbc, es)
and set calculations (intersect, except). When using these queries, it is not recommended to enable cost base join reorder.
When using these queries, it is not recommended to enable cost base join reorder.

At the code architecture level:
1. The new sorting algorithm occurs in the single-node execution planning stage.
2. Refactored the init and finalize phases of PlanNode to ensure that PlanNode planning
   and cost evaluation have been completed before the sorting algorithm occurs.
2021-07-14 13:08:28 +08:00
ed3ff470ce [ARRAY] Support array type load and select not include access by index (#5980)
This is part of the array type support and has not been fully completed. 
The following functions are implemented
1. fe array type support and implementation of array function, support array syntax analysis and planning
2. Support import array type data through insert into
3. Support select array type data
4. Only the array type is supported on the value lie of the duplicate table

this pr merge some code from #4655 #4650 #4644 #4643 #4623 #2979
2021-07-13 14:02:39 +08:00
8fe5c75877 [DataX] Refactor doriswriter (#6188)
1. Use `read_json_by_line` to load data
2. Use FE http server as the target host of stream load
2021-07-13 11:36:40 +08:00
3cab194e9a [Doc] Fix parameter from routineLoad markdown file about ifnull (#6142) 2021-07-13 11:36:23 +08:00
394a9a1472 [Feature] Runtime Filtering for Doris (Background, Configuration, FE Implement, Tuning, Test ) (#6121)
- `RuntimeFilterGenerator` is used to generate Runtime Filter and assign it to the node that uses Runtime Filter in the query plan.

- `RuntimeFilter` represents a filter in the query plan, including the specific properties of the filter, the binding method of expr and tuple slot, etc.

- `RuntimeFilterTarget` indicates the filter information provided to ScanNode, including target expr, whether to merge, etc.
2021-07-13 11:36:01 +08:00
f93a272956 [Bug] Fix bug that nondeterministic functions should not be rewrote in create view stmt (#6096)
create view v1 as select now() should not be rewrote as:
create view v1 as select "2021-06-26 12:11:11";
2021-07-13 11:35:35 +08:00
d79cdc829f [Bug] Filter out unavaliable backends when getting tablet location (#6204)
* [Bug] Filter out unavaiable backends when getting scan range location

In the previous implementation, we will eliminate non-surviving BEs in the Coordinator phase.
But for Spark or Flink Connector, there is no such logic, so when a BE node is down,
it will cause the problem of querying errors through the Connector.

* fix ut

* fix compiule
2021-07-13 11:17:49 +08:00
76e148988a Support alter default bucket_num of partitioned olap table (#6023)
* Support modify partitioned olap table's bucket num

Co-authored-by: EmmyMiao87 <522274284@qq.com>
2021-07-12 20:28:40 +08:00
dd15da4e12 [DynamicPartition] Fix UT and add more tests for dynamic partition (#6198) 2021-07-12 15:31:33 +08:00
56112c4718 [Bug] Fix bug that adding conflicting partition doesn't report errors (#6109)
* [Bug] Fix bug that adding conflicting partition doesn't report errors

Co-authored-by: caiconghui <caiconghui@xiaomi.com>
2021-07-12 13:32:44 +08:00
dbfe8e4753 [enhancement] Optimize load CSV file memory allocate (#6174)
Optimize load CSV file memory allocate, avoid frequent allocation,
may reduce the load time by 40%-50% when large column numbers
2021-07-12 09:58:45 +08:00
b5f447b932 [ResourceLimit] Add a property to limit user instance num. (#6159)
Add a property to limit user instance num.
2021-07-10 10:15:05 +08:00