-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Doris grammar rules for RECOVER and tests #33436
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -411,6 +411,18 @@ restart | |
: RESTART | ||
; | ||
|
||
recoverDatabase | ||
: RECOVER DATABASE databaseName (databaseId | AS newDatabaseName)? | ||
; | ||
|
||
recoverPartition | ||
: RECOVER PARTITION partitionName partitionId? (AS newPartitionName)? FROM tableName | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
; | ||
|
||
recoverTable | ||
: RECOVER TABLE tableName tableId? (AS newDatabaseName)? | ||
; | ||
|
||
shutdown | ||
: SHUTDOWN | ||
; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* 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.shardingsphere.sql.parser.statement.core.statement.dal; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.apache.shardingsphere.sql.parser.statement.core.statement.AbstractSQLStatement; | ||
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DDLStatement; | ||
|
||
/** | ||
* Create database statement. | ||
*/ | ||
@Getter | ||
@Setter | ||
public abstract class RecoverDatabaseStatement extends AbstractSQLStatement implements DDLStatement { | ||
|
||
private String databaseName; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you consider using the DatabaseSegment? |
||
|
||
private String databaseId; | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* 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.shardingsphere.sql.parser.statement.core.statement.dal; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.apache.shardingsphere.sql.parser.statement.core.statement.AbstractSQLStatement; | ||
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DDLStatement; | ||
|
||
/** | ||
* Create database statement. | ||
*/ | ||
@Getter | ||
@Setter | ||
public abstract class RecoverPartitionStatement extends AbstractSQLStatement implements DDLStatement { | ||
|
||
private String partitionName; | ||
|
||
private String partitionId; | ||
|
||
private String databaseName; | ||
|
||
private String newPartitionName; | ||
|
||
private String owner; | ||
|
||
private String tableName; | ||
|
||
} | ||
Comment on lines
+30
to
+44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above, use class types instead of the primitive types. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* 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.shardingsphere.sql.parser.statement.core.statement.dal; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.apache.shardingsphere.sql.parser.statement.core.statement.AbstractSQLStatement; | ||
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DDLStatement; | ||
|
||
/** | ||
* Create database statement. | ||
*/ | ||
@Getter | ||
@Setter | ||
public abstract class RecoverTableStatement extends AbstractSQLStatement implements DDLStatement { | ||
|
||
private String tableName; | ||
|
||
private String tableId; | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* 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.shardingsphere.sql.parser.statement.doris.dal; | ||
|
||
import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.RecoverDatabaseStatement; | ||
import org.apache.shardingsphere.sql.parser.statement.doris.DorisStatement; | ||
|
||
/** | ||
* Doris create database statement. | ||
*/ | ||
public final class DorisRecoverDatabaseStatement extends RecoverDatabaseStatement implements DorisStatement { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to reuse this abstract class in other databases? If not, we should consider removing it. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* 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.shardingsphere.sql.parser.statement.doris.dal; | ||
|
||
import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.RecoverPartitionStatement; | ||
import org.apache.shardingsphere.sql.parser.statement.doris.DorisStatement; | ||
|
||
/** | ||
* Doris create database statement. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please check the code comments. |
||
*/ | ||
public final class DorisRecoverPartitionStatement extends RecoverPartitionStatement implements DorisStatement { | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use rule-element-labels instead of the newDatabaseName rule.