Loading sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/dml/select/item/ShorthandSelectItemExtractor.java +4 −4 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ import org.antlr.v4.runtime.ParserRuleContext; import org.apache.shardingsphere.core.parse.antlr.extractor.api.OptionalSQLSegmentExtractor; import org.apache.shardingsphere.core.parse.antlr.extractor.util.ExtractorUtils; import org.apache.shardingsphere.core.parse.antlr.extractor.util.RuleName; import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.StarSelectItemSegment; import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.ShorthandSelectItemSegment; /** * Shorthand select item extractor. Loading @@ -32,14 +32,14 @@ import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.StarSelec public final class ShorthandSelectItemExtractor implements OptionalSQLSegmentExtractor { @Override public Optional<StarSelectItemSegment> extract(final ParserRuleContext expressionNode) { public Optional<ShorthandSelectItemSegment> extract(final ParserRuleContext expressionNode) { Optional<ParserRuleContext> unqualifiedShorthandNode = ExtractorUtils.findFirstChildNode(expressionNode, RuleName.UNQUALIFIED_SHORTHAND); if (unqualifiedShorthandNode.isPresent()) { return Optional.of(new StarSelectItemSegment(unqualifiedShorthandNode.get().getStart().getStartIndex())); return Optional.of(new ShorthandSelectItemSegment(unqualifiedShorthandNode.get().getStart().getStartIndex())); } Optional<ParserRuleContext> qualifiedShorthandNode = ExtractorUtils.findFirstChildNode(expressionNode, RuleName.QUALIFIED_SHORTHAND); if (qualifiedShorthandNode.isPresent()) { StarSelectItemSegment result = new StarSelectItemSegment(qualifiedShorthandNode.get().getStart().getStartIndex()); ShorthandSelectItemSegment result = new ShorthandSelectItemSegment(qualifiedShorthandNode.get().getStart().getStartIndex()); result.setOwner(qualifiedShorthandNode.get().getChild(0).getText()); return Optional.of(result); } Loading sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/filler/common/dql/SelectItemFiller.java +4 −4 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.Aggregati import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.AggregationSelectItemSegment; import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.ColumnSelectItemSegment; import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.ExpressionSelectItemSegment; import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.StarSelectItemSegment; import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.ShorthandSelectItemSegment; import org.apache.shardingsphere.core.parse.antlr.sql.statement.SQLStatement; import org.apache.shardingsphere.core.parse.antlr.sql.statement.dml.SelectStatement; import org.apache.shardingsphere.core.parse.antlr.sql.token.AggregationDistinctToken; Loading Loading @@ -57,8 +57,8 @@ public final class SelectItemFiller implements SQLSegmentFiller { return; } SelectStatement selectStatement = (SelectStatement) sqlStatement; if (sqlSegment instanceof StarSelectItemSegment) { fillStarSelectItemSegment((StarSelectItemSegment) sqlSegment, selectStatement); if (sqlSegment instanceof ShorthandSelectItemSegment) { fillShorthandSelectItemSegment((ShorthandSelectItemSegment) sqlSegment, selectStatement); return; } if (sqlSegment instanceof ColumnSelectItemSegment) { Loading @@ -78,7 +78,7 @@ public final class SelectItemFiller implements SQLSegmentFiller { } } private void fillStarSelectItemSegment(final StarSelectItemSegment selectItemSegment, final SelectStatement selectStatement) { private void fillShorthandSelectItemSegment(final ShorthandSelectItemSegment selectItemSegment, final SelectStatement selectStatement) { selectStatement.setContainStar(true); Optional<String> owner = selectItemSegment.getOwner(); selectStatement.getItems().add(new StarSelectItem(owner.orNull())); Loading sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/filler/common/dql/SelectItemsFiller.java +2 −2 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.Aggregati import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.ColumnSelectItemSegment; import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.ExpressionSelectItemSegment; import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.SelectItemSegment; import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.StarSelectItemSegment; import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.ShorthandSelectItemSegment; import org.apache.shardingsphere.core.parse.antlr.sql.statement.SQLStatement; import org.apache.shardingsphere.core.parse.antlr.sql.statement.dml.SelectStatement; import org.apache.shardingsphere.core.parse.old.parser.constant.DerivedAlias; Loading Loading @@ -73,7 +73,7 @@ public final class SelectItemsFiller implements SQLSegmentFiller<SelectItemsSegm Set<String> distinctColumnNames = new LinkedHashSet<>(); DistinctSelectItem distinctSelectItem = null; int offset = 0; if (firstSelectItemSegment instanceof StarSelectItemSegment) { if (firstSelectItemSegment instanceof ShorthandSelectItemSegment) { selectItemFiller.fill(firstSelectItemSegment, selectStatement); selectStatement.getItems().add(new DistinctSelectItem(distinctColumnNames, Optional.<String>absent())); } else if (firstSelectItemSegment instanceof ColumnSelectItemSegment) { Loading sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/sql/segment/dml/item/StarSelectItemSegment.java→sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/sql/segment/dml/item/ShorthandSelectItemSegment.java +2 −2 Original line number Diff line number Diff line Loading @@ -24,13 +24,13 @@ import org.apache.shardingsphere.core.parse.antlr.sql.OwnerAvailable; import org.apache.shardingsphere.core.parse.util.SQLUtil; /** * Star select item segment. * Shorthand select item segment. * * @author zhangliang */ @RequiredArgsConstructor @Getter public final class StarSelectItemSegment implements SelectItemSegment, OwnerAvailable { public final class ShorthandSelectItemSegment implements SelectItemSegment, OwnerAvailable { private final int startIndex; Loading Loading
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/dml/select/item/ShorthandSelectItemExtractor.java +4 −4 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ import org.antlr.v4.runtime.ParserRuleContext; import org.apache.shardingsphere.core.parse.antlr.extractor.api.OptionalSQLSegmentExtractor; import org.apache.shardingsphere.core.parse.antlr.extractor.util.ExtractorUtils; import org.apache.shardingsphere.core.parse.antlr.extractor.util.RuleName; import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.StarSelectItemSegment; import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.ShorthandSelectItemSegment; /** * Shorthand select item extractor. Loading @@ -32,14 +32,14 @@ import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.StarSelec public final class ShorthandSelectItemExtractor implements OptionalSQLSegmentExtractor { @Override public Optional<StarSelectItemSegment> extract(final ParserRuleContext expressionNode) { public Optional<ShorthandSelectItemSegment> extract(final ParserRuleContext expressionNode) { Optional<ParserRuleContext> unqualifiedShorthandNode = ExtractorUtils.findFirstChildNode(expressionNode, RuleName.UNQUALIFIED_SHORTHAND); if (unqualifiedShorthandNode.isPresent()) { return Optional.of(new StarSelectItemSegment(unqualifiedShorthandNode.get().getStart().getStartIndex())); return Optional.of(new ShorthandSelectItemSegment(unqualifiedShorthandNode.get().getStart().getStartIndex())); } Optional<ParserRuleContext> qualifiedShorthandNode = ExtractorUtils.findFirstChildNode(expressionNode, RuleName.QUALIFIED_SHORTHAND); if (qualifiedShorthandNode.isPresent()) { StarSelectItemSegment result = new StarSelectItemSegment(qualifiedShorthandNode.get().getStart().getStartIndex()); ShorthandSelectItemSegment result = new ShorthandSelectItemSegment(qualifiedShorthandNode.get().getStart().getStartIndex()); result.setOwner(qualifiedShorthandNode.get().getChild(0).getText()); return Optional.of(result); } Loading
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/filler/common/dql/SelectItemFiller.java +4 −4 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.Aggregati import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.AggregationSelectItemSegment; import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.ColumnSelectItemSegment; import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.ExpressionSelectItemSegment; import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.StarSelectItemSegment; import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.ShorthandSelectItemSegment; import org.apache.shardingsphere.core.parse.antlr.sql.statement.SQLStatement; import org.apache.shardingsphere.core.parse.antlr.sql.statement.dml.SelectStatement; import org.apache.shardingsphere.core.parse.antlr.sql.token.AggregationDistinctToken; Loading Loading @@ -57,8 +57,8 @@ public final class SelectItemFiller implements SQLSegmentFiller { return; } SelectStatement selectStatement = (SelectStatement) sqlStatement; if (sqlSegment instanceof StarSelectItemSegment) { fillStarSelectItemSegment((StarSelectItemSegment) sqlSegment, selectStatement); if (sqlSegment instanceof ShorthandSelectItemSegment) { fillShorthandSelectItemSegment((ShorthandSelectItemSegment) sqlSegment, selectStatement); return; } if (sqlSegment instanceof ColumnSelectItemSegment) { Loading @@ -78,7 +78,7 @@ public final class SelectItemFiller implements SQLSegmentFiller { } } private void fillStarSelectItemSegment(final StarSelectItemSegment selectItemSegment, final SelectStatement selectStatement) { private void fillShorthandSelectItemSegment(final ShorthandSelectItemSegment selectItemSegment, final SelectStatement selectStatement) { selectStatement.setContainStar(true); Optional<String> owner = selectItemSegment.getOwner(); selectStatement.getItems().add(new StarSelectItem(owner.orNull())); Loading
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/filler/common/dql/SelectItemsFiller.java +2 −2 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.Aggregati import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.ColumnSelectItemSegment; import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.ExpressionSelectItemSegment; import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.SelectItemSegment; import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.StarSelectItemSegment; import org.apache.shardingsphere.core.parse.antlr.sql.segment.dml.item.ShorthandSelectItemSegment; import org.apache.shardingsphere.core.parse.antlr.sql.statement.SQLStatement; import org.apache.shardingsphere.core.parse.antlr.sql.statement.dml.SelectStatement; import org.apache.shardingsphere.core.parse.old.parser.constant.DerivedAlias; Loading Loading @@ -73,7 +73,7 @@ public final class SelectItemsFiller implements SQLSegmentFiller<SelectItemsSegm Set<String> distinctColumnNames = new LinkedHashSet<>(); DistinctSelectItem distinctSelectItem = null; int offset = 0; if (firstSelectItemSegment instanceof StarSelectItemSegment) { if (firstSelectItemSegment instanceof ShorthandSelectItemSegment) { selectItemFiller.fill(firstSelectItemSegment, selectStatement); selectStatement.getItems().add(new DistinctSelectItem(distinctColumnNames, Optional.<String>absent())); } else if (firstSelectItemSegment instanceof ColumnSelectItemSegment) { Loading
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/sql/segment/dml/item/StarSelectItemSegment.java→sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/sql/segment/dml/item/ShorthandSelectItemSegment.java +2 −2 Original line number Diff line number Diff line Loading @@ -24,13 +24,13 @@ import org.apache.shardingsphere.core.parse.antlr.sql.OwnerAvailable; import org.apache.shardingsphere.core.parse.util.SQLUtil; /** * Star select item segment. * Shorthand select item segment. * * @author zhangliang */ @RequiredArgsConstructor @Getter public final class StarSelectItemSegment implements SelectItemSegment, OwnerAvailable { public final class ShorthandSelectItemSegment implements SelectItemSegment, OwnerAvailable { private final int startIndex; Loading