IceMimosa commented on a change in pull request #558: PHOENIX-5413: Fix union
all error when exists literal column type.
URL: https://github.com/apache/phoenix/pull/558#discussion_r310922208
##########
File path:
phoenix-core/src/test/java/org/apache/phoenix/compile/QueryCompilerTest.java
##########
@@ -2465,10 +2465,10 @@ public void testColumnProjectionUnionAll() throws
SQLException {
assertTrue(rowProj.getColumnProjector(1).getExpression().getMaxLength() == 20);
assertTrue(rowProj.getColumnProjector(2).getExpression().getDataType()
instanceof PVarchar);
-
assertTrue(rowProj.getColumnProjector(2).getExpression().getMaxLength() == 30);
+
assertTrue(rowProj.getColumnProjector(2).getExpression().getMaxLength() ==
null);
Review comment:
@yanxinyi Actually, the issue is caused by class
[ComparisonExpression](https://github.com/apache/phoenix/blob/e3d3ae5b120189235259280fc074bc7f337aa5b3/phoenix-core/src/main/java/org/apache/phoenix/expression/ComparisonExpression.java#L264).
Column type `varchar` union `char(10)` is in compile phase, and it can't
determine the maxLength of the result column. API `getMaxLength` and `getScale`
may be return `null`, for example, if the input is `varchar` or `decimal` with
no limit.
Maybe we should fix the class ComparisonExpression, i will try to look at
other possible cases.
----------------------------------------------------------------
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