mihaibudiu commented on code in PR #4939:
URL: https://github.com/apache/calcite/pull/4939#discussion_r3245453191
##########
babel/src/test/java/org/apache/calcite/test/BabelTest.java:
##########
@@ -307,6 +306,36 @@ names, is(
"HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER")));
});
+ // REPLACE with a completely different type
+ fixture.withSql("select * replace('fixed' as empno) from emp")
+ .type(type -> {
+ final List<String> names = type.getFieldList().stream()
+ .map(RelDataTypeField::getName)
+ .collect(Collectors.toList());
+ assertThat(
+ names, is(
+ ImmutableList.of("EMPNO", "ENAME", "JOB", "MGR",
+ "HIREDATE", "SAL", "COMM", "DEPTNO", "SLACKER")));
+ // EMPNO was INTEGER, now replaced by a CHAR literal
+
assertThat(type.getFieldList().get(0).getType().getSqlTypeName().getName(),
+ is("CHAR"));
+ });
+
+ // Same column replaced twice: the last one wins
+ fixture.withSql("select * replace(empno + 1 as empno, 'fixed' as empno)
from emp")
Review Comment:
I have already approved
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]