public static int intValue(RexNode node) { final Comparable value = findValue(node); return ((Number) value).intValue(); }
public static int intValue(RexNode node) { final Comparable value = findValue(node); return ((Number) value).intValue(); }
public static String stringValue(RexNode node) { final Comparable value = findValue(node); return (value == null) ? null : ((NlsString) value).getValue(); }
public static String stringValue(RexNode node) { final Comparable value = findValue(node); return (value == null) ? null : ((NlsString) value).getValue(); }
private static Comparable findValue(RexNode node) { if (node instanceof RexLiteral) { return ((RexLiteral) node).value; } if (node instanceof RexCall) { final RexCall call = (RexCall) node; final SqlOperator operator = call.getOperator(); if (operator == SqlStdOperatorTable.castFunc) { return findValue(call.getOperands().get(0)); } if (operator == SqlStdOperatorTable.prefixMinusOperator) { final BigDecimal value = (BigDecimal) findValue(call.getOperands().get(0)); return value.negate(); } } throw Util.newInternal("not a literal: " + node); }
private static Comparable findValue(RexNode node) { if (node instanceof RexLiteral) { return ((RexLiteral) node).value; } if (node instanceof RexCall) { final RexCall call = (RexCall) node; final SqlOperator operator = call.getOperator(); if (operator == SqlStdOperatorTable.CAST) { return findValue(call.getOperands().get(0)); } if (operator == SqlStdOperatorTable.UNARY_MINUS) { final BigDecimal value = (BigDecimal) findValue(call.getOperands().get(0)); return value.negate(); } } throw Util.newInternal("not a literal: " + node); }