zabetak commented on a change in pull request #1164: [CALCITE-2998] RexCopier
should support all rex types (Chunwei Lei)
URL: https://github.com/apache/calcite/pull/1164#discussion_r277596536
##########
File path: core/src/test/java/org/apache/calcite/rex/RexBuilderTest.java
##########
@@ -558,6 +566,101 @@ private void checkDate(RexNode node) {
checkBigDecimalLiteral(builder, "-73786976294838206464");
}
+ /** Tests {@link RexCopier#visitOver(RexOver)} */
+ @Test public void testCopyOver() {
+ final RelDataTypeFactory typeFactory =
+ new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
+ final RexBuilder builder = new RexBuilder(typeFactory);
+ final RelDataType type = typeFactory.createSqlType(SqlTypeName.INTEGER);
+ final RexOver node = (RexOver) builder.makeOver(type,
+ SqlStdOperatorTable.COUNT,
+ ImmutableList.of(builder.makeInputRef(type, 0)),
+ ImmutableList.of(builder.makeInputRef(type, 1)),
+ ImmutableList.of(
+ new RexFieldCollation(
+ builder.makeInputRef(type, 2), ImmutableSet.of())),
+ RexWindowBound.create(
+ SqlWindow.createUnboundedPreceding(SqlParserPos.ZERO), null),
+ RexWindowBound.create(
+ SqlWindow.createCurrentRow(SqlParserPos.ZERO), null),
+ true, true, false, false, false);
+ final RexNode copy = builder.copy(node);
Review comment:
I like the idea of `MySqlTypeFactoryImpl` ;) Since the factory is passed in
the RexBuilder maybe it would look more realistic if you used a different
builders for building and copying the expression. I leave the decision up to
you!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services