zabetak commented on a change in pull request #969: [CALCITE-2738] Add support 
for copying of RexDynamicParam and RexRangeRef to RexCopier
URL: https://github.com/apache/calcite/pull/969#discussion_r261846147
 
 

 ##########
 File path: core/src/test/java/org/apache/calcite/rex/RexBuilderTest.java
 ##########
 @@ -556,6 +556,28 @@ private void checkDate(RexNode node) {
     checkBigDecimalLiteral(builder, "-73786976294838206464");
   }
 
+  /** Tests {@link RexCopier#visitDynamicParam(RexDynamicParam)} */
+  @Test public void testCopyDynamicParam() {
+    final RelDataTypeFactory typeFactory = new 
SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
+    final RexBuilder builder = new RexBuilder(typeFactory);
+    final RelDataType type = typeFactory.createSqlType(SqlTypeName.VARCHAR);
+    final RexDynamicParam node = builder.makeDynamicParam(type, 1);
+    final RexDynamicParam copiedNode = (RexDynamicParam) builder.copy(node);
 
 Review comment:
   I would put an additional assertion before performing the cast. That way the 
test will never fail with a ClassCastException which seems like a programming 
error but with an AssertionError which explicitly shows that the test is broken.

----------------------------------------------------------------
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

Reply via email to