Commit Graph

3243 Commits

Author SHA1 Message Date
e57419fc9e [feature](nereids) Date add and Date sub related functions (#14753)
## date_add series
- DATE_ADD
- DAYS_ADD
- ADDDATE
- TIMESTAMPADD

## date_sub series
- DATE_SUB
- DAYS_SUB
- SUBDATE

## NOTE
1. For DAYS_XXX, time unit is omissible, by default the time unit is DAY
2. no TIMESTAMPSUB
2022-12-12 21:34:30 +08:00
9886fcbc62 [ehancement](nereids) Waits read lock up to 1 minute (#15012) 2022-12-12 20:32:26 +08:00
b5c0d4870d [fix](nereids)fix bug of elt and sub_replace function (#14971) 2022-12-12 17:37:36 +08:00
33bd9eb85e [fix](nereids) Support syntax of nested CTE (#14962) 2022-12-12 17:03:44 +08:00
0a16f11435 [enhancement](Nereids) add RelationId to unboundRelation (#14693)
add RelationId to unboundRelation and refactor some ut used RelationUtil to allocate next RelationId.
2022-12-12 16:24:08 +08:00
5d1051f8d0 [enhancement](function) Remove useless functions in fe (#14837) 2022-12-12 11:26:36 +08:00
9e0e376a72 [fix](Nereids): fix push filter through outer join in ReorderJoinRule. (#14952) 2022-12-12 00:38:21 +08:00
5fe5f596f2 [fix](nereids) non-slotreference expr in order by lead to plan failed (#14895) 2022-12-12 00:08:05 +08:00
c4a1f4816c [ehancement](nereids) read lock table when analyze and generate query plan (#14733) 2022-12-11 23:25:19 +08:00
4c6458108c [fix](fe-meta) NPE in DataProperty when upgrading to 1.2.x (#14976) 2022-12-10 18:46:08 +08:00
181aadd5d3 [fix](information_schema) fix messy code of CHECK_TIME column of informatio_schema.tables (#14915) 2022-12-10 18:45:25 +08:00
6f9afbd74f [fix](Nereids): just allow crossjoin empty condition. (#14893) 2022-12-10 15:32:49 +08:00
ef1bb9819a [feature-wip](MTMV) Support mapping the partition rule of base table to the materialized view (#14930)
When we create a materialized view for multiple tables, users may not figure out the partition rule for the materialized view, because the query result can be too complex. If the query result doesn't match one of the partition rules, the insertion will fail.

We can resolve this issue by mapping the partition rule of base table to the materialized view. As a result, users don't need specify the partition rules and query results are all valid because they are retrieved from the partitions of the base table.

## Use case

mysql> CREATE TABLE t1 (pk INT NOT NULL, v1 INT SUM) PARTITION BY RANGE(pk) (
    ->   PARTITION p1 VALUES LESS THAN ('10'),
    ->   PARTITION p2 VALUES LESS THAN ('90')
    -> )
    -> DISTRIBUTED BY HASH(pk)
    -> PROPERTIES ('replication_num' = '1');
Query OK, 0 rows affected (0.04 sec)

mysql> CREATE TABLE t2 (pk INT NOT NULL, v2 INT SUM) PARTITION BY LIST(pk) (
    ->   PARTITION odd VALUES IN ('10', '30', '50', '70', '90'),
    ->   PARTITION even VALUES IN ('20', '40', '60', '80')
    -> )
    -> DISTRIBUTED BY HASH(pk)
    -> PROPERTIES ('replication_num' = '1');
Query OK, 0 rows affected (0.02 sec)

mysql> CREATE MATERIALIZED VIEW mv BUILD IMMEDIATE REFRESH COMPLETE
    -> KEY (mpk) PARTITION BY (t1.pk) DISTRIBUTED BY HASH(mpk) PROPERTIES ('replication_num' = '1')
    -> AS SELECT t1.pk AS mpk, v1, v2 FROM t1, t2 WHERE t1.pk = t2.pk;
Query OK, 0 rows affected (0.10 sec)

mysql> SHOW CREATE TABLE mv;
+-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Materialized View | Create Materialized View                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
+-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| mv                | CREATE MATERIALIZED VIEW `mv`
BUILD IMMEDIATE REFRESH COMPLETE ON DEMAND
KEY(`mpk`)
PARTITION BY RANGE(`mpk`)
(PARTITION p1 VALUES [("-2147483648"), ("10")),
PARTITION p2 VALUES [("10"), ("90")))
DISTRIBUTED BY HASH(`mpk`) BUCKETS 10
PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"in_memory" = "false",
"storage_format" = "V2",
"disable_auto_compaction" = "false"
)
AS SELECT `t1`.`pk` AS `mpk`, `v1` AS `v1`, `v2` AS `v2` FROM `default_cluster:dev`.`t1` , `default_cluster:dev`.`t2` WHERE `t1`.`pk` = `t2`.`pk`; |
+-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
2022-12-09 22:47:21 +08:00
f5aa5c1d01 [fix](statistics) Fix NPE when update analysis job status #14892 2022-12-09 21:12:36 +08:00
9d96242242 [typo](docs)optimize the FE config document (#14899)
* optimize the FE config document
2022-12-09 16:04:49 +08:00
93b281b44b [feature](Nereids) support select except syntax (#14851)
Support syntax: select * except(v1, v2) from t;
2022-12-09 15:54:26 +08:00
5768118bfa [Improvement](multi-catalog) add show create catalog stmt (#14938) 2022-12-09 08:56:55 +08:00
1fcf6475cf [improvement](multi-catalog)Support invalid/not invalid option for refresh catalog and db. (#14922)
Current refresh catalog/db operation always invalid all the related cache. In some cases, it is not necessary,
for example, create a new db in external data source. This pr is to support refresh without invalidate cache.

refresh catalog hive properties("invalid_cache" = "false");
refresh database hive.db1 properties("invalid_cache" = "false");
2022-12-08 20:38:07 +08:00
e8becaa562 [refactor](resource) unified resource user interface (#14842)
At present, there are multiple user interface to access hdfs and s3.
Each interface has its own configuration and is different, which causes confusion for users.
Create resource already supports remote storage resources and resource permission management,
but only `spark`/`odbc_catalog` are in use.
Cloud  storage resources need to be created and managed uniformly through create resource.

This PR contains the following changes:

1. Add `s3`, `hdfs` and `hms` resource, and each resource contains it's own configuration items, and delete configuration items scattered in other classes.

2. Use `resource` to create `storage` tools, and use `storage` tools to access the remote file system.
2022-12-08 20:37:10 +08:00
c0b764e419 [fix](schemachange) fix the schema change that causes the be core dump. (#14804)
* [fix](schemachange) fix the schema change that causes the be core dump.

Forbid schema change to add or modify the key column of the agg model as double or float.
2022-12-08 17:36:54 +08:00
562fb6db83 [fix](Nereids) event channel dead loop until queue is not empty (#14816) 2022-12-08 15:55:09 +08:00
1887881a61 [feature](Nereids) support push down no group agg to olap scan (#14683)
use zonemap to do aggregate without group by exprs.
valid aggregate function:
- count
- min
- max

implementation in legacy planner: #12881
2022-12-08 15:34:39 +08:00
2fb896d916 [feature](nereids) Support using join syntax (#14784) 2022-12-08 15:22:41 +08:00
Pxl
dbaa02d3a0 [Pipeline](fix) fix enable_pipeline_engine variable not work (#14909) 2022-12-08 14:52:52 +08:00
e62cc2ce76 [minor](typo) Fix typo (#14903) 2022-12-08 10:50:45 +08:00
27c8147a2b [fix](multi-catalog) use last used database for catalog when switch back (#14793)
remember last used database of every catalog and use it when switch back
2022-12-08 10:32:30 +08:00
962810b973 [Vectorized](jdbc) add check type for jdbc table (#14501) 2022-12-08 10:27:47 +08:00
56cc777087 [fix] 'SHOW ROLES' statement does not display resource privilege (#14812) (#14897) 2022-12-08 10:22:09 +08:00
167a20a03b [Minor](Planner): remove redundant SessionVariable (#14818) 2022-12-08 08:33:07 +08:00
6d6de0d408 [fix](multi-catalog) check new catalog name is used or not before rename (#14891) 2022-12-07 21:54:44 +08:00
0bc6f91c3a [Improvement](multi catalog)Add comment to external hms table show create table output. (#14861)
The output of show create table comment for hms external table doesn't contain comment section.
This pr is to add the comment to the output.
2022-12-07 21:12:30 +08:00
dfb02a7104 [refactor](statistics) Remove deprecated statistics related codes (#14797) 2022-12-07 20:41:00 +08:00
a3095e29d5 [fix](nereids)translate is not null predicate mistake (#14866)
the 'is not null' predicate is not translated correctly in ExpressionTranslator
2022-12-07 20:14:13 +08:00
ec2539e2a3 [chore](macOS) Resolve the issue with missing python program (#14864) 2022-12-07 15:30:12 +08:00
Pxl
48a9166aa4 [Pipeline](sink) support olap table sink operator (#14872)
* support olap table sink operator

* update config
2022-12-07 15:29:56 +08:00
6b5e10c8be [fix](agg)having clause should use alias if there is no group by clause (#14831) 2022-12-07 14:13:17 +08:00
wxy
ad6a356a84 [fix](audit) fix duplicate audit log. (#14246)
fix duplicate audit log.
2022-12-07 13:54:21 +08:00
9d2cb133f2 [fix](jdbc) fix logger error of statusLogger unrecognized (#14854)
* [fix](jdbc) fix logger error of statusLogger unrecognized

* update
2022-12-07 11:43:05 +08:00
9e51e0263d [fix](memory leak) Fix load fragment QueryFragmentsCtx is not destroyed (#14840) 2022-12-07 08:45:53 +08:00
1304185adb [Regression](Fix) fix the regression of pipeline and ConcurrentModificationException failed (#14849)
* [fix](ut) try to fix ConcurrentModifycationException bug

* [Regression](Fix) fix the regression of pipeline and ConcurrentModificationException failed

Co-authored-by: morningman <morningman@163.com>
2022-12-06 15:34:32 +08:00
3e911a05b1 [fix](fe)fix select from temporary partition bug (#14809) 2022-12-06 14:32:35 +08:00
fb78807430 [Exec](Profile) Register to Fetch Result time and Write Result time in FE to debug (#14832) 2022-12-06 14:32:18 +08:00
e578e2cd98 [Enhancement](Nereids) Explain display extra information (#14802)
# Proposed changes

Issue Number: close #14554

## Problem summary

1. provide a function **Plan.extraPlans** that returns extra plans, eg: LogicalSubQueryAlias in LogicalCTE.
2. combine the extra plans and the children in the AbstractPlan.treeString(), distinguished by the * at the beginning.
```
========== PARSED PLAN ==========
LogicalCTE ( aliasQueries=[LogicalSubQueryAlias ( alias=s )] )
|-*LogicalSubQueryAlias ( alias=s )
|  +--LogicalProject ( projects=['s_suppkey] )
|     +--LogicalFilter ( predicates=('s_suppkey = '') )
|        +--LogicalCheckPolicy ( child=UnboundRelation ( nameParts=supplier ) )
|           +--UnboundRelation ( nameParts=supplier )
+--LogicalProject ( projects=[*] )
   +--LogicalJoin ( type=CROSS_JOIN, hashJoinConjuncts=[], otherJoinConjuncts=[] )
      |--LogicalSubQueryAlias ( alias=t1 )
      |  +--LogicalCheckPolicy ( child=UnboundRelation ( nameParts=s ) )
      |     +--UnboundRelation ( nameParts=s )
      +--LogicalSubQueryAlias ( alias=t2 )
         +--LogicalCheckPolicy ( child=UnboundRelation ( nameParts=s ) )
            +--UnboundRelation ( nameParts=s )
```
2022-12-06 12:28:40 +08:00
db4524c10e [Bug](date function) Fix date_add function (#14826) 2022-12-05 20:34:20 +08:00
ed96442b85 [fix](multi-catalog) fix persist issue about jdbc catalog and class loader issue #14794
Fix a bug that JDBC catalog/database/table should be add to GsonUtil

Fix a class loader issue that sometime it will cause ClassNotFoundException

Fix regression test to use different catalog name.

Comment out 2 regression tests:

regression-test/suites/query_p0/system/test_query_sys.groovy
regression-test/suites/statistics/alter_col_stats.groovy
Need to be fixed later
2022-12-05 09:05:13 +08:00
5be8f9432e [fix](DOE) Support ES index which contains dynamic_templates (#14762)
Support ES index with dynamic_templates. And do not support index mapping without explicit mapping.
2022-12-05 08:33:51 +08:00
852b03729f [Improvement](meta)add IsCurrent column in show catalogs result #14700
When a user has multiple catalogs and switch several times, he may forget which catalog is using. So I add a iscurrent column in show catalogs result for help.

mysql> show catalogs;
+-----------+-------------+----------+-----------+
| CatalogId | CatalogName | Type | IsCurrent |
+-----------+-------------+----------+-----------+
| 136591 | es | es | |
| 130100 | hive | hms | yes |
| 0 | internal | internal | |
+-----------+-------------+----------+-----------+
2022-12-05 08:32:16 +08:00
ce95da8dfb [improvement](multi-catalog) support specify hadoop username (#14734)
Support setting "hadoop.username" property when creating hms catalog.
2022-12-04 21:09:39 +08:00
97dcd2b13a [feature](nereids) merge proj-proj in post process (#14730)
* merge proj-proj

* v2this pr guarantees that the physical plan does not contains consecutive physical projects.
Like rewrite rule "merge projects", it works on physical plan, not logical plan.

* move merge-proj code into Project.java
2022-12-03 23:41:02 +08:00
283b23f6da [fix](planner) wrong results when select from view which has with clause (#14747) 2022-12-02 18:10:52 +08:00