You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "shamilv (via GitHub)" <gi...@apache.org> on 2024/10/28 06:31:21 UTC
[PR] Add Doris grammar rules for RECOVER and tests [shardingsphere]
shamilv opened a new pull request, #33436:
URL: https://github.com/apache/shardingsphere/pull/33436
Fixes #ISSUSE_ID.
Changes proposed in this pull request:
- Added changes necessary to parse Doris RECOVER statements including:
- RECOVER PARTITION
- RECOVER DATABASE
- RECOVER TABLE
- Added tests
---
Before committing this PR, I'm sure that I have checked the following options:
- [ X ] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
- [ X ] I have self-reviewed the commit code.
- [ X ] I have (or in comment I request) added corresponding labels for the pull request.
- [ X ] I have passed maven check locally : `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
- [ ] I have made corresponding changes to the documentation.
- [ X ] I have added corresponding unit tests for my changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Doris grammar rules for RECOVER and tests [shardingsphere]
Posted by "iamhucong (via GitHub)" <gi...@apache.org>.
iamhucong commented on PR #33436:
URL: https://github.com/apache/shardingsphere/pull/33436#issuecomment-2448860961
https://shardingsphere.apache.org/community/en/involved/conduct/code/#maintenance-conduct
@shamilv Could you please verify if MySQL supports these? You can refer to this document for further information.
Additionally, please update the release notes for 5.5.2-SNAPSHOT.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Doris grammar rules for RECOVER and tests [shardingsphere]
Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on PR #33436:
URL: https://github.com/apache/shardingsphere/pull/33436#issuecomment-3592291381
Closed because of no response for long time.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Doris grammar rules for RECOVER and tests [shardingsphere]
Posted by "shamilv (via GitHub)" <gi...@apache.org>.
shamilv commented on PR #33436:
URL: https://github.com/apache/shardingsphere/pull/33436#issuecomment-2533677535
Hi @strongduanmu
Sure. I'll push the changes this weekend.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Doris grammar rules for RECOVER and tests [shardingsphere]
Posted by "shamilv (via GitHub)" <gi...@apache.org>.
shamilv commented on PR #33436:
URL: https://github.com/apache/shardingsphere/pull/33436#issuecomment-2562997390
Hi @iamhucong / @strongduanmu
Please review the changes
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Doris grammar rules for RECOVER and tests [shardingsphere]
Posted by "iamhucong (via GitHub)" <gi...@apache.org>.
iamhucong commented on code in PR #33436:
URL: https://github.com/apache/shardingsphere/pull/33436#discussion_r1823659978
##########
parser/sql/dialect/doris/src/main/antlr4/imports/doris/DALStatement.g4:
##########
@@ -411,6 +411,18 @@ restart
: RESTART
;
+recoverDatabase
+ : RECOVER DATABASE databaseName (databaseId | AS newDatabaseName)?
+ ;
+
+recoverPartition
+ : RECOVER PARTITION partitionName partitionId? (AS newPartitionName)? FROM tableName
Review Comment:
Same as above.
##########
parser/sql/dialect/doris/src/main/antlr4/imports/doris/DALStatement.g4:
##########
@@ -411,6 +411,18 @@ restart
: RESTART
;
+recoverDatabase
+ : RECOVER DATABASE databaseName (databaseId | AS newDatabaseName)?
Review Comment:
You can use [rule-element-labels](https://github.com/antlr/antlr4/blob/master/doc/parser-rules.md#rule-element-labels) instead of the newDatabaseName rule.
##########
parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dal/RecoverDatabaseStatement.java:
##########
@@ -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;
Review Comment:
Could you consider using the DatabaseSegment?
##########
parser/sql/statement/type/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisRecoverDatabaseStatement.java:
##########
@@ -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 {
Review Comment:
Is it possible to reuse this abstract class in other databases? If not, we should consider removing it.
##########
parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dal/RecoverPartitionStatement.java:
##########
@@ -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;
+
+}
Review Comment:
As above, use class types instead of the primitive types.
##########
parser/sql/statement/type/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisRecoverPartitionStatement.java:
##########
@@ -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.
Review Comment:
Please check the code comments.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Doris grammar rules for RECOVER and tests [shardingsphere]
Posted by "shamilv (via GitHub)" <gi...@apache.org>.
shamilv commented on code in PR #33436:
URL: https://github.com/apache/shardingsphere/pull/33436#discussion_r1898029227
##########
parser/sql/statement/type/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisRecoverDatabaseStatement.java:
##########
@@ -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 {
Review Comment:
Deleted the abstract class
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Doris grammar rules for RECOVER and tests [shardingsphere]
Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on PR #33436:
URL: https://github.com/apache/shardingsphere/pull/33436#issuecomment-2533642567
Hi @shamilv, can you take a look for @iamhucong suggestion?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Doris grammar rules for RECOVER and tests [shardingsphere]
Posted by "shamilv (via GitHub)" <gi...@apache.org>.
shamilv commented on code in PR #33436:
URL: https://github.com/apache/shardingsphere/pull/33436#discussion_r1898029065
##########
parser/sql/statement/type/doris/src/main/java/org/apache/shardingsphere/sql/parser/statement/doris/dal/DorisRecoverPartitionStatement.java:
##########
@@ -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.
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Doris grammar rules for RECOVER and tests [shardingsphere]
Posted by "shamilv (via GitHub)" <gi...@apache.org>.
shamilv commented on code in PR #33436:
URL: https://github.com/apache/shardingsphere/pull/33436#discussion_r1898027453
##########
parser/sql/dialect/doris/src/main/antlr4/imports/doris/DALStatement.g4:
##########
@@ -411,6 +411,18 @@ restart
: RESTART
;
+recoverDatabase
+ : RECOVER DATABASE databaseName (databaseId | AS newDatabaseName)?
Review Comment:
Done
##########
parser/sql/dialect/doris/src/main/antlr4/imports/doris/DALStatement.g4:
##########
@@ -411,6 +411,18 @@ restart
: RESTART
;
+recoverDatabase
+ : RECOVER DATABASE databaseName (databaseId | AS newDatabaseName)?
+ ;
+
+recoverPartition
+ : RECOVER PARTITION partitionName partitionId? (AS newPartitionName)? FROM tableName
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Doris grammar rules for RECOVER and tests [shardingsphere]
Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed pull request #33436: Add Doris grammar rules for RECOVER and tests
URL: https://github.com/apache/shardingsphere/pull/33436
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Doris grammar rules for RECOVER and tests [shardingsphere]
Posted by "shamilv (via GitHub)" <gi...@apache.org>.
shamilv commented on code in PR #33436:
URL: https://github.com/apache/shardingsphere/pull/33436#discussion_r1898028688
##########
parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dal/RecoverPartitionStatement.java:
##########
@@ -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;
+
+}
Review Comment:
Replaced with the class types
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Doris grammar rules for RECOVER and tests [shardingsphere]
Posted by "shamilv (via GitHub)" <gi...@apache.org>.
shamilv commented on code in PR #33436:
URL: https://github.com/apache/shardingsphere/pull/33436#discussion_r1898027649
##########
parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dal/RecoverDatabaseStatement.java:
##########
@@ -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;
Review Comment:
I changed it to DatabaseSegment
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add Doris grammar rules for RECOVER and tests [shardingsphere]
Posted by "shamilv (via GitHub)" <gi...@apache.org>.
shamilv commented on PR #33436:
URL: https://github.com/apache/shardingsphere/pull/33436#issuecomment-2562991368
> https://shardingsphere.apache.org/community/en/involved/conduct/code/#maintenance-conduct @shamilv Could you please verify if MySQL supports these? You can refer to this document for further information.
>
> Additionally, please update the release notes for 5.5.2-SNAPSHOT.
@iamhucong MySQL doesn't have a `RECOVER` SQL statement. Release notes are updated
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org