[ https://issues.apache.org/jira/browse/CALCITE-1268?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15332681#comment-15332681 ]
Julian Hyde commented on CALCITE-1268: -------------------------------------- bq. Found out that there had already been a CoerceInputsRule that did exactly the same thing we talk about here. Shall we remove this rule at all and make this test use another rule? Yes. That said, this is potentially a breaking change. We should get buy-in from the community before we do it. If the community strongly feels we need a property to allow it to be disabled before 2.0 I would (reluctantly) agree. In which case, you could continue using this test, with the property set. bq. I realized that coercing the inputs of a SetOp actually changed the semantics for this case. Casts between CHAR and VARCHAR are tricky. If a CHAR(5) (e.g. 'TABLE') and CHAR(7) will ultimately become a CHAR(7), it's OK if the CHAR(5) is converted a bit early. But if it will ultimately become a VARCHAR(7), we don't want the intermediate step of CHAR(7) ('TABLE '), which will add two spaces onto the end that shouldn't be there. If you're inserting into a VARCHAR(7) column, the target type should bubble down as the row type of the UNION and then as the row type of its inputs. I believe that is what happens now, but it might it might need a bit of attention to get it working. > Union should apply explicit Project over its children if they have different > but coercible types > ------------------------------------------------------------------------------------------------ > > Key: CALCITE-1268 > URL: https://issues.apache.org/jira/browse/CALCITE-1268 > Project: Calcite > Issue Type: Bug > Components: core > Affects Versions: 1.7.0 > Reporter: Maryann Xue > Assignee: Julian Hyde > > Test case in SqlToRelConverterTest: > {code} > @Test public void testUnionExprTypes() { > check( > "select empno, sal from emp " > + "union all " > + "select deptno, deptno from dept", > "${plan}"); > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)