Skip to content

Commit

Permalink
[opt](Nereids) support some unclustered statement syntax
Browse files Browse the repository at this point in the history
- copy into
- backup
- help
- install plugin
- uninstall plugin
- lock tables
- unlock tables
- recover
- start transaction
  • Loading branch information
morrySnow committed Aug 29, 2024
1 parent 0222346 commit ae655d9
Show file tree
Hide file tree
Showing 14 changed files with 58 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ unsupportedStatement
| unsupportedGrantRevokeStatement
| unsupportedAdminStatement
| unsupportedTransactionStatement
| unsupportedRecoverStatement
| unsupportedOtherStatement
;

materailizedViewStatement
Expand Down Expand Up @@ -172,6 +174,40 @@ supportedDropStatement
: DROP CATALOG RECYCLE BIN WHERE idType=STRING_LITERAL EQ id=INTEGER_VALUE #dropCatalogRecycleBin
;

unsupportedOtherStatement
: HELP mark=identifierOrText #help
| INSTALL PLUGIN FROM source=identifierOrText properties=propertyClause? #installPlugin
| UNINSTALL PLUGIN name=identifierOrText #uninstallPlugin
| LOCK TABLES (lockTable (COMMA lockTable)*)? #lockTables
| UNLOCK TABLES #unlockTables
| WARM UP CLUSTER destination=identifier WITH
(CLUSTER source=identifier | (warmUpItem (COMMA warmUpItem)*)) FORCE? #warmUpCluster
| BACKUP SNAPSHOT label=multipartIdentifier TO repo=identifier
((ON | EXCLUDE) baseTableRef (COMMA baseTableRef)*)?
properties=propertyClause? #backup
| RESTORE SNAPSHOT label=multipartIdentifier FROM repo=identifier
((ON | EXCLUDE) baseTableRef (COMMA baseTableRef)*)?
properties=propertyClause? #restore
| START TRANSACTION (WITH CONSISTENT SNAPSHOT)? #unsupportedStartTransaction
;

warmUpItem
: TABLE tableName=multipartIdentifier (PARTITION partitionName=identifier)?
;

lockTable
: name=multipartIdentifier (AS alias=identifierOrText)?
(READ (LOCAL)? | (LOW_PRIORITY)? WRITE)
;

unsupportedRecoverStatement
: RECOVER DATABASE name=identifier id=INTEGER_VALUE? (AS alias=identifier)? #recoverDatabase
| RECOVER TABLE name=multipartIdentifier
id=INTEGER_VALUE? (AS alias=identifier)? #recoverTable
| RECOVER PARTITION name=identifier id=INTEGER_VALUE? (AS alias=identifier)?
FROM tableName=multipartIdentifier #recoverPartition
;

unsupportedAdminStatement
: ADMIN SHOW REPLICA STATUS FROM baseTableRef wildWhere? #adminShowReplicaStatus
| ADMIN SHOW REPLICA DISTRIBUTION FROM baseTableRef #adminShowReplicaDistribution
Expand Down Expand Up @@ -551,7 +587,15 @@ unsupportedUseStatement
;

unsupportedDmlStatement
: TRUNCATE TABLE multipartIdentifier specifiedPartition? # truncateTable
: TRUNCATE TABLE multipartIdentifier specifiedPartition? #truncateTable
| COPY INTO selectHint? name=multipartIdentifier columns=identifierList FROM
(stageAndPattern | (LEFT_PAREN SELECT selectColumnClause
FROM stageAndPattern whereClause RIGHT_PAREN))
properties=propertyClause? #copyInto
;

stageAndPattern
: AT (stage=identifier | TILDE) (pattern=STRING_LITERAL)?
;

unsupportedKillStatement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

import java.util.Map;

public class BackupStmt extends AbstractBackupStmt {
public class BackupStmt extends AbstractBackupStmt implements NotFallbackInParser {
private static final String PROP_TYPE = "type";
public static final String PROP_CONTENT = "content";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
/**
* Copy statement
*/
public class CopyStmt extends DdlStmt {
public class CopyStmt extends DdlStmt implements NotFallbackInParser {
private static final Logger LOG = LogManager.getLogger(CopyStmt.class);

private static final ShowResultSetMetaData COPY_INTO_META_DATA =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import com.google.common.base.Strings;

public class HelpStmt extends ShowStmt {
public class HelpStmt extends ShowStmt implements NotFallbackInParser {
private static final ShowResultSetMetaData TOPIC_META_DATA =
ShowResultSetMetaData.builder()
.addColumn(new Column("name", ScalarType.createVarchar(64)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

import java.util.Map;

public class InstallPluginStmt extends DdlStmt {
public class InstallPluginStmt extends DdlStmt implements NotFallbackInParser {

private String pluginPath;
private Map<String, String> properties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import java.util.ArrayList;
import java.util.List;

public class LockTablesStmt extends StatementBase {
public class LockTablesStmt extends StatementBase implements NotFallbackInParser {
private static final Logger LOG = LogManager.getLogger(LockTablesStmt.class);

private List<LockTable> lockTables;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import com.google.common.base.Strings;

public class RecoverDbStmt extends DdlStmt {
public class RecoverDbStmt extends DdlStmt implements NotFallbackInParser {
private String dbName;
private long dbId = -1;
private String newDbName = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import com.google.common.base.Strings;

public class RecoverPartitionStmt extends DdlStmt {
public class RecoverPartitionStmt extends DdlStmt implements NotFallbackInParser {
private TableName dbTblName;
private String partitionName;
private long partitionId = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import com.google.common.base.Strings;

public class RecoverTableStmt extends DdlStmt {
public class RecoverTableStmt extends DdlStmt implements NotFallbackInParser {
private TableName dbTblName;
private long tableId = -1;
private String newTableName = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import java.util.Map;
import java.util.Set;

public class RestoreStmt extends AbstractBackupStmt {
public class RestoreStmt extends AbstractBackupStmt implements NotFallbackInParser {
private static final String PROP_ALLOW_LOAD = "allow_load";
private static final String PROP_BACKUP_TIMESTAMP = "backup_timestamp";
private static final String PROP_META_VERSION = "meta_version";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.apache.doris.mysql.privilege.PrivPredicate;
import org.apache.doris.qe.ConnectContext;

public class UninstallPluginStmt extends DdlStmt {
public class UninstallPluginStmt extends DdlStmt implements NotFallbackInParser {

private String pluginName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.doris.analysis;

public class UnlockTablesStmt extends StatementBase {
public class UnlockTablesStmt extends StatementBase implements NotFallbackInParser {
@Override
public String toSql() {
return "UNLOCK TABLES";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.UserException;

public class UnsupportedStmt extends StatementBase {
public class UnsupportedStmt extends StatementBase implements NotFallbackInParser {

public UnsupportedStmt() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import java.util.Map;
import java.util.Objects;

public class WarmUpClusterStmt extends StatementBase {
public class WarmUpClusterStmt extends StatementBase implements NotFallbackInParser {
private static final Logger LOG = LogManager.getLogger(WarmUpClusterStmt.class);
private List<Map<TableName, String>> tableList;
private List<Triple<String, String, String>> tables = new ArrayList<>();
Expand Down

0 comments on commit ae655d9

Please sign in to comment.