Commit Graph

3177 Commits

Author SHA1 Message Date
d1007afe80 Use fmt and std::from_chars to make convert integer to string and convert string to integer more efficient (#6361)
* [Optimize] optimize the speed of converting integer to string

* Use fmt and std::from_chars to make convert integer to string and convert string to integer more efficient

Co-authored-by: caiconghui <caiconghui@xiaomi.com>
2021-08-04 10:55:19 +08:00
16bc5fa585 [Bug] fix violating C/C++ aliasing rules cause a error hash value in decimal value (#6348)
In RuntimeFilter BloomFilter, decimal column will got a wrong hash value because violating  aliasing rules
decimal12_t decimal = { 12, 12 };
murmurhash3(decimal) in bloom filter: 2167721464
expect: 4203026776
2021-08-03 12:00:03 +08:00
2c208e932b [Bug][RoutineLoad] Avoid TOO_MANY_TASKS error (#6342)
Use `commitAsync` to commit offset to kafka, instead of using `commitSync`, which may block for a long time.
Also assign a group.id to routine load if user not specified "property.group.id" property, so that all consumer of
this job will use same group.id instead of a random id for each consume task.
2021-08-03 11:59:06 +08:00
748604ff4f [RoutineLoad] Support alter broker list and topic for kafka routine load (#6335)
```
alter routine load for cmy2 from kafka("kafka_broker_list" = "ip2:9094", "kafka_topic" = "my_topic");
```

This is useful when the kafka broker list or topic has been changed.

Also modify `show create routine load`, support showing  "kafka_partitions" and "kafka_offsets".
2021-08-03 11:58:38 +08:00
a2eb1b9d5b fix version (#6334) 2021-07-30 09:25:22 +08:00
9ca369aa58 [Feature][LDAP] Add LDAP authentication login and LDAP group authorization support. (#6333)
* [Feature][LDAP] Add LDAP authentication login and LDAP group authorization support.

* Update docs/.vuepress/sidebar/en.js

Co-authored-by: Mingyu Chen <morningman.cmy@gmail.com>

Co-authored-by: Mingyu Chen <morningman.cmy@gmail.com>
2021-07-30 09:24:50 +08:00
cf1fcdd614 fix BE coredump in UserFunctionCache (#6331)
Co-authored-by: weizuo <weizuo@xiaomi.com>
2021-07-30 09:24:30 +08:00
14db74fac6 [Bug] Fix show load like match (#6314)
* fix show load like match

* Compatible with historical issues
2021-07-30 09:24:06 +08:00
6597a338dc [Feature] Support config max length of zone map index (#6293) 2021-07-30 09:23:11 +08:00
5a7237062f remove palo_internal_service.proto and PInternalService from code base, because it is not used now (#6341) 2021-07-30 09:22:50 +08:00
d416cd3e79 [Bug] Fix BE coredump when flushing memtable (#6317)
Fix #6316

If the size of memtable is greater than max segment size and the memtable will flush more than
one segment file. BE coredump will be triggered when flushing memtable.
2021-07-27 13:42:19 +08:00
1454aacd69 [Metric] Add metrics to monitor size of queued tasks in load thread pool (#6306)
(1) Add metrics to monitor the size of queued tasks in load thread pool.
(2) Change some log level to VLOG_NOTICE
2021-07-27 13:41:44 +08:00
776df2effc [BUG][stack-buffer-overflow] fix overflow while calculate hash code in ArrayType and fix some warning 2021-07-27 13:41:00 +08:00
cdffe1ae20 [Doc] Modify the storage path configuration instructions in the installation and BE configuration documents (#6298) 2021-07-27 13:40:15 +08:00
095182da62 [Script] Compile and automatically create fe doris-meta and be storage directories (#6297)
Compile and automatically create fe doris-meta and be storage directories
2021-07-27 13:39:50 +08:00
60ac4a9660 [Bug][SparkLoad] Fix bucket_hash_value for bool value (#6284)
Co-authored-by: weixiang <weixiang06@meituan.com>
2021-07-27 13:38:42 +08:00
b3a52a05d5 [Update] Support update syntax (#6230)
[Update] Support update syntax

    The current update syntax only supports updating the filtered data of a single table.

    Syntax:

     * UPDATE table_reference
     *     SET assignment_list
     *     [WHERE where_condition]
     *
     * value:
     *     {expr}
     *
     * assignment:
     *     col_name = value
     *
     * assignment_list:
     *     assignment [, assignment] ...

    Example
    Update unique_table
         set v1=1
         where k1=1

    New Frontend Config: enable_concurrent_update
    This configuration is used to control whether multi update stmt can be executed concurrently in one table.
    Default value is false which means A table can only have one update task being executed at the same time.
    If users want to update the same table concurrently,
      they need to modify the configuration value to true and restart the master frontend.
    Concurrent updates may cause write conflicts, the result is uncertain, please be careful.

    The main realization principle:
    1. Read the rows that meet the conditions according to the conditions set by where clause.
    2. Modify the result of the row according to the set clause.
    3. Write the modified row back to the table.

    Some restrictions on the use of update syntax.
    1. Only the unique table can be updated
    2. Only the value column of the unique table can be updated
    3. The where clause currently only supports single tables

    Possible risks:
    1. Since the current implementation method is a row update,
         when the same table is updated concurrently, there may be concurrency conflicts which may cause the incorrect result.
    2. Once the conditions of the where clause are unsatisfactory, it is likely to cause a full table scan and affect query performance.
       Please pay attention to whether the column in the where clause can match the index when using it.

    [Docs][Update] Add update document and sql-reference

    Fixed #6229
2021-07-27 13:38:15 +08:00
f26e3408b2 [Profile] Support show load profile for broker load job (#6214)
1.
Add new statement:
`SHOW LOAD PROFILE "xxx";`

2.
Improve the read performance of orc scanner
2021-07-27 13:37:34 +08:00
b1f5979103 [New Feature][Meta][Image] Add file header and footer for image (#6207)
#6206 

At present, our image file does not have file header/footer. When we need to change the image format (such as adding different journal versions to the image), there is no way to distinguish different image formats.

Therefore, we suggest adding file header and footer to the image. By the new image format, we can freely distinguish and define different image reading ways.

The format of the image is as follows:

```
/**
 * Image Format:
 * |- Image --------------------------------------|
 * | - Magic String (4 bytes)                     |
 * | - Header Length (4 bytes)                    |
 * | |- Header -----------------------------|     |
 * | | |- Json Header ---------------|      |     |
 * | | | - version                   |      |     |
 * | | | - other key/value(undecided)|      |     |
 * | | |-----------------------------|      |     |
 * | |--------------------------------------|     |
 * |                                              |
 * | |- Image Body -------------------------|     |
 * | | Object a                             |     |
 * | | Object b                             |     |
 * | | ...                                  |     |
 * | |--------------------------------------|     |
 * |                                              |
 * | |- Footer -----------------------------|     |
 * | | | - Checksum (8 bytes)               |     |
 * | | |- object index --------------|      |     |
 * | | | - index a                   |      |     |
 * | | | - index b                   |      |     |
 * | | | ...                         |      |     |
 * | | |-----------------------------|      |     |
 * | | - other value(undecided)             |     |
 * | |--------------------------------------|     |
 * | - Footer Length (8 bytes)                    |
 * | - Magic String (4 bytes)                     |
 * |----------------------------------------------|
 */
```
1. Magic Number
One image format is identified by one magic string and one version field. The magic string is save in the first 4 bytes and last 4 bytes in the images.

2. Image Header:
The version is save in the header with json format now.

3. Image Body:
Equal to the original image.

4.Image Footer:
Image footer stores the file offset(index) of many image objects. If necessary, we can read some objects in the image by the footer.
2021-07-27 13:36:53 +08:00
88a96d68cd [Sample] Doris developers quickly use the development sample code framework, (#6301)
The main purpose of this project is to let doris use development, which can get started quickly,
and give sample codes for the use of various new functions as a reference.
Submit the framework first, and the code will be submitted one after another

Doris developers quickly use the development sample code framework, and the code is submitted one after another
2021-07-26 10:16:48 +08:00
e3db773149 [UT] Fix MaterializedViewFunctionTest run failed (#6294)
Co-authored-by: caiconghui <caiconghui@xiaomi.com>
2021-07-26 09:42:39 +08:00
4c0fdd2800 [Bug] Fix core dump in BloomFilter while build Runtime Filter right table string column contains null (#6305)
when right table has null value in string column, runtime filter may coredump
```
select count(*) from baseall t1 join test t2 where t1.k7 = t2.k7;
```
2021-07-26 09:41:41 +08:00
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