Loading sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/dml/WhereExtractor.java +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ public final class WhereExtractor implements OptionalSQLSegmentExtractor { @Override public Optional<WhereSegment> extract(final ParserRuleContext ancestorNode, final Map<ParserRuleContext, Integer> parameterMarkerIndexes) { WhereSegment result = new WhereSegment(parameterMarkerIndexes.size()); Optional<ParserRuleContext> whereNode = ExtractorUtils.findFirstChildNodeBreadthFirst(ancestorNode, RuleName.WHERE_CLAUSE); Optional<ParserRuleContext> whereNode = ExtractorUtils.findFirstChildNode(ancestorNode, RuleName.WHERE_CLAUSE); if (whereNode.isPresent()) { setPropertiesForRevert(result, whereNode.get(), parameterMarkerIndexes); Optional<OrPredicateSegment> orConditionSegment = extractOrConditionSegment(whereNode.get(), parameterMarkerIndexes); Loading sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/util/ExtractorUtils.java +0 −23 Original line number Diff line number Diff line Loading @@ -57,29 +57,6 @@ public final class ExtractorUtils { * @return matched node */ public static Optional<ParserRuleContext> findFirstChildNode(final ParserRuleContext node, final RuleName ruleName) { if (isMatchedNode(node, ruleName)) { return Optional.of(node); } for (int i = 0; i < node.getChildCount(); i++) { ParseTree child = node.getChild(i); if (child instanceof ParserRuleContext) { Optional<ParserRuleContext> result = findFirstChildNode((ParserRuleContext) child, ruleName); if (result.isPresent()) { return result; } } } return Optional.absent(); } /** * Find first child node breadth first. * * @param node start node * @param ruleName rule name * @return matched node */ public static Optional<ParserRuleContext> findFirstChildNodeBreadthFirst(final ParserRuleContext node, final RuleName ruleName) { Queue<ParserRuleContext> parserRuleContexts = new LinkedList<>(); parserRuleContexts.add(node); ParserRuleContext parserRuleContext; Loading Loading
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/impl/dml/WhereExtractor.java +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ public final class WhereExtractor implements OptionalSQLSegmentExtractor { @Override public Optional<WhereSegment> extract(final ParserRuleContext ancestorNode, final Map<ParserRuleContext, Integer> parameterMarkerIndexes) { WhereSegment result = new WhereSegment(parameterMarkerIndexes.size()); Optional<ParserRuleContext> whereNode = ExtractorUtils.findFirstChildNodeBreadthFirst(ancestorNode, RuleName.WHERE_CLAUSE); Optional<ParserRuleContext> whereNode = ExtractorUtils.findFirstChildNode(ancestorNode, RuleName.WHERE_CLAUSE); if (whereNode.isPresent()) { setPropertiesForRevert(result, whereNode.get(), parameterMarkerIndexes); Optional<OrPredicateSegment> orConditionSegment = extractOrConditionSegment(whereNode.get(), parameterMarkerIndexes); Loading
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/extractor/util/ExtractorUtils.java +0 −23 Original line number Diff line number Diff line Loading @@ -57,29 +57,6 @@ public final class ExtractorUtils { * @return matched node */ public static Optional<ParserRuleContext> findFirstChildNode(final ParserRuleContext node, final RuleName ruleName) { if (isMatchedNode(node, ruleName)) { return Optional.of(node); } for (int i = 0; i < node.getChildCount(); i++) { ParseTree child = node.getChild(i); if (child instanceof ParserRuleContext) { Optional<ParserRuleContext> result = findFirstChildNode((ParserRuleContext) child, ruleName); if (result.isPresent()) { return result; } } } return Optional.absent(); } /** * Find first child node breadth first. * * @param node start node * @param ruleName rule name * @return matched node */ public static Optional<ParserRuleContext> findFirstChildNodeBreadthFirst(final ParserRuleContext node, final RuleName ruleName) { Queue<ParserRuleContext> parserRuleContexts = new LinkedList<>(); parserRuleContexts.add(node); ParserRuleContext parserRuleContext; Loading