Skip to content

Commit

Permalink
Rename RDL to DistSQL (apache#7964)
Browse files Browse the repository at this point in the history
* Remove useless ShardingSphereVisitor.getter

* Rename RDLVisitor

* Rename RDL to DistSQL

* Rename RDL module name

* Rename RDL package name

* Rename RDL class name
  • Loading branch information
terrymanu authored Oct 29, 2020
1 parent b038989 commit a06b568
Show file tree
Hide file tree
Showing 47 changed files with 114 additions and 117 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<modules>
<module>shardingsphere-sql-parser</module>
<module>shardingsphere-rdl-parser</module>
<module>shardingsphere-distsql-parser</module>
<module>shardingsphere-db-protocol</module>
<module>shardingsphere-infra</module>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
<artifactId>shardingsphere</artifactId>
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>shardingsphere-rdl-parser</artifactId>
<artifactId>shardingsphere-distsql-parser</artifactId>
<packaging>pom</packaging>
<name>${project.artifactId}</name>

<modules>
<module>shardingsphere-rdl-parser-sql</module>
<module>shardingsphere-rdl-parser-statement</module>
<module>shardingsphere-rdl-parser-engine</module>
<module>shardingsphere-rdl-parser-binder</module>
<module>shardingsphere-distsql-parser-sql</module>
<module>shardingsphere-distsql-parser-statement</module>
<module>shardingsphere-distsql-parser-engine</module>
<module>shardingsphere-distsql-parser-binder</module>
</modules>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-rdl-parser</artifactId>
<artifactId>shardingsphere-distsql-parser</artifactId>
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<artifactId>shardingsphere-rdl-parser-binder</artifactId>
<artifactId>shardingsphere-distsql-parser-binder</artifactId>
<name>${project.artifactId}</name>

<dependencies>
Expand All @@ -36,7 +36,7 @@
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-rdl-parser-statement</artifactId>
<artifactId>shardingsphere-distsql-parser-statement</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
* limitations under the License.
*/

package org.apache.shardingsphere.rdl.parser.binder.context;
package org.apache.shardingsphere.distsql.parser.binder.context;

import lombok.Getter;
import org.apache.shardingsphere.infra.database.type.DatabaseType;
import org.apache.shardingsphere.rdl.parser.binder.util.DataSourceConnectionUrlUtil;
import org.apache.shardingsphere.rdl.parser.statement.rdl.CreateDataSourcesStatement;
import org.apache.shardingsphere.rdl.parser.statement.rdl.DataSourceConnectionSegment;
import org.apache.shardingsphere.distsql.parser.binder.util.DataSourceConnectionUrlUtil;
import org.apache.shardingsphere.distsql.parser.statement.rdl.CreateDataSourcesStatement;
import org.apache.shardingsphere.distsql.parser.statement.rdl.DataSourceConnectionSegment;
import org.apache.shardingsphere.infra.binder.statement.CommonSQLStatementContext;

/**
Expand All @@ -38,10 +38,10 @@ public CreateDataSourcesStatementContext(final CreateDataSourcesStatement sqlSta
}

/**
* Get url.
* Get URL.
*
* @param segment segment
* @return url
* @return URL
*/
public String getUrl(final DataSourceConnectionSegment segment) {
return DataSourceConnectionUrlUtil.getUrl(segment, databaseType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
* limitations under the License.
*/

package org.apache.shardingsphere.rdl.parser.binder.context;
package org.apache.shardingsphere.distsql.parser.binder.context;

import org.apache.shardingsphere.rdl.parser.binder.util.ShardingAlgorithmPropertiesUtil;
import org.apache.shardingsphere.rdl.parser.statement.rdl.CreateShardingRuleStatement;
import org.apache.shardingsphere.rdl.parser.statement.rdl.TableRuleSegment;
import org.apache.shardingsphere.distsql.parser.binder.util.ShardingAlgorithmPropertiesUtil;
import org.apache.shardingsphere.distsql.parser.statement.rdl.CreateShardingRuleStatement;
import org.apache.shardingsphere.distsql.parser.statement.rdl.TableRuleSegment;
import org.apache.shardingsphere.infra.binder.statement.CommonSQLStatementContext;

import java.util.Properties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.rdl.parser.binder.generator;
package org.apache.shardingsphere.distsql.parser.binder.generator;

import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
* limitations under the License.
*/

package org.apache.shardingsphere.rdl.parser.binder.util;
package org.apache.shardingsphere.distsql.parser.binder.util;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.infra.database.type.DatabaseType;

import org.apache.shardingsphere.rdl.parser.statement.rdl.DataSourceConnectionSegment;
import org.apache.shardingsphere.distsql.parser.statement.rdl.DataSourceConnectionSegment;

/**
* Data source connection url util.
Expand All @@ -30,11 +30,11 @@
public final class DataSourceConnectionUrlUtil {

/**
* Get url.
* Get URL.
*
* @param connectionSegment connection segment
* @param databaseType database type
* @return url
* @return URL
*/
public static String getUrl(final DataSourceConnectionSegment connectionSegment, final DatabaseType databaseType) {
return getUrl(connectionSegment, databaseType.getJdbcUrlPrefixes().iterator().next());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.rdl.parser.binder.util;
package org.apache.shardingsphere.distsql.parser.binder.util;

import com.google.common.base.Preconditions;
import lombok.AccessLevel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
* limitations under the License.
*/

package org.apache.shardingsphere.rdl.parser.binder.util;
package org.apache.shardingsphere.distsql.parser.binder.util;

import org.apache.shardingsphere.infra.database.type.dialect.MariaDBDatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.MySQLDatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.OracleDatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.PostgreSQLDatabaseType;
import org.apache.shardingsphere.infra.database.type.dialect.SQLServerDatabaseType;
import org.apache.shardingsphere.rdl.parser.statement.rdl.DataSourceConnectionSegment;
import org.apache.shardingsphere.distsql.parser.statement.rdl.DataSourceConnectionSegment;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>shardingsphere-rdl-parser</artifactId>
<artifactId>shardingsphere-distsql-parser</artifactId>
<groupId>org.apache.shardingsphere</groupId>
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>shardingsphere-rdl-parser-engine</artifactId>
<artifactId>shardingsphere-distsql-parser-engine</artifactId>

<dependencies>
<dependency>
Expand All @@ -44,7 +44,7 @@
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-rdl-parser-sql</artifactId>
<artifactId>shardingsphere-distsql-parser-sql</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
* limitations under the License.
*/

package org.apache.shardingsphere.rdl.parser.engine;
package org.apache.shardingsphere.distsql.parser.engine;

import org.apache.shardingsphere.distsql.parser.engine.engine.DistSQLStatementParserEngine;
import org.apache.shardingsphere.infra.parser.SQLStatementParserEngine;
import org.apache.shardingsphere.infra.parser.standard.StandardSQLStatementParserEngine;
import org.apache.shardingsphere.infra.parser.standard.StandardSQLStatementParserEngineFactory;
import org.apache.shardingsphere.rdl.parser.engine.engine.RDLSQLStatementParserEngine;
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;

/**
Expand All @@ -30,11 +30,11 @@ public final class ShardingSphereSQLStatementParserEngine implements SQLStatemen

private final StandardSQLStatementParserEngine standardSQLStatementParserEngine;

private final RDLSQLStatementParserEngine rdlSQLStatementParserEngine;
private final DistSQLStatementParserEngine distSQLStatementParserEngine;

public ShardingSphereSQLStatementParserEngine(final String databaseTypeName) {
standardSQLStatementParserEngine = StandardSQLStatementParserEngineFactory.getSQLStatementParserEngine(databaseTypeName);
rdlSQLStatementParserEngine = new RDLSQLStatementParserEngine();
distSQLStatementParserEngine = new DistSQLStatementParserEngine();
}

@Override
Expand All @@ -45,7 +45,7 @@ public SQLStatement parse(final String sql, final boolean useCache) {
// CHECKSTYLE:OFF
} catch (final Exception ex) {
// CHECKSTYLE:ON
result = rdlSQLStatementParserEngine.parse(sql, useCache);
result = distSQLStatementParserEngine.parse(sql, useCache);
}
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@
* limitations under the License.
*/

package org.apache.shardingsphere.rdl.parser.engine.engine;
package org.apache.shardingsphere.distsql.parser.engine.engine;

import lombok.RequiredArgsConstructor;
import org.antlr.v4.runtime.tree.ParseTree;
import org.apache.shardingsphere.distsql.parser.engine.executor.DistSQLParserExecutor;
import org.apache.shardingsphere.infra.parser.SQLStatementParserEngine;
import org.apache.shardingsphere.rdl.parser.engine.executor.RDLSQLParserExecutor;
import org.apache.shardingsphere.rdl.parser.sql.visitor.ShardingSphereVisitor;
import org.apache.shardingsphere.distsql.parser.sql.visitor.DistSQLStatementVisitor;
import org.apache.shardingsphere.sql.parser.hook.ParsingHookRegistry;
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;

/**
* RDL SQL statement parser engine.
* Dist SQL statement parser engine.
*/
@RequiredArgsConstructor
public final class RDLSQLStatementParserEngine implements SQLStatementParserEngine {
public final class DistSQLStatementParserEngine implements SQLStatementParserEngine {

private final ParsingHookRegistry parsingHookRegistry = ParsingHookRegistry.getInstance();

Expand All @@ -43,8 +43,8 @@ public final class RDLSQLStatementParserEngine implements SQLStatementParserEngi
public SQLStatement parse(final String sql, final boolean useCache) {
parsingHookRegistry.start(sql);
try {
ParseTree parseTree = new RDLSQLParserExecutor(sql).execute().getRootNode();
SQLStatement result = (SQLStatement) new ShardingSphereVisitor().visit(parseTree);
ParseTree parseTree = new DistSQLParserExecutor(sql).execute().getRootNode();
SQLStatement result = (SQLStatement) new DistSQLStatementVisitor().visit(parseTree);
parsingHookRegistry.finishSuccess(result);
return result;
// CHECKSTYLE:OFF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

package org.apache.shardingsphere.rdl.parser.engine.executor;
package org.apache.shardingsphere.distsql.parser.engine.executor;

import lombok.RequiredArgsConstructor;
import org.antlr.v4.runtime.BailErrorStrategy;
Expand All @@ -28,19 +28,19 @@
import org.antlr.v4.runtime.atn.PredictionMode;
import org.antlr.v4.runtime.misc.ParseCancellationException;
import org.antlr.v4.runtime.tree.ErrorNode;
import org.apache.shardingsphere.rdl.parser.autogen.ShardingSphereStatementLexer;
import org.apache.shardingsphere.rdl.parser.sql.parser.ShardingSphereParser;
import org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementLexer;
import org.apache.shardingsphere.distsql.parser.sql.parser.DistSQLParser;
import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
import org.apache.shardingsphere.sql.parser.core.parser.ParseASTNode;
import org.apache.shardingsphere.sql.parser.exception.SQLParsingException;

import java.nio.CharBuffer;

/**
* RDL SQL parser executor.
* Dist SQL parser executor.
*/
@RequiredArgsConstructor
public final class RDLSQLParserExecutor {
public final class DistSQLParserExecutor {

private final String sql;

Expand Down Expand Up @@ -74,7 +74,7 @@ private ParseASTNode twoPhaseParse() {
private SQLParser createSQLParser() {
CodePointBuffer buffer = CodePointBuffer.withChars(CharBuffer.wrap(sql.toCharArray()));
CodePointCharStream codePointCharStream = CodePointCharStream.fromBuffer(buffer);
Lexer lexer = new ShardingSphereStatementLexer(codePointCharStream);
return new ShardingSphereParser(new CommonTokenStream(lexer));
Lexer lexer = new DistSQLStatementLexer(codePointCharStream);
return new DistSQLParser(new CommonTokenStream(lexer));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>shardingsphere-rdl-parser</artifactId>
<artifactId>shardingsphere-distsql-parser</artifactId>
<groupId>org.apache.shardingsphere</groupId>
<version>5.0.0-RC1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>shardingsphere-rdl-parser-sql</artifactId>
<artifactId>shardingsphere-distsql-parser-sql</artifactId>

<dependencies>
<dependency>
Expand All @@ -38,7 +38,7 @@
</dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-rdl-parser-statement</artifactId>
<artifactId>shardingsphere-distsql-parser-statement</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

grammar ShardingSphereStatement;
grammar DistSQLStatement;

import Symbol, RDLStatement;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@
* limitations under the License.
*/

package org.apache.shardingsphere.rdl.parser.sql.parser;
package org.apache.shardingsphere.distsql.parser.sql.parser;

import org.antlr.v4.runtime.TokenStream;
import org.apache.shardingsphere.rdl.parser.autogen.ShardingSphereStatementParser;
import org.apache.shardingsphere.sql.parser.api.visitor.ASTNode;
import org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser;
import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
import org.apache.shardingsphere.sql.parser.api.visitor.ASTNode;
import org.apache.shardingsphere.sql.parser.core.parser.ParseASTNode;

/**
* SQL parser for RDL.
* SQL parser for Dist SQL.
*/
public final class ShardingSphereParser extends ShardingSphereStatementParser implements SQLParser {
public final class DistSQLParser extends DistSQLStatementParser implements SQLParser {

public ShardingSphereParser(final TokenStream input) {
public DistSQLParser(final TokenStream input) {
super(input);
}

Expand Down
Loading

0 comments on commit a06b568

Please sign in to comment.