Commit Graph

104 Commits

Author SHA1 Message Date
be89f0f77e [feat-opt](routine-load) Support show offset lag in show routine load stmt (#7114)
Add a new field `Lag` in result of `show routine load` stmt.

`Lag: {"0":10, "1":0}` means kafka partition 0 has 10 msg behind and partition 1 is update-to-date.
2021-11-18 14:31:16 +08:00
5b01f7bba2 [Feature] Support query hive table (#6569)
Users can directly query the data in the hive table in Doris, and can use join to perform complex queries without laboriously importing data from hive.

Main changes list below:

FE:

Extend HiveScanNode from BrokerScanNode
HiveMetaStoreClientHelper communicate with HIVE and HDFS.
BE:
Treate HiveScanNode as BrokerScanNode, treate HiveTable as BrokerTable.

broker_scanner.cpp: suppot read column from HDFS path.
orc_scanner.cpp: support read hdfs file.
POM:

Add hive.version=2.3.7, hive-metastore and hive-exec
Add hadoop.version=2.8.0, hadoop-hdfs
Upgrade commons-lang to fix incompatiblity of Java 9 and later.
Thrift:

Add THiveTable
Add read_by_column_def in TBrokerRangeDesc
2021-11-16 11:59:07 +08:00
d4c0156e0f [Doc] REPLACE_IF_NOT_NULL document modification (#7100)
REPLACE_IF_NOT_NULL document modification
2021-11-13 17:11:20 +08:00
3d8166504a [Alter] Support alter table engine type from MySQL to ODBC (#6993)
Support alter table engine type from MySQL to ODBC:

```
ALTER TABLE tbl MODIFY ENGINE TO odbc PROPERTIES("driver" = "odbc");
```
2021-11-12 15:12:41 +08:00
3267455eca Replace replica_allocation to replication_allocation (#6870)
Fix #6869
2021-10-20 15:32:35 +08:00
bd25d1a828 [Doc] Add documents for MySQL Binlog Load (#6859)
* add zh-CN docs

* add en docs and image

* fix

* fix
2021-10-19 10:25:42 +08:00
bb2b29c64f [Doc] Add type BOOLEAN when enter 'help create table' in mysql client (#6852)
some user do not know Doris support type boolean, they use TINYINT,
so i add type BOOLEAN when enter 'help create table' in mysql client.

currently, type BOOLEAN size is 1 byte, but the value of boolean column only in {0,1} ,
which waste some memory, and i want change it's implement to 1 bit in the future.
2021-10-17 22:54:12 +08:00
fcd15edbf9 [Export] Support export job with label (#6835)
```
EXPORT TABLE xxx
...
PROPERTIES
(
    "label" = "mylabel",
    ...
);
```

And than user can use label to get the info by SHOW EXPORT stmt:
```
show export from db where label="mylabel";
```

For compatibility, if not specified, a random label will be used. And for history jobs, the label will be "export_job_id";

Not like LOAD stmt, here we specify label in `properties` because this will not cause grammatical conflicts,
and there is no need to modify the meta version of the metadata.
2021-10-15 10:18:11 +08:00
675aef7d75 [AliasFunction] Add support for cast in alias function (#6754)
support #6753
2021-10-10 23:05:44 +08:00
7a20d6d4c2 [Doc] Modify document of resource tag (#6778)
Fix typo
2021-10-03 11:37:45 +08:00
e7707c8180 [FOLLOWUP] create table like clause support copy rollup (#6580)
* Remove `ALL` key word to make grammar more clear.

Co-authored-by: qzsee <shizhiqiang03@meituan.com>
2021-09-30 18:26:21 +08:00
cdf9f9e980 [Dynamic Partition] reserve specific history periods by dynamic partition. (#6554)
Add RESERVED_HISTORY_STARTS and RESERVED_HISTORY_ENDS.
Fixes #6514
2021-09-28 11:39:35 +08:00
982b76c3c0 [Bug] Fix resource tag bug, add documents and some other bug fix (#6708)
1. Fix bug of UNKNOWN Operation Type 91
2. Support using resource_tag property of user to limit the usage of BE
3. Add new FE config `disable_tablet_scheduler` to disable tablet scheduler.
4. Add documents for resource tag.
5. Modify the default value of FE config `default_db_data_quota_bytes` to 1PB.
6. Add a new BE config `disable_compaction_trace_log` to disable the trace log of compaction time cost.
7. Modify the default value of BE config `remote_storage_read_buffer_mb` to 16MB
8. Fix `show backends` results error
9. Add new BE config `external_table_connect_timeout_sec` to set the timeout when connecting to odbc and mysql table.
10. Modify issue template to enable blank issue, for release note or other specific usage.
11. Fix a bug in alpha_row_set split_range() function.
2021-09-28 10:37:42 +08:00
a949dcd9f6 [Feature] Create table like clause support copy rollup (#6475)
for issue #6474

```sql
create table test.table1 like test.table with rollup r1,r2 -- copy some rollup

create table test.table1 like test.table with rollup all -- copy all rollup

create table test.table1 like test.table  -- only copy base table
```
2021-08-31 20:33:26 +08:00
0393c9b3b9 [Optimize] Support send batch parallelism for olap table sink (#6397)
* Support send batch parallelism for olap table sink

Co-authored-by: caiconghui <caiconghui@xiaomi.com>
2021-08-30 11:03:09 +08:00
3f2fdd236f Add scan thread token (#6443) 2021-08-27 10:56:17 +08:00
8738ce380b Add long text type STRING, with a maximum length of 2GB. Usage is similar to varchar, and there is no guarantee for the performance of storing extremely long data (#6391) 2021-08-18 09:05:40 +08:00
4be06a470f fix typo: dynamic_partitoin -> dynamic_partition (#6445) 2021-08-16 09:17:57 +08:00
Pxl
8a267f1ac5 [Feature] Support for cleaning the trash actively (#6323) 2021-08-12 10:07:51 +08:00
708b6c529e [RoutineLoad] Support pause or resume all routine load jobs (#6394)
1. PAUSE ALL ROUTINE LOAD;
2. RESUME ALL ROUTINE LOAD;
2021-08-11 16:38:06 +08:00
7e93405df3 [Alter] Support alter table and column's comment (#6387)
1. alter table tbl1 modify comment "new comment";
2. alter table tbl1 modify column k1 comment "k1", modify column v1 comment "v1";
2021-08-11 16:37:42 +08:00
Pxl
236e0f1eda [Feature] Support for querying the trash used capacity (#6247)
Support for querying the trash used capacity.

```
SHOW TRASH [ON ...]
```

Now user can proactively scan trash directory.
2021-08-10 10:10:47 +08:00
70825ce846 [Feature] Support alias function (#6261)
Implement #6260.

Add alias function type.
2021-08-07 21:29:13 +08:00
2823e4daba [Feature] Support SHOW DATA SKEW stmt (#6219)
SHOW DATA SKEW FROM tbl PARTITION(p1)

to view the data distribution of a specified partition

```
mysql> admin show data skew from tbl1 partition(tbl1);
+-----------+-------------+-------+---------+
| BucketIdx | AvgDataSize | Graph | Percent |
+-----------+-------------+-------+---------+
| 0         | 0           |       | 100.00% |
+-----------+-------------+-------+---------+
1 row in set (0.01 sec)
```

Also modify the result of `admin show replica distribution`, add replica size distribution

```
mysql> admin show replica distribution from tbl1 partition(tbl1);
+-----------+------------+-------------+----------+------------+-----------+-------------+
| BackendId | ReplicaNum | ReplicaSize | NumGraph | NumPercent | SizeGraph | SizePercent |
+-----------+------------+-------------+----------+------------+-----------+-------------+
| 10002     | 1          | 0           | >        | 100.00%    |           | 100.00%     |
+-----------+------------+-------------+----------+------------+-----------+-------------+
```
2021-08-05 14:05:41 +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
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
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
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
5de79ec3f0 [Feature] Support data encrypt/decrypt (#6115)
Add support for data encryption/decryption.
2021-07-19 09:27:08 +08:00
7c34dbbc5b [Bug-Fix] Fix bug that show view report "Unresolved table reference" error (#6184) 2021-07-15 10:55:15 +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
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
01bef4b40d [Load] Add "LOAD WITH HDFS" model, and make hdfs_reader support hdfs ha (#6161)
Support load data from HDFS by using `LOAD WITH HDFS` syntax and read data directly via libhdfs3
2021-07-10 10:11:52 +08:00
65892cec3b [Bug] Create dynamic partition table failed with enable create_history_partition and not specify the start value (#6129)
fix the issue #5995
Add the property "dynamic_partition.history_partition_num" to specify the history partition number when enable create_history_partition to fix the invalid date format value
and add these two properties to docs
2021-07-10 10:10:28 +08:00
d6e6c7815b [Feature] ADD: show create routine load (#6110)
Add show create routine load
2021-07-04 21:43:25 +08:00
Pxl
bdafb61ae1 [Docs] Typo fix on CREATE TABLE.md (#6126) 2021-07-01 09:20:12 +08:00
d9c128b744 [BrokerLoad] Support read properties for broker load when read data (#5845)
* [BrokerLoad] support read properties for broker load when read data

Co-authored-by: caiconghui <caiconghui@xiaomi.com>
2021-06-09 14:59:55 +08:00
a29dd42b47 [BUG][Document] Fix the bug that failed to build the help module (#5917)
There are multiple entries with same key in help documents, which will cause build help module failed.
2021-05-27 22:07:15 +08:00
3cb0174aa2 [Doc] Fix demo in 'CREATE TABLE' (#5865) 2021-05-27 22:03:51 +08:00
ba69f7a7c8 [Command] [SQL] Add show database/table/partition id command (#5807)
In BE, when a problem happened, in the log, we can find the database id, table id, partition id,
but no database name, table name, partition name.

In FE, there also no way to find database name/table name/partition name accourding to
database id/table id/partition id. Therefore, this patch add 3 new commands:

1. show database id;
mysql> show database 10002;
+----------------------+
| DbName               |
+----------------------+
| default_cluster:test |
+----------------------+

2. show table id;
mysql> show table 11100;
+----------------------+-----------+-------+
| DbName               | TableName | DbId  |
+----------------------+-----------+-------+
| default_cluster:test | table2    | 10002 |
+----------------------+-----------+-------+

3. show partition id;
mysql> show partition 11099;
+----------------------+-----------+---------------+-------+---------+
| DbName               | TableName | PartitionName | DbId  | TableId |
+----------------------+-----------+---------------+-------+---------+
| default_cluster:test | table2    | p201708       | 10002 | 11100   |
+----------------------+-----------+---------------+-------+---------+
2021-05-26 09:58:02 +08:00
a55b12da90 [Doc] Fix some flaws in hll-type document (#5795)
Fix some flaws in hll-type document.
2021-05-26 09:56:55 +08:00
07ad038870 [Feature][RoutineLoad] Support for consuming kafka from the point of time (#5832)
Support when creating a kafka routine load, start consumption from a specified point in time instead of a specific offset.
eg:
```
FROM KAFKA
(
    "kafka_broker_list" = "broker1:9092,broker2:9092",
    "kafka_topic" = "my_topic",
    "property.kafka_default_offsets" = "2021-10-10 11:00:00"
);

or

FROM KAFKA
(
    "kafka_broker_list" = "broker1:9092,broker2:9092",
    "kafka_topic" = "my_topic",
    "kafka_partitions" = "0,1,2",
    "kafka_offsets" = "2021-10-10 11:00:00, 2021-10-10 11:00:00, 2021-10-10 12:00:00"
);
```

This PR also reconstructed the analysis method of properties when creating or altering
routine load jobs, and unified the analysis process in the `RoutineLoadDataSourceProperties` class.
2021-05-22 23:37:53 +08:00
12e4ff2689 [Doc] Fix doc for 'SHOW EXPORT' (#5840) 2021-05-19 09:31:57 +08:00
9eacd0a89c [Doc] remove storage_type from docs (#5814) 2021-05-19 09:29:15 +08:00
bf4443578c [Feature] Support show view statement for table (#5813)
Help to find all views which contain the given table
2021-05-19 09:29:00 +08:00
65ff464e3d [Feature] Support show data order by (#5770)
Currently, the `show data` does not support sorting. When the number of tables increases, it is inconvenient to manage. Need to support sorting

like:
```
mysql>  show data order by ReplicaCount desc,Size asc;
+-----------+-------------+--------------+
| TableName | Size        | ReplicaCount |
+-----------+-------------+--------------+
| table_c   | 3.102 KB    | 40           |
| table_d   | .000        | 20           |
| table_b   | 324.000 B   | 20           |
| table_a   | 1.266 KB    | 10           |
| Total     | 4.684 KB    | 90           |
| Quota     | 1024.000 GB | 1073741824   |
| Left      | 1024.000 GB | 1073741734   |
+-----------+-------------+--------------+
```
2021-05-19 09:27:27 +08:00
add8c4bb74 [Load] Support reading multi-line json objects for JsonScanner (#5774)
Co-authored-by: caiconghui <caiconghui@xiaomi.com>
2021-05-18 15:44:45 +08:00
3fdfe0ba6f [Bug-fix] Export specified column (#5759)
The code logic error causes the user to specify the export column, which may not be effective.
The PR fix this problem.
2021-05-08 10:56:45 +08:00
507664a44d fix spelling mistake in alter table doc (#5723)
Co-authored-by: weizuo <weizuo@xiaomi.com>
2021-04-30 10:12:50 +08:00
9001fd28f4 support show stream load sql (#5488)
Co-authored-by: weizuo <weizuo@xiaomi.com>
2021-04-29 09:20:35 +08:00