public RexNode lookupAggregates(SqlCall call) { // assert call.getOperator().isAggregator(); assert bb.agg == this; for (Map.Entry<SqlNode, Ord<AuxiliaryConverter>> e : auxiliaryGroupExprs.entrySet()) { if (call.equalsDeep(e.getKey(), Litmus.IGNORE)) { AuxiliaryConverter converter = e.getValue().e; final int groupOrdinal = e.getValue().i; return converter.convert(rexBuilder, convertedInputExprs.get(groupOrdinal).left, rexBuilder.makeInputRef(bb.root, groupOrdinal)); } } return aggMapping.get(call); }
public RexNode lookupAggregates(SqlCall call) { // assert call.getOperator().isAggregator(); assert bb.agg == this; for (Map.Entry<SqlNode, Ord<AuxiliaryConverter>> e : auxiliaryGroupExprs.entrySet()) { if (call.equalsDeep(e.getKey(), Litmus.IGNORE)) { AuxiliaryConverter converter = e.getValue().e; final int groupOrdinal = e.getValue().i; return converter.convert(rexBuilder, convertedInputExprs.get(groupOrdinal).left, rexBuilder.makeInputRef(bb.root, groupOrdinal)); } } return aggMapping.get(call); }
if (call.equalsDeep(e.getKey(), Litmus.IGNORE)) { AuxiliaryConverter converter = e.getValue().e; final int groupOrdinal = e.getValue().i;
if (call.equalsDeep(e.getKey(), Litmus.IGNORE)) { AuxiliaryConverter converter = e.getValue().e; final int groupOrdinal = e.getValue().i;
protected void assertExprPrintsTo( boolean newlines, final String sql, String expected) { final SqlCall valuesCall = (SqlCall) parseQuery("VALUES (" + sql + ")"); final SqlCall rowCall = valuesCall.operand(0); final SqlNode node = rowCall.operand(0); final SqlPrettyWriter prettyWriter = new SqlPrettyWriter(AnsiSqlDialect.DEFAULT); prettyWriter.setAlwaysUseParentheses(false); if (newlines) { prettyWriter.setCaseClausesOnNewLines(true); } String actual = prettyWriter.format(node); getDiffRepos().assertEquals("formatted", expected, actual); // Now parse the result, and make sure it is structurally equivalent // to the original. final String actual2 = actual.replaceAll("`", "\""); final SqlNode valuesCall2 = parseQuery("VALUES (" + actual2 + ")"); assertTrue(valuesCall.equalsDeep(valuesCall2, Litmus.THROW)); }
protected void assertExprPrintsTo( boolean newlines, final String sql, String expected) { final SqlCall valuesCall = (SqlCall) parseQuery("VALUES (" + sql + ")"); final SqlCall rowCall = valuesCall.operand(0); final SqlNode node = rowCall.operand(0); final SqlPrettyWriter prettyWriter = new SqlPrettyWriter(AnsiSqlDialect.DEFAULT); prettyWriter.setAlwaysUseParentheses(false); if (newlines) { prettyWriter.setCaseClausesOnNewLines(true); } String actual = prettyWriter.format(node); getDiffRepos().assertEquals("formatted", expected, actual); // Now parse the result, and make sure it is structurally equivalent // to the original. final String actual2 = actual.replaceAll("`", "\""); final SqlNode valuesCall2 = parseQuery("VALUES (" + actual2 + ")"); assertTrue(valuesCall.equalsDeep(valuesCall2, Litmus.THROW)); }