public static final RelOptRule[] RULES = {
MongoSortRule.INSTANCE,
MongoFilterRule.INSTANCE,
MongoProjectRule.INSTANCE,
MongoAggregateRule.INSTANCE,
};
static String isItem(RexCall call) {
if (call.getOperator() != SqlStdOperatorTable.ITEM) {
return null;
}
final RexNode op0 = call.operands.get(0);
final RexNode op1 = call.operands.get(1);
if (op0 instanceof RexInputRef
&& ((RexInputRef) op0).getIndex() == 0
&& op1 instanceof RexLiteral
&& ((RexLiteral) op1).getValue2() instanceof String) {
return (String) ((RexLiteral) op1).getValue2();
}
return null;
}
|