[WIP][feature] support create,alter,refresh,drop stmt syntax for multi table materialized view (#11218)
* [WIP][feature] support `create`,`alter`,`refresh`,`drop` stmt for multi table materialized view
This commit is contained in:
@ -240,25 +240,25 @@ parser code {:
|
||||
|
||||
// Total keywords of doris
|
||||
terminal String KW_ADD, KW_ADMIN, KW_AFTER, KW_AGGREGATE, KW_ALIAS, KW_ALL, KW_ALTER, KW_AND, KW_ANTI, KW_APPEND, KW_AS, KW_ASC, KW_AUTHORS, KW_ARRAY,
|
||||
KW_BACKEND, KW_BACKUP, KW_BETWEEN, KW_BEGIN, KW_BIGINT, KW_BINLOG, KW_BITMAP, KW_BITMAP_UNION, KW_QUANTILE_STATE, KW_QUANTILE_UNION, KW_BLOB, KW_BOOLEAN, KW_BROKER, KW_BACKENDS, KW_BY, KW_BUILTIN,
|
||||
KW_BACKEND, KW_BACKUP, KW_BETWEEN, KW_BEGIN, KW_BIGINT, KW_BINLOG, KW_BITMAP, KW_BITMAP_UNION, KW_QUANTILE_STATE, KW_QUANTILE_UNION, KW_BLOB, KW_BOOLEAN, KW_BROKER, KW_BACKENDS, KW_BY, KW_BUILD, KW_BUILTIN,
|
||||
KW_CANCEL, KW_CASE, KW_CAST, KW_CHAIN, KW_CHAR, KW_CHARSET, KW_CHECK, KW_CLUSTER, KW_CLUSTERS, KW_CLEAN, KW_CURRENT_TIMESTAMP,
|
||||
KW_COLLATE, KW_COLLATION, KW_COLUMN, KW_COLUMNS, KW_COMMENT, KW_COMMIT, KW_COMMITTED, KW_COMPACT,
|
||||
KW_COLLATE, KW_COLLATION, KW_COLUMN, KW_COLUMNS, KW_COMMENT, KW_COMMIT, KW_COMMITTED, KW_COMPACT, KW_COMPLETE,
|
||||
KW_CONFIG, KW_CONNECTION, KW_CONNECTION_ID, KW_CONSISTENT, KW_CONVERT, KW_COUNT, KW_CREATE, KW_CREATION, KW_CROSS, KW_CUBE, KW_CURRENT, KW_CURRENT_USER,
|
||||
KW_DATA, KW_DATABASE, KW_DATABASES, KW_DATE, KW_DATETIME, KW_DATEV2, KW_DATETIMEV2, KW_DAY, KW_DECIMAL, KW_DECIMALV3, KW_DECOMMISSION, KW_DEFAULT, KW_DESC, KW_DESCRIBE,
|
||||
KW_DATA, KW_DATABASE, KW_DATABASES, KW_DATE, KW_DATETIME, KW_DATEV2, KW_DATETIMEV2, KW_DAY, KW_DECIMAL, KW_DECIMALV3, KW_DECOMMISSION, KW_DEFAULT, KW_DEFERRED, KW_DEMAND, KW_DESC, KW_DESCRIBE,
|
||||
KW_DELETE, KW_UPDATE, KW_DIAGNOSE, KW_DISK, KW_DISTINCT, KW_DISTINCTPC, KW_DISTINCTPCSA, KW_DISTRIBUTED, KW_DISTRIBUTION, KW_DYNAMIC, KW_BUCKETS, KW_DIV, KW_DOUBLE, KW_DROP, KW_DROPP, KW_DUPLICATE,
|
||||
KW_ELSE, KW_ENABLE, KW_ENCRYPTKEY, KW_ENCRYPTKEYS, KW_END, KW_ENGINE, KW_ENGINES, KW_ENTER, KW_ERRORS, KW_EVENTS, KW_EXCEPT, KW_EXCLUDE,
|
||||
KW_EXISTS, KW_EXPORT, KW_EXTENDED, KW_EXTERNAL, KW_EXTRACT,
|
||||
KW_FALSE, KW_FEATURE, KW_FOLLOWER, KW_FOLLOWING, KW_FREE, KW_FROM, KW_FIELDS, KW_FILE, KW_FILTER, KW_FIRST, KW_FLOAT, KW_FOR, KW_FORCE, KW_FORMAT, KW_FRONTEND, KW_FRONTENDS, KW_FULL, KW_FUNCTION, KW_FUNCTIONS,
|
||||
KW_FAST, KW_FALSE, KW_FEATURE, KW_FOLLOWER, KW_FOLLOWING, KW_FREE, KW_FROM, KW_FIELDS, KW_FILE, KW_FILTER, KW_FIRST, KW_FLOAT, KW_FOR, KW_FORCE, KW_FORMAT, KW_FRONTEND, KW_FRONTENDS, KW_FULL, KW_FUNCTION, KW_FUNCTIONS,
|
||||
KW_GLOBAL, KW_GRANT, KW_GRANTS, KW_GRAPH, KW_GROUP, KW_GROUPING,
|
||||
KW_HASH, KW_HAVING, KW_HDFS, KW_HELP,KW_HLL, KW_HLL_UNION, KW_HOUR, KW_HUB,
|
||||
KW_IDENTIFIED, KW_IF, KW_IN, KW_INDEX, KW_INDEXES, KW_INFILE, KW_INSTALL,
|
||||
KW_IDENTIFIED, KW_IF, KW_IMMEDIATE, KW_IN, KW_INDEX, KW_INDEXES, KW_INFILE, KW_INSTALL,
|
||||
KW_INNER, KW_INSERT, KW_INT, KW_INTERMEDIATE, KW_INTERSECT, KW_INTERVAL, KW_INTO, KW_IS, KW_ISNULL, KW_ISOLATION,
|
||||
KW_JOB, KW_JOIN,
|
||||
KW_KEY, KW_KEYS, KW_KILL,
|
||||
KW_LABEL, KW_LARGEINT, KW_LAST, KW_LEFT, KW_LESS, KW_LEVEL, KW_LIKE, KW_LIMIT, KW_LINK, KW_LIST, KW_LOAD,
|
||||
KW_LOCAL, KW_LOCATION, KW_LOCK, KW_LOW_PRIORITY, KW_LATERAL,
|
||||
KW_MAP, KW_MATERIALIZED, KW_MAX, KW_MAX_VALUE, KW_MERGE, KW_MIN, KW_MINUTE, KW_MINUS, KW_MIGRATE, KW_MIGRATIONS, KW_MODIFY, KW_MONTH,
|
||||
KW_NAME, KW_NAMES, KW_NEGATIVE, KW_NO, KW_NOT, KW_NULL, KW_NULLS,
|
||||
KW_NAME, KW_NAMES, KW_NEGATIVE, KW_NEVER, KW_NEXT, KW_NO, KW_NOT, KW_NULL, KW_NULLS,
|
||||
KW_OBSERVER, KW_OFFSET, KW_ON, KW_ONLY, KW_OPEN, KW_OR, KW_ORDER, KW_OUTER, KW_OUTFILE, KW_OVER,
|
||||
KW_PARAMETER, KW_PARTITION, KW_PARTITIONS, KW_PASSWORD, KW_LDAP_ADMIN_PASSWORD, KW_PATH, KW_PAUSE, KW_PIPE, KW_PRECEDING,
|
||||
KW_PLUGIN, KW_PLUGINS, KW_POLICY,
|
||||
@ -537,6 +537,12 @@ nonterminal StorageBackend storage_backend;
|
||||
nonterminal ArrayList<LockTable> opt_lock_tables_list;
|
||||
nonterminal LockTable lock_table;
|
||||
|
||||
// mv
|
||||
nonterminal MVRefreshInfo.BuildMode build_mv;
|
||||
nonterminal MVRefreshInfo.RefreshMethod opt_refresh_method;
|
||||
nonterminal MVRefreshTriggerInfo opt_refresh_trigger;
|
||||
nonterminal MVRefreshInfo opt_mv_refersh_info;
|
||||
|
||||
precedence nonassoc COMMA;
|
||||
precedence nonassoc STRING_LITERAL;
|
||||
precedence nonassoc KW_COLUMNS;
|
||||
@ -794,6 +800,14 @@ refresh_stmt ::=
|
||||
{:
|
||||
RESULT = new RefreshDbStmt(db);
|
||||
:}
|
||||
| KW_REFRESH KW_MATERIALIZED KW_VIEW table_name:mv
|
||||
{:
|
||||
RESULT = new RefreshMaterializedViewStmt(mv, MVRefreshInfo.RefreshMethod.COMPLETE);
|
||||
:}
|
||||
| KW_REFRESH KW_MATERIALIZED KW_VIEW table_name:mv KW_COMPLETE
|
||||
{:
|
||||
RESULT = new RefreshMaterializedViewStmt(mv, MVRefreshInfo.RefreshMethod.COMPLETE);
|
||||
:}
|
||||
;
|
||||
|
||||
clean_stmt ::=
|
||||
@ -923,6 +937,10 @@ alter_stmt ::=
|
||||
{:
|
||||
RESULT = new AlterPolicyStmt(policyName, properties);
|
||||
:}
|
||||
| KW_ALTER KW_MATERIALIZED KW_VIEW table_name:mv opt_mv_refersh_info:refreshInfo
|
||||
{:
|
||||
RESULT = new AlterMaterializedViewStmt(mv, refreshInfo);
|
||||
:}
|
||||
;
|
||||
|
||||
opt_datasource_properties ::=
|
||||
@ -1246,6 +1264,75 @@ opt_intermediate_type ::=
|
||||
:}
|
||||
;
|
||||
|
||||
build_mv ::=
|
||||
KW_BUILD KW_IMMEDIATE
|
||||
{:
|
||||
RESULT = MVRefreshInfo.BuildMode.IMMEDIATE;
|
||||
:}
|
||||
| KW_BUILD KW_DEFERRED
|
||||
{:
|
||||
RESULT = MVRefreshInfo.BuildMode.DEFERRED;
|
||||
:}
|
||||
;
|
||||
|
||||
opt_refresh_method ::=
|
||||
{:
|
||||
RESULT = null;
|
||||
:}
|
||||
| KW_FAST
|
||||
{:
|
||||
RESULT = MVRefreshInfo.RefreshMethod.FAST;
|
||||
:}
|
||||
| KW_COMPLETE
|
||||
{:
|
||||
RESULT = MVRefreshInfo.RefreshMethod.COMPLETE;
|
||||
:}
|
||||
| KW_FORCE
|
||||
{:
|
||||
RESULT = MVRefreshInfo.RefreshMethod.FORCE;
|
||||
:}
|
||||
;
|
||||
|
||||
opt_refresh_trigger ::=
|
||||
{:
|
||||
RESULT = new MVRefreshTriggerInfo(MVRefreshInfo.RefreshTrigger.DEMAND);
|
||||
:}
|
||||
| KW_ON KW_DEMAND
|
||||
{:
|
||||
RESULT = new MVRefreshTriggerInfo(MVRefreshInfo.RefreshTrigger.DEMAND);
|
||||
:}
|
||||
| KW_ON KW_COMMIT
|
||||
{:
|
||||
RESULT = new MVRefreshTriggerInfo(MVRefreshInfo.RefreshTrigger.COMMIT);
|
||||
:}
|
||||
| KW_START KW_WITH ident:start_time
|
||||
{:
|
||||
RESULT = new MVRefreshTriggerInfo(new MVRefreshIntervalTriggerInfo(start_time, -1, null));
|
||||
:}
|
||||
| KW_START KW_WITH STRING_LITERAL:start_time KW_NEXT INTEGER_LITERAL:interval time_unit:unit
|
||||
{:
|
||||
RESULT = new MVRefreshTriggerInfo(new MVRefreshIntervalTriggerInfo(start_time, interval, unit));
|
||||
:}
|
||||
| KW_NEXT INTEGER_LITERAL:interval time_unit:unit
|
||||
{:
|
||||
RESULT = new MVRefreshTriggerInfo(new MVRefreshIntervalTriggerInfo(null, interval, unit));
|
||||
:}
|
||||
;
|
||||
|
||||
opt_mv_refersh_info ::=
|
||||
{:
|
||||
RESULT = null;
|
||||
:}
|
||||
| KW_REFRESH opt_refresh_method:refreshMethod opt_refresh_trigger:refreshTrigger
|
||||
{:
|
||||
RESULT = new MVRefreshInfo(refreshMethod, refreshTrigger);
|
||||
:}
|
||||
| KW_NEVER KW_REFRESH
|
||||
{:
|
||||
RESULT = new MVRefreshInfo(false);
|
||||
:}
|
||||
;
|
||||
|
||||
// Create Statement
|
||||
create_stmt ::=
|
||||
/* Database */
|
||||
@ -1368,6 +1455,15 @@ create_stmt ::=
|
||||
{:
|
||||
RESULT = new CreateMaterializedViewStmt(mvName, selectStmt, properties);
|
||||
:}
|
||||
| KW_CREATE KW_MATERIALIZED KW_VIEW ident:mvName build_mv:buildMethod
|
||||
opt_mv_refersh_info:refreshInfo
|
||||
opt_partition:partition
|
||||
opt_distribution:distribution
|
||||
opt_properties:tblProperties
|
||||
KW_AS query_stmt:query
|
||||
{:
|
||||
RESULT = new CreateMultiTableMaterializedViewStmt(mvName, buildMethod, refreshInfo, partition, distribution, tblProperties, query);
|
||||
:}
|
||||
| KW_CREATE KW_INDEX opt_if_not_exists:ifNotExists ident:indexName KW_ON table_name:tableName LPAREN ident_list:cols RPAREN opt_index_type:indexType opt_comment:comment
|
||||
{:
|
||||
RESULT = new AlterTableStmt(tableName, Lists.newArrayList(new CreateIndexClause(tableName, new IndexDef(indexName, ifNotExists, cols, indexType, comment), false)));
|
||||
@ -2101,6 +2197,10 @@ drop_stmt ::=
|
||||
{:
|
||||
RESULT = new AlterTableStmt(tableName, Lists.newArrayList(new DropIndexClause(indexName, ifExists, tableName, false)));
|
||||
:}
|
||||
| KW_DROP KW_MATERIALIZED KW_VIEW opt_if_exists:ifExists table_name:mvName
|
||||
{:
|
||||
RESULT = new DropMaterializedViewStmt(ifExists, mvName);
|
||||
:}
|
||||
| KW_DROP KW_MATERIALIZED KW_VIEW opt_if_exists:ifExists ident:mvName KW_ON table_name:tableName
|
||||
{:
|
||||
RESULT = new DropMaterializedViewStmt(ifExists, mvName, tableName);
|
||||
@ -5643,6 +5743,8 @@ keyword ::=
|
||||
{: RESULT = id; :}
|
||||
| KW_BUILTIN:id
|
||||
{: RESULT = id; :}
|
||||
| KW_BUILD:id
|
||||
{: RESULT = id; :}
|
||||
| KW_CHAIN:id
|
||||
{: RESULT = id; :}
|
||||
| KW_CHAR:id
|
||||
@ -5657,6 +5759,8 @@ keyword ::=
|
||||
{: RESULT = id; :}
|
||||
| KW_COMMITTED:id
|
||||
{: RESULT = id; :}
|
||||
| KW_COMPLETE:id
|
||||
{: RESULT = id; :}
|
||||
| KW_CONSISTENT:id
|
||||
{: RESULT = id; :}
|
||||
| KW_COLLATION:id
|
||||
@ -5687,6 +5791,10 @@ keyword ::=
|
||||
{: RESULT = id; :}
|
||||
| KW_DECIMAL:id
|
||||
{: RESULT = id; :}
|
||||
| KW_DEFERRED:id
|
||||
{: RESULT = id; :}
|
||||
| KW_DEMAND:id
|
||||
{: RESULT = id; :}
|
||||
| KW_DECIMALV3:id
|
||||
{: RESULT = id; :}
|
||||
| KW_DIAGNOSE:id
|
||||
@ -5697,6 +5805,8 @@ keyword ::=
|
||||
{: RESULT = id; :}
|
||||
| KW_BUCKETS:id
|
||||
{: RESULT = id; :}
|
||||
| KW_FAST:id
|
||||
{: RESULT = id; :}
|
||||
| KW_FILE:id
|
||||
{: RESULT = id; :}
|
||||
| KW_FIELDS:id
|
||||
@ -5709,6 +5819,8 @@ keyword ::=
|
||||
{: RESULT = id; :}
|
||||
| KW_HLL_UNION:id
|
||||
{: RESULT = id; :}
|
||||
| KW_IMMEDIATE:id
|
||||
{: RESULT = id; :}
|
||||
| KW_PATH:id
|
||||
{: RESULT = id; :}
|
||||
| KW_PROFILE:id
|
||||
@ -5781,6 +5893,10 @@ keyword ::=
|
||||
{: RESULT = id; :}
|
||||
| KW_NEGATIVE:id
|
||||
{: RESULT = id; :}
|
||||
| KW_NEVER:id
|
||||
{: RESULT = id; :}
|
||||
| KW_NEXT:id
|
||||
{: RESULT = id; :}
|
||||
| KW_NO:id
|
||||
{: RESULT = id; :}
|
||||
| KW_NULLS:id
|
||||
|
||||
@ -19,11 +19,13 @@ package org.apache.doris.alter;
|
||||
|
||||
import org.apache.doris.analysis.AddPartitionClause;
|
||||
import org.apache.doris.analysis.AlterClause;
|
||||
import org.apache.doris.analysis.AlterMaterializedViewStmt;
|
||||
import org.apache.doris.analysis.AlterSystemStmt;
|
||||
import org.apache.doris.analysis.AlterTableStmt;
|
||||
import org.apache.doris.analysis.AlterViewStmt;
|
||||
import org.apache.doris.analysis.ColumnRenameClause;
|
||||
import org.apache.doris.analysis.CreateMaterializedViewStmt;
|
||||
import org.apache.doris.analysis.CreateMultiTableMaterializedViewStmt;
|
||||
import org.apache.doris.analysis.DropMaterializedViewStmt;
|
||||
import org.apache.doris.analysis.DropPartitionClause;
|
||||
import org.apache.doris.analysis.ModifyColumnCommentClause;
|
||||
@ -33,6 +35,7 @@ import org.apache.doris.analysis.ModifyPartitionClause;
|
||||
import org.apache.doris.analysis.ModifyTableCommentClause;
|
||||
import org.apache.doris.analysis.ModifyTablePropertiesClause;
|
||||
import org.apache.doris.analysis.PartitionRenameClause;
|
||||
import org.apache.doris.analysis.RefreshMaterializedViewStmt;
|
||||
import org.apache.doris.analysis.ReplacePartitionClause;
|
||||
import org.apache.doris.analysis.ReplaceTableClause;
|
||||
import org.apache.doris.analysis.RollupRenameClause;
|
||||
@ -116,7 +119,15 @@ public class Alter {
|
||||
((MaterializedViewHandler) materializedViewHandler).processCreateMaterializedView(stmt, db, olapTable);
|
||||
}
|
||||
|
||||
public void processCreateMultiTableMaterializedView(CreateMultiTableMaterializedViewStmt stmt)
|
||||
throws AnalysisException {
|
||||
throw new AnalysisException("Create multi table materialized view is unsupported : " + stmt.toSql());
|
||||
}
|
||||
|
||||
public void processDropMaterializedView(DropMaterializedViewStmt stmt) throws DdlException, MetaNotFoundException {
|
||||
if (stmt.getTableName() == null) {
|
||||
throw new DdlException("Drop materialized view without table name is unsupported : " + stmt.toSql());
|
||||
}
|
||||
// check db
|
||||
String dbName = stmt.getTableName().getDb();
|
||||
Database db = Env.getCurrentInternalCatalog().getDbOrDdlException(dbName);
|
||||
@ -127,6 +138,10 @@ public class Alter {
|
||||
((MaterializedViewHandler) materializedViewHandler).processDropMaterializedView(stmt, db, olapTable);
|
||||
}
|
||||
|
||||
public void processRefreshMaterializedView(RefreshMaterializedViewStmt stmt) throws DdlException {
|
||||
throw new DdlException("Refresh materialized view is not implemented: " + stmt.toSql());
|
||||
}
|
||||
|
||||
private boolean processAlterOlapTable(AlterTableStmt stmt, OlapTable olapTable, List<AlterClause> alterClauses,
|
||||
final String clusterName, Database db) throws UserException {
|
||||
if (olapTable.getDataSortInfo() != null
|
||||
@ -451,6 +466,10 @@ public class Alter {
|
||||
}
|
||||
}
|
||||
|
||||
public void processAlterMaterializedView(AlterMaterializedViewStmt stmt) throws UserException {
|
||||
throw new DdlException("ALTER MATERIALIZED VIEW is not implemented: " + stmt.toSql());
|
||||
}
|
||||
|
||||
// entry of processing replace table
|
||||
private void processReplaceTable(Database db, OlapTable origTable, List<AlterClause> alterClauses)
|
||||
throws UserException {
|
||||
|
||||
@ -0,0 +1,55 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.doris.analysis;
|
||||
|
||||
import org.apache.doris.catalog.Env;
|
||||
import org.apache.doris.common.AnalysisException;
|
||||
import org.apache.doris.common.ErrorCode;
|
||||
import org.apache.doris.common.ErrorReport;
|
||||
import org.apache.doris.mysql.privilege.PrivPredicate;
|
||||
import org.apache.doris.qe.ConnectContext;
|
||||
|
||||
public class AlterMaterializedViewStmt extends DdlStmt {
|
||||
private TableName mvName;
|
||||
private MVRefreshInfo info;
|
||||
|
||||
public AlterMaterializedViewStmt(TableName mvName, MVRefreshInfo info) {
|
||||
this.mvName = mvName;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void analyze(Analyzer analyzer) throws AnalysisException {
|
||||
mvName.analyze(analyzer);
|
||||
if (!Env.getCurrentEnv().getAuth().checkTblPriv(ConnectContext.get(), mvName.getDb(), mvName.getTbl(),
|
||||
PrivPredicate.ALTER)) {
|
||||
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, "MATERIALIZED VIEW",
|
||||
ConnectContext.get().getQualifiedUser(),
|
||||
ConnectContext.get().getRemoteIP(),
|
||||
mvName.getDb() + ": " + mvName.getTbl());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toSql() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("ALTER MATERIALIZED VIEW ").append(mvName.toSql()).append(" ").append(info.toString());
|
||||
return sb.toString();
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.doris.analysis;
|
||||
|
||||
import org.apache.doris.common.UserException;
|
||||
import org.apache.doris.common.util.PrintableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class CreateMultiTableMaterializedViewStmt extends DdlStmt {
|
||||
private String mvName;
|
||||
private MVRefreshInfo.BuildMode buildMethod;
|
||||
private MVRefreshInfo refreshInfo;
|
||||
private PartitionDesc partition;
|
||||
private DistributionDesc distribution;
|
||||
private Map<String, String> tblProperties;
|
||||
private QueryStmt queryStmt;
|
||||
|
||||
public CreateMultiTableMaterializedViewStmt(String mvName, MVRefreshInfo.BuildMode buildMethod,
|
||||
MVRefreshInfo refreshInfo, PartitionDesc partition, DistributionDesc distribution,
|
||||
Map<String, String> tblProperties, QueryStmt queryStmt) {
|
||||
this.mvName = mvName;
|
||||
this.buildMethod = buildMethod;
|
||||
this.refreshInfo = refreshInfo;
|
||||
this.partition = partition;
|
||||
this.distribution = distribution;
|
||||
this.tblProperties = tblProperties;
|
||||
this.queryStmt = queryStmt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void analyze(Analyzer analyzer) throws UserException {
|
||||
refreshInfo.analyze(analyzer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toSql() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("CREATE MATERIALIZED VIEW ").append(mvName).append(" BUILD ON ").append(buildMethod.toString());
|
||||
if (refreshInfo != null) {
|
||||
sb.append(" ").append(refreshInfo.toString());
|
||||
}
|
||||
if (partition != null) {
|
||||
sb.append(" ").append(partition.toString());
|
||||
}
|
||||
if (distribution != null) {
|
||||
sb.append(" ").append(distribution.toString());
|
||||
}
|
||||
if (tblProperties != null && !tblProperties.isEmpty()) {
|
||||
sb.append("\nPROPERTIES (");
|
||||
sb.append(new PrintableMap<>(tblProperties, " = ", true, true, true));
|
||||
sb.append(")");
|
||||
}
|
||||
sb.append(" AS ").append(queryStmt.toSql());
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@ -41,6 +41,8 @@ public class DropMaterializedViewStmt extends DdlStmt {
|
||||
|
||||
private String mvName;
|
||||
private TableName tableName;
|
||||
|
||||
private TableName mtmvName;
|
||||
private boolean ifExists;
|
||||
|
||||
public DropMaterializedViewStmt(boolean ifExists, String mvName, TableName tableName) {
|
||||
@ -49,8 +51,20 @@ public class DropMaterializedViewStmt extends DdlStmt {
|
||||
this.ifExists = ifExists;
|
||||
}
|
||||
|
||||
public DropMaterializedViewStmt(boolean ifExists, TableName mvName) {
|
||||
this.mtmvName = mvName;
|
||||
this.ifExists = ifExists;
|
||||
this.tableName = null;
|
||||
}
|
||||
|
||||
public String getMvName() {
|
||||
return mvName;
|
||||
if (tableName != null) {
|
||||
return mvName;
|
||||
} else if (mtmvName != null) {
|
||||
return mtmvName.toString();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public TableName getTableName() {
|
||||
@ -63,6 +77,9 @@ public class DropMaterializedViewStmt extends DdlStmt {
|
||||
|
||||
@Override
|
||||
public void analyze(Analyzer analyzer) throws UserException {
|
||||
if (mtmvName != null && tableName == null) {
|
||||
throw new AnalysisException("Multi table materialized view is not supported now.");
|
||||
}
|
||||
if (Strings.isNullOrEmpty(mvName)) {
|
||||
throw new AnalysisException("The materialized name could not be empty or null.");
|
||||
}
|
||||
@ -84,8 +101,12 @@ public class DropMaterializedViewStmt extends DdlStmt {
|
||||
if (ifExists) {
|
||||
stringBuilder.append("IF EXISTS ");
|
||||
}
|
||||
stringBuilder.append("`").append(mvName).append("` ");
|
||||
stringBuilder.append("ON ").append(tableName.toSql());
|
||||
if (mtmvName != null) {
|
||||
stringBuilder.append(mtmvName.toSql());
|
||||
} else {
|
||||
stringBuilder.append("`").append(mvName).append("` ");
|
||||
stringBuilder.append("ON ").append(tableName.toSql());
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,75 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.doris.analysis;
|
||||
|
||||
import org.apache.doris.common.UserException;
|
||||
|
||||
public class MVRefreshInfo {
|
||||
private final boolean neverRefresh;
|
||||
private RefreshMethod refreshMethod;
|
||||
private MVRefreshTriggerInfo triggerInfo;
|
||||
|
||||
public MVRefreshInfo(boolean neverRefresh) {
|
||||
this.neverRefresh = neverRefresh;
|
||||
if (!neverRefresh) {
|
||||
refreshMethod = RefreshMethod.COMPLETE;
|
||||
triggerInfo = null;
|
||||
}
|
||||
}
|
||||
|
||||
public MVRefreshInfo(RefreshMethod method, MVRefreshTriggerInfo trigger) {
|
||||
this.neverRefresh = false;
|
||||
this.refreshMethod = method;
|
||||
if (!neverRefresh) {
|
||||
refreshMethod = RefreshMethod.COMPLETE;
|
||||
triggerInfo = trigger;
|
||||
}
|
||||
}
|
||||
|
||||
void analyze(Analyzer analyzer) throws UserException {
|
||||
if (triggerInfo != null) {
|
||||
triggerInfo.analyze(analyzer);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (neverRefresh) {
|
||||
sb.append(" NEVER REFRESH ");
|
||||
} else {
|
||||
sb.append(" REFRESH ");
|
||||
sb.append(refreshMethod.toString());
|
||||
sb.append(triggerInfo.toString());
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
enum RefreshMethod {
|
||||
FAST, COMPLETE, FORCE
|
||||
}
|
||||
|
||||
enum RefreshTrigger {
|
||||
DEMAND, COMMIT, INTERVAL
|
||||
}
|
||||
|
||||
enum BuildMode {
|
||||
IMMEDIATE, DEFERRED
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,54 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.doris.analysis;
|
||||
|
||||
public class MVRefreshIntervalTriggerInfo {
|
||||
private String startTime;
|
||||
private long interval;
|
||||
private String timeUnit;
|
||||
|
||||
public MVRefreshIntervalTriggerInfo(String startTime, long interval, String timeUnit) {
|
||||
this.startTime = startTime;
|
||||
this.interval = interval;
|
||||
this.timeUnit = timeUnit;
|
||||
}
|
||||
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public long getInterval() {
|
||||
return interval;
|
||||
}
|
||||
|
||||
public String getTimeUnit() {
|
||||
return timeUnit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (startTime != null) {
|
||||
sb.append(" START WITH ").append(startTime);
|
||||
}
|
||||
if (interval > 0) {
|
||||
sb.append(" NEXT ").append(interval).append(" ").append(timeUnit);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.doris.analysis;
|
||||
|
||||
import org.apache.doris.analysis.MVRefreshInfo.RefreshTrigger;
|
||||
import org.apache.doris.common.AnalysisException;
|
||||
import org.apache.doris.common.UserException;
|
||||
|
||||
public class MVRefreshTriggerInfo {
|
||||
private RefreshTrigger refreshTrigger;
|
||||
private MVRefreshIntervalTriggerInfo intervalTrigger;
|
||||
|
||||
public MVRefreshTriggerInfo(MVRefreshIntervalTriggerInfo trigger) {
|
||||
this.intervalTrigger = trigger;
|
||||
this.refreshTrigger = RefreshTrigger.INTERVAL;
|
||||
}
|
||||
|
||||
public MVRefreshTriggerInfo(RefreshTrigger trigger) {
|
||||
this.intervalTrigger = null;
|
||||
this.refreshTrigger = trigger;
|
||||
}
|
||||
|
||||
void analyze(Analyzer analyzer) throws UserException {
|
||||
if (refreshTrigger == RefreshTrigger.INTERVAL && (intervalTrigger == null || (
|
||||
intervalTrigger.getStartTime() == null && intervalTrigger.getInterval() < 0))) {
|
||||
throw new AnalysisException("Start time or interval is required.");
|
||||
} else if (refreshTrigger == null) {
|
||||
throw new AnalysisException("refresh trigger is required.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public RefreshTrigger getRefreshTrigger() {
|
||||
return refreshTrigger;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (refreshTrigger != RefreshTrigger.INTERVAL) {
|
||||
sb.append(" ON ");
|
||||
sb.append(refreshTrigger.toString());
|
||||
} else {
|
||||
sb.append(intervalTrigger.toString());
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
|
||||
package org.apache.doris.analysis;
|
||||
|
||||
import org.apache.doris.analysis.MVRefreshInfo.RefreshMethod;
|
||||
import org.apache.doris.catalog.Env;
|
||||
import org.apache.doris.common.ErrorCode;
|
||||
import org.apache.doris.common.ErrorReport;
|
||||
import org.apache.doris.common.UserException;
|
||||
import org.apache.doris.mysql.privilege.PrivPredicate;
|
||||
import org.apache.doris.qe.ConnectContext;
|
||||
|
||||
/**
|
||||
* REFRESH MATERIALIZED VIEW [db_name].<mv_name> [complete|fast];
|
||||
*
|
||||
* Parameters
|
||||
* [complete|fast]: complete or incremental refresh.
|
||||
* mv_name: The name of the materialized view to refresh.
|
||||
*/
|
||||
public class RefreshMaterializedViewStmt extends DdlStmt {
|
||||
|
||||
private TableName mvName;
|
||||
private RefreshMethod refreshMethod;
|
||||
|
||||
public RefreshMaterializedViewStmt(TableName mvName, RefreshMethod refreshMethod) {
|
||||
this.mvName = mvName;
|
||||
if (refreshMethod == null) {
|
||||
this.refreshMethod = RefreshMethod.COMPLETE;
|
||||
}
|
||||
this.refreshMethod = refreshMethod;
|
||||
}
|
||||
|
||||
public TableName getMvName() {
|
||||
return mvName;
|
||||
}
|
||||
|
||||
public RefreshMethod getRefreshMethod() {
|
||||
return refreshMethod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void analyze(Analyzer analyzer) throws UserException {
|
||||
mvName.analyze(analyzer);
|
||||
|
||||
// check access
|
||||
if (!Env.getCurrentEnv().getAuth().checkTblPriv(ConnectContext.get(), mvName.getDb(),
|
||||
mvName.getTbl(), PrivPredicate.ADMIN)) {
|
||||
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR, "ADMIN");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toSql() {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("REFRESH MATERIALIZED VIEW ")
|
||||
.append(mvName.toSql())
|
||||
.append(" ")
|
||||
.append(refreshMethod.toString());
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
}
|
||||
@ -34,6 +34,7 @@ import org.apache.doris.analysis.AlterClusterStmt;
|
||||
import org.apache.doris.analysis.AlterDatabaseQuotaStmt;
|
||||
import org.apache.doris.analysis.AlterDatabaseQuotaStmt.QuotaType;
|
||||
import org.apache.doris.analysis.AlterDatabaseRename;
|
||||
import org.apache.doris.analysis.AlterMaterializedViewStmt;
|
||||
import org.apache.doris.analysis.AlterSystemStmt;
|
||||
import org.apache.doris.analysis.AlterTableStmt;
|
||||
import org.apache.doris.analysis.AlterViewStmt;
|
||||
@ -46,6 +47,7 @@ import org.apache.doris.analysis.CreateClusterStmt;
|
||||
import org.apache.doris.analysis.CreateDbStmt;
|
||||
import org.apache.doris.analysis.CreateFunctionStmt;
|
||||
import org.apache.doris.analysis.CreateMaterializedViewStmt;
|
||||
import org.apache.doris.analysis.CreateMultiTableMaterializedViewStmt;
|
||||
import org.apache.doris.analysis.CreateTableAsSelectStmt;
|
||||
import org.apache.doris.analysis.CreateTableLikeStmt;
|
||||
import org.apache.doris.analysis.CreateTableStmt;
|
||||
@ -67,6 +69,7 @@ import org.apache.doris.analysis.PartitionRenameClause;
|
||||
import org.apache.doris.analysis.RecoverDbStmt;
|
||||
import org.apache.doris.analysis.RecoverPartitionStmt;
|
||||
import org.apache.doris.analysis.RecoverTableStmt;
|
||||
import org.apache.doris.analysis.RefreshMaterializedViewStmt;
|
||||
import org.apache.doris.analysis.ReplacePartitionClause;
|
||||
import org.apache.doris.analysis.RestoreStmt;
|
||||
import org.apache.doris.analysis.RollupRenameClause;
|
||||
@ -3587,6 +3590,10 @@ public class Env {
|
||||
this.alter.processAlterTable(stmt);
|
||||
}
|
||||
|
||||
public void alterMaterializedView(AlterMaterializedViewStmt stmt) throws UserException {
|
||||
this.alter.processAlterMaterializedView(stmt);
|
||||
}
|
||||
|
||||
/**
|
||||
* used for handling AlterViewStmt (the ALTER VIEW command).
|
||||
*/
|
||||
@ -3599,10 +3606,18 @@ public class Env {
|
||||
this.alter.processCreateMaterializedView(stmt);
|
||||
}
|
||||
|
||||
public void createMultiTableMaterializedView(CreateMultiTableMaterializedViewStmt stmt) throws AnalysisException {
|
||||
this.alter.processCreateMultiTableMaterializedView(stmt);
|
||||
}
|
||||
|
||||
public void dropMaterializedView(DropMaterializedViewStmt stmt) throws DdlException, MetaNotFoundException {
|
||||
this.alter.processDropMaterializedView(stmt);
|
||||
}
|
||||
|
||||
public void refreshMaterializedView(RefreshMaterializedViewStmt stmt) throws DdlException, MetaNotFoundException {
|
||||
this.alter.processRefreshMaterializedView(stmt);
|
||||
}
|
||||
|
||||
/*
|
||||
* used for handling CancelAlterStmt (for client is the CANCEL ALTER
|
||||
* command). including SchemaChangeHandler and RollupHandler
|
||||
|
||||
@ -33,6 +33,7 @@ import org.apache.doris.analysis.AlterColumnStatsStmt;
|
||||
import org.apache.doris.analysis.AlterDatabasePropertyStmt;
|
||||
import org.apache.doris.analysis.AlterDatabaseQuotaStmt;
|
||||
import org.apache.doris.analysis.AlterDatabaseRename;
|
||||
import org.apache.doris.analysis.AlterMaterializedViewStmt;
|
||||
import org.apache.doris.analysis.AlterPolicyStmt;
|
||||
import org.apache.doris.analysis.AlterResourceStmt;
|
||||
import org.apache.doris.analysis.AlterRoutineLoadStmt;
|
||||
@ -56,6 +57,7 @@ import org.apache.doris.analysis.CreateEncryptKeyStmt;
|
||||
import org.apache.doris.analysis.CreateFileStmt;
|
||||
import org.apache.doris.analysis.CreateFunctionStmt;
|
||||
import org.apache.doris.analysis.CreateMaterializedViewStmt;
|
||||
import org.apache.doris.analysis.CreateMultiTableMaterializedViewStmt;
|
||||
import org.apache.doris.analysis.CreatePolicyStmt;
|
||||
import org.apache.doris.analysis.CreateRepositoryStmt;
|
||||
import org.apache.doris.analysis.CreateResourceStmt;
|
||||
@ -94,6 +96,7 @@ import org.apache.doris.analysis.RecoverDbStmt;
|
||||
import org.apache.doris.analysis.RecoverPartitionStmt;
|
||||
import org.apache.doris.analysis.RecoverTableStmt;
|
||||
import org.apache.doris.analysis.RefreshDbStmt;
|
||||
import org.apache.doris.analysis.RefreshMaterializedViewStmt;
|
||||
import org.apache.doris.analysis.RefreshTableStmt;
|
||||
import org.apache.doris.analysis.RestoreStmt;
|
||||
import org.apache.doris.analysis.ResumeRoutineLoadStmt;
|
||||
@ -148,6 +151,8 @@ public class DdlExecutor {
|
||||
env.dropTable((DropTableStmt) ddlStmt);
|
||||
} else if (ddlStmt instanceof CreateMaterializedViewStmt) {
|
||||
env.createMaterializedView((CreateMaterializedViewStmt) ddlStmt);
|
||||
} else if (ddlStmt instanceof CreateMultiTableMaterializedViewStmt) {
|
||||
env.createMultiTableMaterializedView((CreateMultiTableMaterializedViewStmt) ddlStmt);
|
||||
} else if (ddlStmt instanceof DropMaterializedViewStmt) {
|
||||
env.dropMaterializedView((DropMaterializedViewStmt) ddlStmt);
|
||||
} else if (ddlStmt instanceof AlterTableStmt) {
|
||||
@ -318,6 +323,12 @@ public class DdlExecutor {
|
||||
env.getDataSourceMgr().alterCatalogProps((AlterCatalogPropertyStmt) ddlStmt);
|
||||
} else if (ddlStmt instanceof CleanLabelStmt) {
|
||||
env.getCurrentEnv().getLoadManager().cleanLabel((CleanLabelStmt) ddlStmt);
|
||||
} else if (ddlStmt instanceof AlterMaterializedViewStmt) {
|
||||
env.alterMaterializedView((AlterMaterializedViewStmt) ddlStmt);
|
||||
} else if (ddlStmt instanceof DropMaterializedViewStmt) {
|
||||
env.dropMaterializedView((DropMaterializedViewStmt) ddlStmt);
|
||||
} else if (ddlStmt instanceof RefreshMaterializedViewStmt) {
|
||||
env.refreshMaterializedView((RefreshMaterializedViewStmt) ddlStmt);
|
||||
} else {
|
||||
throw new DdlException("Unknown statement.");
|
||||
}
|
||||
|
||||
@ -91,6 +91,7 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
private static final Map<String, Integer> keywordMap = new LinkedHashMap<String, Integer>();
|
||||
static {
|
||||
keywordMap.put("&&", new Integer(SqlParserSymbols.KW_AND));
|
||||
keywordMap.put("||", new Integer(SqlParserSymbols.KW_PIPE));
|
||||
keywordMap.put("add", new Integer(SqlParserSymbols.KW_ADD));
|
||||
keywordMap.put("admin", new Integer(SqlParserSymbols.KW_ADMIN));
|
||||
keywordMap.put("after", new Integer(SqlParserSymbols.KW_AFTER));
|
||||
@ -101,10 +102,10 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
keywordMap.put("and", new Integer(SqlParserSymbols.KW_AND));
|
||||
keywordMap.put("anti", new Integer(SqlParserSymbols.KW_ANTI));
|
||||
keywordMap.put("append", new Integer(SqlParserSymbols.KW_APPEND));
|
||||
keywordMap.put("array", new Integer(SqlParserSymbols.KW_ARRAY));
|
||||
keywordMap.put("as", new Integer(SqlParserSymbols.KW_AS));
|
||||
keywordMap.put("asc", new Integer(SqlParserSymbols.KW_ASC));
|
||||
keywordMap.put("authors", new Integer(SqlParserSymbols.KW_AUTHORS));
|
||||
keywordMap.put("array", new Integer(SqlParserSymbols.KW_ARRAY));
|
||||
keywordMap.put("backend", new Integer(SqlParserSymbols.KW_BACKEND));
|
||||
keywordMap.put("backends", new Integer(SqlParserSymbols.KW_BACKENDS));
|
||||
keywordMap.put("backup", new Integer(SqlParserSymbols.KW_BACKUP));
|
||||
@ -114,19 +115,18 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
keywordMap.put("binlog", new Integer(SqlParserSymbols.KW_BINLOG));
|
||||
keywordMap.put("bitmap", new Integer(SqlParserSymbols.KW_BITMAP));
|
||||
keywordMap.put("bitmap_union", new Integer(SqlParserSymbols.KW_BITMAP_UNION));
|
||||
keywordMap.put("quantile_state", new Integer(SqlParserSymbols.KW_QUANTILE_STATE));
|
||||
keywordMap.put("quantile_union", new Integer(SqlParserSymbols.KW_QUANTILE_UNION));
|
||||
keywordMap.put("blob", new Integer(SqlParserSymbols.KW_BLOB));
|
||||
keywordMap.put("boolean", new Integer(SqlParserSymbols.KW_BOOLEAN));
|
||||
keywordMap.put("broker", new Integer(SqlParserSymbols.KW_BROKER));
|
||||
keywordMap.put("s3", new Integer(SqlParserSymbols.KW_S3));
|
||||
keywordMap.put("hdfs", new Integer(SqlParserSymbols.KW_HDFS));
|
||||
keywordMap.put("buckets", new Integer(SqlParserSymbols.KW_BUCKETS));
|
||||
keywordMap.put("build", new Integer(SqlParserSymbols.KW_BUILD));
|
||||
keywordMap.put("builtin", new Integer(SqlParserSymbols.KW_BUILTIN));
|
||||
keywordMap.put("by", new Integer(SqlParserSymbols.KW_BY));
|
||||
keywordMap.put("cancel", new Integer(SqlParserSymbols.KW_CANCEL));
|
||||
keywordMap.put("case", new Integer(SqlParserSymbols.KW_CASE));
|
||||
keywordMap.put("cast", new Integer(SqlParserSymbols.KW_CAST));
|
||||
keywordMap.put("catalog", new Integer(SqlParserSymbols.KW_CATALOG));
|
||||
keywordMap.put("catalogs", new Integer(SqlParserSymbols.KW_CATALOGS));
|
||||
keywordMap.put("chain", new Integer(SqlParserSymbols.KW_CHAIN));
|
||||
keywordMap.put("char", new Integer(SqlParserSymbols.KW_CHAR));
|
||||
keywordMap.put("character", new Integer(SqlParserSymbols.KW_CHAR));
|
||||
@ -143,6 +143,7 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
keywordMap.put("commit", new Integer(SqlParserSymbols.KW_COMMIT));
|
||||
keywordMap.put("committed", new Integer(SqlParserSymbols.KW_COMMITTED));
|
||||
keywordMap.put("compact", new Integer(SqlParserSymbols.KW_COMPACT));
|
||||
keywordMap.put("complete", new Integer(SqlParserSymbols.KW_COMPLETE));
|
||||
keywordMap.put("config", new Integer(SqlParserSymbols.KW_CONFIG));
|
||||
keywordMap.put("connection", new Integer(SqlParserSymbols.KW_CONNECTION));
|
||||
keywordMap.put("connection_id", new Integer(SqlParserSymbols.KW_CONNECTION_ID));
|
||||
@ -154,13 +155,14 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
keywordMap.put("cross", new Integer(SqlParserSymbols.KW_CROSS));
|
||||
keywordMap.put("cube", new Integer(SqlParserSymbols.KW_CUBE));
|
||||
keywordMap.put("current", new Integer(SqlParserSymbols.KW_CURRENT));
|
||||
keywordMap.put("current_timestamp", new Integer(SqlParserSymbols.KW_CURRENT_TIMESTAMP));
|
||||
keywordMap.put("current_user", new Integer(SqlParserSymbols.KW_CURRENT_USER));
|
||||
keywordMap.put("data", new Integer(SqlParserSymbols.KW_DATA));
|
||||
keywordMap.put("database", new Integer(SqlParserSymbols.KW_DATABASE));
|
||||
keywordMap.put("databases", new Integer(SqlParserSymbols.KW_DATABASES));
|
||||
keywordMap.put("date", new Integer(SqlParserSymbols.KW_DATE));
|
||||
keywordMap.put("datetime", new Integer(SqlParserSymbols.KW_DATETIME));
|
||||
keywordMap.put("datev2", new Integer(SqlParserSymbols.KW_DATEV2));
|
||||
keywordMap.put("datetime", new Integer(SqlParserSymbols.KW_DATETIME));
|
||||
keywordMap.put("datetimev2", new Integer(SqlParserSymbols.KW_DATETIMEV2));
|
||||
keywordMap.put("time", new Integer(SqlParserSymbols.KW_TIME));
|
||||
keywordMap.put("day", new Integer(SqlParserSymbols.KW_DAY));
|
||||
@ -168,10 +170,13 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
keywordMap.put("decimalv3", new Integer(SqlParserSymbols.KW_DECIMALV3));
|
||||
keywordMap.put("decommission", new Integer(SqlParserSymbols.KW_DECOMMISSION));
|
||||
keywordMap.put("default", new Integer(SqlParserSymbols.KW_DEFAULT));
|
||||
keywordMap.put("deferred", new Integer(SqlParserSymbols.KW_DEFERRED));
|
||||
keywordMap.put("delete", new Integer(SqlParserSymbols.KW_DELETE));
|
||||
keywordMap.put("demand", new Integer(SqlParserSymbols.KW_DEMAND));
|
||||
keywordMap.put("desc", new Integer(SqlParserSymbols.KW_DESC));
|
||||
keywordMap.put("describe", new Integer(SqlParserSymbols.KW_DESCRIBE));
|
||||
keywordMap.put("diagnose", new Integer(SqlParserSymbols.KW_DIAGNOSE));
|
||||
keywordMap.put("disk", new Integer(SqlParserSymbols.KW_DISK));
|
||||
keywordMap.put("distinct", new Integer(SqlParserSymbols.KW_DISTINCT));
|
||||
keywordMap.put("distinctpc", new Integer(SqlParserSymbols.KW_DISTINCTPC));
|
||||
keywordMap.put("distinctpc", new Integer(SqlParserSymbols.KW_DISTINCTPC));
|
||||
@ -179,13 +184,12 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
keywordMap.put("distinctpcsa", new Integer(SqlParserSymbols.KW_DISTINCTPCSA));
|
||||
keywordMap.put("distributed", new Integer(SqlParserSymbols.KW_DISTRIBUTED));
|
||||
keywordMap.put("distribution", new Integer(SqlParserSymbols.KW_DISTRIBUTION));
|
||||
keywordMap.put("disk", new Integer(SqlParserSymbols.KW_DISK));
|
||||
keywordMap.put("dynamic", new Integer(SqlParserSymbols.KW_DYNAMIC));
|
||||
keywordMap.put("div", new Integer(SqlParserSymbols.KW_DIV));
|
||||
keywordMap.put("double", new Integer(SqlParserSymbols.KW_DOUBLE));
|
||||
keywordMap.put("drop", new Integer(SqlParserSymbols.KW_DROP));
|
||||
keywordMap.put("dropp", new Integer(SqlParserSymbols.KW_DROPP));
|
||||
keywordMap.put("duplicate", new Integer(SqlParserSymbols.KW_DUPLICATE));
|
||||
keywordMap.put("dynamic", new Integer(SqlParserSymbols.KW_DYNAMIC));
|
||||
keywordMap.put("else", new Integer(SqlParserSymbols.KW_ELSE));
|
||||
keywordMap.put("enable", new Integer(SqlParserSymbols.KW_ENABLE));
|
||||
keywordMap.put("encryptkey", new Integer(SqlParserSymbols.KW_ENCRYPTKEY));
|
||||
@ -205,6 +209,7 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
keywordMap.put("external", new Integer(SqlParserSymbols.KW_EXTERNAL));
|
||||
keywordMap.put("extract", new Integer(SqlParserSymbols.KW_EXTRACT));
|
||||
keywordMap.put("false", new Integer(SqlParserSymbols.KW_FALSE));
|
||||
keywordMap.put("fast", new Integer(SqlParserSymbols.KW_FAST));
|
||||
keywordMap.put("feature", new Integer(SqlParserSymbols.KW_FEATURE));
|
||||
keywordMap.put("fields", new Integer(SqlParserSymbols.KW_FIELDS));
|
||||
keywordMap.put("file", new Integer(SqlParserSymbols.KW_FILE));
|
||||
@ -231,6 +236,7 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
keywordMap.put("grouping", new Integer(SqlParserSymbols.KW_GROUPING));
|
||||
keywordMap.put("hash", new Integer(SqlParserSymbols.KW_HASH));
|
||||
keywordMap.put("having", new Integer(SqlParserSymbols.KW_HAVING));
|
||||
keywordMap.put("hdfs", new Integer(SqlParserSymbols.KW_HDFS));
|
||||
keywordMap.put("help", new Integer(SqlParserSymbols.KW_HELP));
|
||||
keywordMap.put("hll", new Integer(SqlParserSymbols.KW_HLL));
|
||||
keywordMap.put("hll_union", new Integer(SqlParserSymbols.KW_HLL_UNION));
|
||||
@ -238,6 +244,7 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
keywordMap.put("hub", new Integer(SqlParserSymbols.KW_HUB));
|
||||
keywordMap.put("identified", new Integer(SqlParserSymbols.KW_IDENTIFIED));
|
||||
keywordMap.put("if", new Integer(SqlParserSymbols.KW_IF));
|
||||
keywordMap.put("immediate", new Integer(SqlParserSymbols.KW_IMMEDIATE));
|
||||
keywordMap.put("in", new Integer(SqlParserSymbols.KW_IN));
|
||||
keywordMap.put("index", new Integer(SqlParserSymbols.KW_INDEX));
|
||||
keywordMap.put("indexes", new Integer(SqlParserSymbols.KW_INDEXES));
|
||||
@ -245,6 +252,7 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
keywordMap.put("inner", new Integer(SqlParserSymbols.KW_INNER));
|
||||
keywordMap.put("inner", new Integer(SqlParserSymbols.KW_INNER));
|
||||
keywordMap.put("insert", new Integer(SqlParserSymbols.KW_INSERT));
|
||||
keywordMap.put("install", new Integer(SqlParserSymbols.KW_INSTALL));
|
||||
keywordMap.put("int", new Integer(SqlParserSymbols.KW_INT));
|
||||
keywordMap.put("integer", new Integer(SqlParserSymbols.KW_INT));
|
||||
keywordMap.put("intermediate", new Integer(SqlParserSymbols.KW_INTERMEDIATE));
|
||||
@ -254,7 +262,6 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
keywordMap.put("is", new Integer(SqlParserSymbols.KW_IS));
|
||||
keywordMap.put("isnull", new Integer(SqlParserSymbols.KW_ISNULL));
|
||||
keywordMap.put("isolation", new Integer(SqlParserSymbols.KW_ISOLATION));
|
||||
keywordMap.put("install", new Integer(SqlParserSymbols.KW_INSTALL));
|
||||
keywordMap.put("job", new Integer(SqlParserSymbols.KW_JOB));
|
||||
keywordMap.put("join", new Integer(SqlParserSymbols.KW_JOIN));
|
||||
keywordMap.put("key", new Integer(SqlParserSymbols.KW_KEY));
|
||||
@ -264,6 +271,7 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
keywordMap.put("largeint", new Integer(SqlParserSymbols.KW_LARGEINT));
|
||||
keywordMap.put("last", new Integer(SqlParserSymbols.KW_LAST));
|
||||
keywordMap.put("lateral", new Integer(SqlParserSymbols.KW_LATERAL));
|
||||
keywordMap.put("ldap_admin_password", new Integer(SqlParserSymbols.KW_LDAP_ADMIN_PASSWORD));
|
||||
keywordMap.put("left", new Integer(SqlParserSymbols.KW_LEFT));
|
||||
keywordMap.put("less", new Integer(SqlParserSymbols.KW_LESS));
|
||||
keywordMap.put("level", new Integer(SqlParserSymbols.KW_LEVEL));
|
||||
@ -291,8 +299,11 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
keywordMap.put("name", new Integer(SqlParserSymbols.KW_NAME));
|
||||
keywordMap.put("names", new Integer(SqlParserSymbols.KW_NAMES));
|
||||
keywordMap.put("negative", new Integer(SqlParserSymbols.KW_NEGATIVE));
|
||||
keywordMap.put("never", new Integer(SqlParserSymbols.KW_NEVER));
|
||||
keywordMap.put("next", new Integer(SqlParserSymbols.KW_NEXT));
|
||||
keywordMap.put("no", new Integer(SqlParserSymbols.KW_NO));
|
||||
keywordMap.put("not", new Integer(SqlParserSymbols.KW_NOT));
|
||||
keywordMap.put("not_null", new Integer(SqlParserSymbols.KW_NOT_NULL));
|
||||
keywordMap.put("null", new Integer(SqlParserSymbols.KW_NULL));
|
||||
keywordMap.put("nulls", new Integer(SqlParserSymbols.KW_NULLS));
|
||||
keywordMap.put("observer", new Integer(SqlParserSymbols.KW_OBSERVER));
|
||||
@ -309,11 +320,11 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
keywordMap.put("partition", new Integer(SqlParserSymbols.KW_PARTITION));
|
||||
keywordMap.put("partitions", new Integer(SqlParserSymbols.KW_PARTITIONS));
|
||||
keywordMap.put("password", new Integer(SqlParserSymbols.KW_PASSWORD));
|
||||
keywordMap.put("ldap_admin_password", new Integer(SqlParserSymbols.KW_LDAP_ADMIN_PASSWORD));
|
||||
keywordMap.put("path", new Integer(SqlParserSymbols.KW_PATH));
|
||||
keywordMap.put("pause", new Integer(SqlParserSymbols.KW_PAUSE));
|
||||
keywordMap.put("plugin", new Integer(SqlParserSymbols.KW_PLUGIN));
|
||||
keywordMap.put("plugins", new Integer(SqlParserSymbols.KW_PLUGINS));
|
||||
keywordMap.put("policy", new Integer(SqlParserSymbols.KW_POLICY));
|
||||
keywordMap.put("preceding", new Integer(SqlParserSymbols.KW_PRECEDING));
|
||||
keywordMap.put("proc", new Integer(SqlParserSymbols.KW_PROC));
|
||||
keywordMap.put("procedure", new Integer(SqlParserSymbols.KW_PROCEDURE));
|
||||
@ -321,7 +332,8 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
keywordMap.put("profile", new Integer(SqlParserSymbols.KW_PROFILE));
|
||||
keywordMap.put("properties", new Integer(SqlParserSymbols.KW_PROPERTIES));
|
||||
keywordMap.put("property", new Integer(SqlParserSymbols.KW_PROPERTY));
|
||||
keywordMap.put("policy", new Integer(SqlParserSymbols.KW_POLICY));
|
||||
keywordMap.put("quantile_state", new Integer(SqlParserSymbols.KW_QUANTILE_STATE));
|
||||
keywordMap.put("quantile_union", new Integer(SqlParserSymbols.KW_QUANTILE_UNION));
|
||||
keywordMap.put("query", new Integer(SqlParserSymbols.KW_QUERY));
|
||||
keywordMap.put("quota", new Integer(SqlParserSymbols.KW_QUOTA));
|
||||
keywordMap.put("random", new Integer(SqlParserSymbols.KW_RANDOM));
|
||||
@ -357,6 +369,7 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
keywordMap.put("routine", new Integer(SqlParserSymbols.KW_ROUTINE));
|
||||
keywordMap.put("row", new Integer(SqlParserSymbols.KW_ROW));
|
||||
keywordMap.put("rows", new Integer(SqlParserSymbols.KW_ROWS));
|
||||
keywordMap.put("s3", new Integer(SqlParserSymbols.KW_S3));
|
||||
keywordMap.put("schema", new Integer(SqlParserSymbols.KW_SCHEMA));
|
||||
keywordMap.put("schemas", new Integer(SqlParserSymbols.KW_SCHEMAS));
|
||||
keywordMap.put("second", new Integer(SqlParserSymbols.KW_SECOND));
|
||||
@ -373,9 +386,10 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
keywordMap.put("snapshot", new Integer(SqlParserSymbols.KW_SNAPSHOT));
|
||||
keywordMap.put("soname", new Integer(SqlParserSymbols.KW_SONAME));
|
||||
keywordMap.put("split", new Integer(SqlParserSymbols.KW_SPLIT));
|
||||
keywordMap.put("sql_block_rule", new Integer(SqlParserSymbols.KW_SQL_BLOCK_RULE));
|
||||
keywordMap.put("start", new Integer(SqlParserSymbols.KW_START));
|
||||
keywordMap.put("status", new Integer(SqlParserSymbols.KW_STATUS));
|
||||
keywordMap.put("stats", new Integer(SqlParserSymbols.KW_STATS));
|
||||
keywordMap.put("status", new Integer(SqlParserSymbols.KW_STATUS));
|
||||
keywordMap.put("stop", new Integer(SqlParserSymbols.KW_STOP));
|
||||
keywordMap.put("storage", new Integer(SqlParserSymbols.KW_STORAGE));
|
||||
keywordMap.put("stream", new Integer(SqlParserSymbols.KW_STREAM));
|
||||
@ -383,9 +397,9 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
keywordMap.put("struct", new Integer(SqlParserSymbols.KW_STRUCT));
|
||||
keywordMap.put("sum", new Integer(SqlParserSymbols.KW_SUM));
|
||||
keywordMap.put("superuser", new Integer(SqlParserSymbols.KW_SUPERUSER));
|
||||
keywordMap.put("switch", new Integer(SqlParserSymbols.KW_SWITCH));
|
||||
keywordMap.put("sync", new Integer(SqlParserSymbols.KW_SYNC));
|
||||
keywordMap.put("system", new Integer(SqlParserSymbols.KW_SYSTEM));
|
||||
keywordMap.put("sql_block_rule", new Integer(SqlParserSymbols.KW_SQL_BLOCK_RULE));
|
||||
keywordMap.put("table", new Integer(SqlParserSymbols.KW_TABLE));
|
||||
keywordMap.put("tables", new Integer(SqlParserSymbols.KW_TABLES));
|
||||
keywordMap.put("tablet", new Integer(SqlParserSymbols.KW_TABLET));
|
||||
@ -396,6 +410,7 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
keywordMap.put("text", new Integer(SqlParserSymbols.KW_TEXT));
|
||||
keywordMap.put("than", new Integer(SqlParserSymbols.KW_THAN));
|
||||
keywordMap.put("then", new Integer(SqlParserSymbols.KW_THEN));
|
||||
keywordMap.put("time", new Integer(SqlParserSymbols.KW_TIME));
|
||||
keywordMap.put("timestamp", new Integer(SqlParserSymbols.KW_TIMESTAMP));
|
||||
keywordMap.put("tinyint", new Integer(SqlParserSymbols.KW_TINYINT));
|
||||
keywordMap.put("to", new Integer(SqlParserSymbols.KW_TO));
|
||||
@ -409,37 +424,31 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
keywordMap.put("types", new Integer(SqlParserSymbols.KW_TYPES));
|
||||
keywordMap.put("unbounded", new Integer(SqlParserSymbols.KW_UNBOUNDED));
|
||||
keywordMap.put("uncommitted", new Integer(SqlParserSymbols.KW_UNCOMMITTED));
|
||||
keywordMap.put("uninstall", new Integer(SqlParserSymbols.KW_UNINSTALL));
|
||||
keywordMap.put("union", new Integer(SqlParserSymbols.KW_UNION));
|
||||
keywordMap.put("unique", new Integer(SqlParserSymbols.KW_UNIQUE));
|
||||
keywordMap.put("unlock", new Integer(SqlParserSymbols.KW_UNLOCK));
|
||||
keywordMap.put("unsigned", new Integer(SqlParserSymbols.KW_UNSIGNED));
|
||||
keywordMap.put("update", new Integer(SqlParserSymbols.KW_UPDATE));
|
||||
keywordMap.put("use", new Integer(SqlParserSymbols.KW_USE));
|
||||
keywordMap.put("user", new Integer(SqlParserSymbols.KW_USER));
|
||||
keywordMap.put("using", new Integer(SqlParserSymbols.KW_USING));
|
||||
keywordMap.put("uninstall", new Integer(SqlParserSymbols.KW_UNINSTALL));
|
||||
keywordMap.put("unlock", new Integer(SqlParserSymbols.KW_UNLOCK));
|
||||
keywordMap.put("update", new Integer(SqlParserSymbols.KW_UPDATE));
|
||||
keywordMap.put("value", new Integer(SqlParserSymbols.KW_VALUE));
|
||||
keywordMap.put("values", new Integer(SqlParserSymbols.KW_VALUES));
|
||||
keywordMap.put("varchar", new Integer(SqlParserSymbols.KW_VARCHAR));
|
||||
keywordMap.put("verbose", new Integer(SqlParserSymbols.KW_VERBOSE));
|
||||
keywordMap.put("variables", new Integer(SqlParserSymbols.KW_VARIABLES));
|
||||
keywordMap.put("verbose", new Integer(SqlParserSymbols.KW_VERBOSE));
|
||||
keywordMap.put("view", new Integer(SqlParserSymbols.KW_VIEW));
|
||||
keywordMap.put("warnings", new Integer(SqlParserSymbols.KW_WARNINGS));
|
||||
keywordMap.put("week", new Integer(SqlParserSymbols.KW_WEEK));
|
||||
keywordMap.put("whitelist", new Integer(SqlParserSymbols.KW_WHITELIST));
|
||||
keywordMap.put("when", new Integer(SqlParserSymbols.KW_WHEN));
|
||||
keywordMap.put("where", new Integer(SqlParserSymbols.KW_WHERE));
|
||||
keywordMap.put("whitelist", new Integer(SqlParserSymbols.KW_WHITELIST));
|
||||
keywordMap.put("whitelist", new Integer(SqlParserSymbols.KW_WHITELIST));
|
||||
keywordMap.put("with", new Integer(SqlParserSymbols.KW_WITH));
|
||||
keywordMap.put("work", new Integer(SqlParserSymbols.KW_WORK));
|
||||
keywordMap.put("write", new Integer(SqlParserSymbols.KW_WRITE));
|
||||
keywordMap.put("year", new Integer(SqlParserSymbols.KW_YEAR));
|
||||
keywordMap.put("||", new Integer(SqlParserSymbols.KW_PIPE));
|
||||
keywordMap.put("current_timestamp", new Integer(SqlParserSymbols.KW_CURRENT_TIMESTAMP));
|
||||
keywordMap.put("not_null", new Integer(SqlParserSymbols.KW_NOT_NULL));
|
||||
keywordMap.put("catalog", new Integer(SqlParserSymbols.KW_CATALOG));
|
||||
keywordMap.put("catalogs", new Integer(SqlParserSymbols.KW_CATALOGS));
|
||||
keywordMap.put("switch", new Integer(SqlParserSymbols.KW_SWITCH));
|
||||
}
|
||||
|
||||
// map from token id to token description
|
||||
|
||||
Reference in New Issue
Block a user