shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

PredicateExtractor not support String Expression

Open kofkyobsa opened this issue 7 years ago • 1 comments

sharding jdbc & proxy version:3.1.0 when i use sql like " select snapshot_no from pt_item_base_snapshot where snapshot_no ='20190304152137155168409726302111' " sharding-sphere can't get the value of column snapshot_no correctly , it's always be -1; I debug the source code ,in the class PredicateExtractor ,the method buildExpression only support number: Optional<ParserRuleContext> bitExprNode = ExtractorUtils.findFirstChildNode(valueNode, RuleName.BIT_EXPR); expressionNode = ExtractorUtils.findFirstChildNode(valueNode, RuleName.NUMBER); if (expressionNode.isPresent() && (!bitExprNode.isPresent() || 1 == bitExprNode.get().getChildCount())) { commonExpressionSegment.setValue(NumberUtil.getExactlyNumber(expressionNode.get().getText(), 10)); }

if I change code like ' expressionNode = ExtractorUtils.findFirstChildNode(valueNode, RuleName.STRING);' , the sql going well !

kofkyobsa avatar Mar 28 '19 07:03 kofkyobsa

duplicate #1754

codefairy08 avatar Mar 28 '19 07:03 codefairy08