use of io.mycat.calcite.table.ShardingTable in project Mycat2 by MyCATApache.
the class PredicateAnalyzerTest method testOr.
//
@Test
public void testOr() {
DrdsSqlCompiler drds = DrdsTest.getDrds();
RexNode leftRexNode = rexBuilder.makeCall(SqlStdOperatorTable.GREATER_THAN, rexBuilder.makeInputRef(MycatCalciteSupport.TypeFactory.createSqlType(SqlTypeName.INTEGER), 0), rexBuilder.makeDynamicParam(MycatCalciteSupport.TypeFactory.createSqlType(SqlTypeName.INTEGER), 0));
RexNode rightRexNode = rexBuilder.makeCall(SqlStdOperatorTable.LESS_THAN, rexBuilder.makeInputRef(MycatCalciteSupport.TypeFactory.createSqlType(SqlTypeName.INTEGER), 0), rexBuilder.makeDynamicParam(MycatCalciteSupport.TypeFactory.createSqlType(SqlTypeName.INTEGER), 1));
RexNode rexNode = rexBuilder.makeCall(SqlStdOperatorTable.OR, leftRexNode, rightRexNode);
List<String> columnList = Arrays.asList("id");
PredicateAnalyzer predicateAnalyzer2 = new PredicateAnalyzer(Arrays.asList(KeyMeta.of("default", Arrays.asList("id"))), columnList);
MetadataManager metadataManager = DrdsTest.getMetadataManager();
ShardingTable table = (ShardingTable) metadataManager.getTable("db1", "sharding");
Map<QueryType, List<IndexCondition>> queryTypeListMap = predicateAnalyzer2.translateMatch(rexNode);
Assert.assertEquals(0, queryTypeListMap.size());
System.out.println();
}
Aggregations