Skip to content

Commit

Permalink
refactor extractor package
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Jan 2, 2019
1 parent 0f9ea71 commit a960ac5
Show file tree
Hide file tree
Showing 31 changed files with 60 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

import com.google.common.base.Optional;
import io.shardingsphere.core.parsing.antlr.extractor.OptionalSQLSegmentExtractor;
import io.shardingsphere.core.parsing.antlr.extractor.impl.dql.GroupByExtractor;
import io.shardingsphere.core.parsing.antlr.extractor.impl.dql.OrderByExtractor;
import io.shardingsphere.core.parsing.antlr.extractor.impl.dql.SelectClauseExtractor;
import io.shardingsphere.core.parsing.antlr.extractor.util.ExtractorUtils;
import io.shardingsphere.core.parsing.antlr.extractor.util.RuleName;
import io.shardingsphere.core.parsing.antlr.sql.segment.FromWhereSegment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl.dialect.postgresql;
package io.shardingsphere.core.parsing.antlr.extractor.impl.dal.dialect.postgresql;

import com.google.common.base.Optional;
import io.shardingsphere.core.parsing.antlr.extractor.OptionalSQLSegmentExtractor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl.definition.column;
package io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column;

import com.google.common.base.Optional;
import io.shardingsphere.core.parsing.antlr.extractor.CollectionSQLSegmentExtractor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl.definition.column;
package io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column;

import com.google.common.base.Optional;
import io.shardingsphere.core.parsing.antlr.extractor.OptionalSQLSegmentExtractor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl.definition.column;
package io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column;

import com.google.common.base.Optional;
import io.shardingsphere.core.parsing.antlr.extractor.CollectionSQLSegmentExtractor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl.definition.column;
package io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column;

import io.shardingsphere.core.parsing.antlr.extractor.CollectionSQLSegmentExtractor;
import io.shardingsphere.core.parsing.antlr.extractor.util.ExtractorUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl.definition.column;
package io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column;

import com.google.common.base.Optional;
import io.shardingsphere.core.parsing.antlr.extractor.CollectionSQLSegmentExtractor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,17 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl.definition.column;

import java.util.Collection;
import java.util.Iterator;

import org.antlr.v4.runtime.ParserRuleContext;
package io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column;

import com.google.common.base.Optional;

import io.shardingsphere.core.parsing.antlr.extractor.OptionalSQLSegmentExtractor;
import io.shardingsphere.core.parsing.antlr.extractor.util.ExtractorUtils;
import io.shardingsphere.core.parsing.antlr.extractor.util.RuleName;
import io.shardingsphere.core.parsing.antlr.sql.segment.definition.column.alter.RenameColumnSegment;
import org.antlr.v4.runtime.ParserRuleContext;

import java.util.Collection;
import java.util.Iterator;

/**
* Rename column definition extractor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl.dialect.mysql.definition.column;
package io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column.dialect.mysql;

import com.google.common.base.Optional;
import io.shardingsphere.core.parsing.antlr.extractor.impl.definition.column.AddColumnDefinitionExtractor;
import io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column.AddColumnDefinitionExtractor;
import io.shardingsphere.core.parsing.antlr.sql.segment.definition.column.alter.AddColumnDefinitionSegment;
import io.shardingsphere.core.parsing.antlr.sql.segment.definition.column.position.ColumnPositionSegment;
import org.antlr.v4.runtime.ParserRuleContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl.dialect.mysql.definition.column;
package io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column.dialect.mysql;

import com.google.common.base.Optional;
import io.shardingsphere.core.parsing.antlr.extractor.OptionalSQLSegmentExtractor;
import io.shardingsphere.core.parsing.antlr.extractor.impl.definition.column.ColumnDefinitionExtractor;
import io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column.ColumnDefinitionExtractor;
import io.shardingsphere.core.parsing.antlr.extractor.util.ExtractorUtils;
import io.shardingsphere.core.parsing.antlr.extractor.util.RuleName;
import io.shardingsphere.core.parsing.antlr.sql.segment.definition.column.ColumnDefinitionSegment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl.dialect.mysql.definition.column;
package io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column.dialect.mysql;

import com.google.common.base.Optional;
import io.shardingsphere.core.parsing.antlr.extractor.OptionalSQLSegmentExtractor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl.dialect.mysql.definition.column;
package io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column.dialect.mysql;

import com.google.common.base.Optional;
import io.shardingsphere.core.parsing.antlr.extractor.impl.definition.column.ModifyColumnDefinitionExtractor;
import io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column.ModifyColumnDefinitionExtractor;
import io.shardingsphere.core.parsing.antlr.sql.segment.definition.column.alter.ModifyColumnDefinitionSegment;
import io.shardingsphere.core.parsing.antlr.sql.segment.definition.column.position.ColumnPositionSegment;
import org.antlr.v4.runtime.ParserRuleContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl.dialect.oracle.definition.column;
package io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column.dialect.oracle;

import com.google.common.base.Optional;
import io.shardingsphere.core.parsing.antlr.extractor.CollectionSQLSegmentExtractor;
import io.shardingsphere.core.parsing.antlr.extractor.impl.definition.column.ColumnDefinitionExtractor;
import io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column.ColumnDefinitionExtractor;
import io.shardingsphere.core.parsing.antlr.extractor.util.ExtractorUtils;
import io.shardingsphere.core.parsing.antlr.extractor.util.RuleName;
import io.shardingsphere.core.parsing.antlr.sql.segment.definition.column.ColumnDefinitionSegment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl.definition.constraint;
package io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.constraint;

import com.google.common.base.Optional;
import io.shardingsphere.core.parsing.antlr.extractor.OptionalSQLSegmentExtractor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl.dialect.mysql.definition.constraint;
package io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.constraint.dialect.mysql;

import com.google.common.base.Optional;
import io.shardingsphere.core.parsing.antlr.extractor.OptionalSQLSegmentExtractor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl.dialect.oracle.definition.constraint;
package io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.constraint.dialect.oracle;

import com.google.common.base.Optional;
import io.shardingsphere.core.parsing.antlr.extractor.OptionalSQLSegmentExtractor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl.dialect.sqlserver.definition.constraint;
package io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.constraint.dialect.sqlserver;

import com.google.common.base.Optional;
import io.shardingsphere.core.parsing.antlr.extractor.OptionalSQLSegmentExtractor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl.definition.index;
package io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.index;

import com.google.common.base.Optional;
import io.shardingsphere.core.parsing.antlr.extractor.OptionalSQLSegmentExtractor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl.definition.index;
package io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.index;

import com.google.common.base.Optional;
import io.shardingsphere.core.parsing.antlr.extractor.CollectionSQLSegmentExtractor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl.definition.table;
package io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.table;

import com.google.common.base.Optional;
import io.shardingsphere.core.parsing.antlr.extractor.OptionalSQLSegmentExtractor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl;
package io.shardingsphere.core.parsing.antlr.extractor.impl.dql;

import com.google.common.base.Optional;
import io.shardingsphere.core.parsing.antlr.extractor.OptionalSQLSegmentExtractor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl;
package io.shardingsphere.core.parsing.antlr.extractor.impl.dql;

import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl;
package io.shardingsphere.core.parsing.antlr.extractor.impl.dql;

import com.google.common.base.Optional;
import io.shardingsphere.core.parsing.antlr.extractor.OptionalSQLSegmentExtractor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl;
package io.shardingsphere.core.parsing.antlr.extractor.impl.dql;

import com.google.common.base.Optional;
import io.shardingsphere.core.constant.OrderDirection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
* </p>
*/

package io.shardingsphere.core.parsing.antlr.extractor.impl;
package io.shardingsphere.core.parsing.antlr.extractor.impl.dql;

import com.google.common.base.Optional;
import io.shardingsphere.core.parsing.antlr.extractor.OptionalSQLSegmentExtractor;
import io.shardingsphere.core.parsing.antlr.extractor.impl.ExpressionExtractor;
import io.shardingsphere.core.parsing.antlr.extractor.util.ExtractorUtils;
import io.shardingsphere.core.parsing.antlr.extractor.util.RuleName;
import io.shardingsphere.core.parsing.antlr.sql.segment.SelectClauseSegment;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ public final class OrderByFiller implements SQLStatementFiller<OrderBySegment> {
@Override
public void fill(final OrderBySegment sqlSegment, final SQLStatement sqlStatement, final String sql, final ShardingRule shardingRule, final ShardingTableMetaData shardingTableMetaData) {
SelectStatement selectStatement = (SelectStatement) sqlStatement;
if (!selectStatement.getSubQueryStatements().isEmpty()) {
return;
}
for (OrderByItemSegment each : sqlSegment.getOrderByItems()) {
selectStatement.getOrderByItems().add(new OrderItemBuilder(selectStatement, each).createOrderItem());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
<extractor-rule-definition>
<extractor-rule id="tableName" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.TableNameExtractor" />
<extractor-rule id="tableNames" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.TableNamesExtractor" />
<extractor-rule id="indexName" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.definition.index.IndexNameExtractor" />
<extractor-rule id="indexNames" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.definition.index.IndexNamesExtractor" />
<extractor-rule id="columnDefinitions" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.definition.column.ColumnDefinitionsExtractor" />
<extractor-rule id="outlinePrimaryKey" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.definition.constraint.OutlinePrimaryKeyExtractor" />
<extractor-rule id="renameTable" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.definition.table.RenameTableExtractor" />
<extractor-rule id="renameColumnDefinition" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.definition.column.RenameColumnDefinitionExtractor" />
<extractor-rule id="dropColumnDefinition" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.definition.column.DropColumnDefinitionExtractor" />
<extractor-rule id="indexName" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.index.IndexNameExtractor" />
<extractor-rule id="indexNames" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.index.IndexNamesExtractor" />
<extractor-rule id="columnDefinitions" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column.ColumnDefinitionsExtractor" />
<extractor-rule id="outlinePrimaryKey" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.constraint.OutlinePrimaryKeyExtractor" />
<extractor-rule id="renameTable" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.table.RenameTableExtractor" />
<extractor-rule id="renameColumnDefinition" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column.RenameColumnDefinitionExtractor" />
<extractor-rule id="dropColumnDefinition" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column.DropColumnDefinitionExtractor" />

<extractor-rule id="selectClause" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.SelectClauseExtractor" />
<extractor-rule id="selectClause" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.dql.SelectClauseExtractor" />
<extractor-rule id="fromWhere" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.FromWhereExtractor" />
<extractor-rule id="groupBy" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.GroupByExtractor" />
<extractor-rule id="orderBy" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.OrderByExtractor" />
<extractor-rule id="limit" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.LimitExtractor" />
<extractor-rule id="groupBy" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.dql.GroupByExtractor" />
<extractor-rule id="orderBy" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.dql.OrderByExtractor" />
<extractor-rule id="limit" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.dql.LimitExtractor" />
<extractor-rule id="subQueryCondition" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.SubQueryConditionExtractor" />
</extractor-rule-definition>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<extractor-rule-definition>
<extractor-rule id="addColumnDefinition" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.dialect.mysql.definition.column.MySQLAddColumnDefinitionExtractor" />
<extractor-rule id="modifyColumnDefinition" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.dialect.mysql.definition.column.MySQLModifyColumnDefinitionExtractor" />
<extractor-rule id="changeColumnDefinition" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.dialect.mysql.definition.column.MySQLChangeColumnDefinitionExtractor" />
<extractor-rule id="dropPrimaryKey" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.dialect.mysql.definition.constraint.MySQLDropPrimaryKeyExtractor" />
<extractor-rule id="addColumnDefinition" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column.dialect.mysql.MySQLAddColumnDefinitionExtractor" />
<extractor-rule id="modifyColumnDefinition" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column.dialect.mysql.MySQLModifyColumnDefinitionExtractor" />
<extractor-rule id="changeColumnDefinition" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column.dialect.mysql.MySQLChangeColumnDefinitionExtractor" />
<extractor-rule id="dropPrimaryKey" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.constraint.dialect.mysql.MySQLDropPrimaryKeyExtractor" />
<extractor-rule id="setAutoCommit" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.SetAutoCommitExtractor" />
</extractor-rule-definition>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<extractor-rule-definition>
<extractor-rule id="addColumnDefinition" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.definition.column.AddColumnDefinitionExtractor"/>
<extractor-rule id="modifyColumnDefinition" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.dialect.oracle.definition.column.OracleModifyColumnDefinitionExtractor" />
<extractor-rule id="dropPrimaryKey" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.dialect.oracle.definition.constraint.OracleDropPrimaryKeyExtractor" />
<extractor-rule id="addColumnDefinition" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column.AddColumnDefinitionExtractor"/>
<extractor-rule id="modifyColumnDefinition" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column.dialect.oracle.OracleModifyColumnDefinitionExtractor" />
<extractor-rule id="dropPrimaryKey" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.constraint.dialect.oracle.OracleDropPrimaryKeyExtractor" />
</extractor-rule-definition>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<extractor-rule-definition>
<extractor-rule id="addColumnDefinition" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.definition.column.AddColumnDefinitionExtractor" />
<extractor-rule id="modifyColumnDefinition" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.definition.column.ModifyColumnDefinitionExtractor" />
<extractor-rule id="showParam" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.dialect.postgresql.ShowParamExtractor" />
<extractor-rule id="addColumnDefinition" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column.AddColumnDefinitionExtractor" />
<extractor-rule id="modifyColumnDefinition" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.ddl.column.ModifyColumnDefinitionExtractor" />
<extractor-rule id="showParam" extractor-class="io.shardingsphere.core.parsing.antlr.extractor.impl.dal.dialect.postgresql.ShowParamExtractor" />
</extractor-rule-definition>
Loading

0 comments on commit a960ac5

Please sign in to comment.