terrymanu commented on a change in pull request #8713:
URL: https://github.com/apache/shardingsphere/pull/8713#discussion_r547606519
##########
File path:
shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RDLStatement.g4
##########
@@ -63,42 +63,42 @@ createShardingRule
: CREATE SHARDING RULE LP shardingTableRuleDefinition (COMMA
shardingTableRuleDefinition)* RP
;
-shardingTableRuleDefinition
- : tableName columName shardingAlgorithmDefinition
+createReplicaQueryRule
+ : CREATE REPLICA_QUERY RULE LP replicaQueryRuleDefinition (COMMA
replicaQueryRuleDefinition)* RP
;
-shardingAlgorithmDefinition
- : shardingAlgorithmType LP shardingAlgorithmProperties RP
+replicaQueryRuleDefinition
+ : ruleName=IDENTIFIER LP PRIMARY EQ primary=schemaName COMMA REPLICA EQ
schemaNames RP loadBalancer=IDENTIFIER LP algorithmProperties RP
Review comment:
There are 2 spaces between `LP algorithmProperties`
##########
File path:
shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/segment/rdl/ReplicaQueryRuleSegment.java
##########
@@ -0,0 +1,45 @@
+/*
+ * 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.distsql.parser.segment.rdl;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import lombok.Setter;
+import org.apache.shardingsphere.sql.parser.api.visitor.ASTNode;
+
+import java.util.Collection;
+import java.util.Properties;
+
+/**
+ * Table rule segment.
+ */
+@RequiredArgsConstructor
Review comment:
What is useful of `@RequiredArgsConstructor`?
##########
File path:
shardingsphere-distsql-parser/shardingsphere-distsql-parser-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/create/impl/CreateReplicaQueryRuleStatement.java
##########
@@ -0,0 +1,35 @@
+/*
+ * 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.distsql.parser.statement.rdl.create.impl;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+import
org.apache.shardingsphere.distsql.parser.segment.rdl.ReplicaQueryRuleSegment;
+import
org.apache.shardingsphere.distsql.parser.statement.rdl.create.CreateRDLStatement;
+
+import java.util.Collection;
+
+/**
+ * Create sharding rule statement.
Review comment:
The javadoc is incorrect
##########
File path:
shardingsphere-features/shardingsphere-replica-query/shardingsphere-replica-query-common/src/main/java/org/apache/shardingsphere/replicaquery/yaml/converter/CreateReplicaQueryRuleStatementConverter.java
##########
@@ -0,0 +1,57 @@
+/*
+ * 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.replicaquery.yaml.converter;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import
org.apache.shardingsphere.distsql.parser.segment.rdl.ReplicaQueryRuleSegment;
+import
org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateReplicaQueryRuleStatement;
+import
org.apache.shardingsphere.infra.yaml.config.algorithm.YamlShardingSphereAlgorithmConfiguration;
+import
org.apache.shardingsphere.replicaquery.yaml.config.YamlReplicaQueryRuleConfiguration;
+import
org.apache.shardingsphere.replicaquery.yaml.config.rule.YamlReplicaQueryDataSourceRuleConfiguration;
+
+/**
+ * Create replica query rule statement converter.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class CreateReplicaQueryRuleStatementConverter {
+
+ /**
+ * Convert create replica query rule statement context to YAML sharding
rule configuration.
Review comment:
context to YAML `sharding` rule configuration?
##########
File path:
shardingsphere-features/shardingsphere-replica-query/shardingsphere-replica-query-common/pom.xml
##########
@@ -29,6 +29,12 @@
<name>${project.artifactId}</name>
<dependencies>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-binder</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
Review comment:
What is the useful?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]