[ 
https://issues.apache.org/jira/browse/PHOENIX-3267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15592550#comment-15592550
 ] 

James Taylor commented on PHOENIX-3267:
---------------------------------------

Good first step would be to find out how other databases handle a statement 
like this:
{code}
SELECT null FROM my_table;
{code}
Phoenix currently handles this by having the type of the expression as null. 
This was a bit of a pain as it forced us to put a bunch of null checks in, but 
that's how it works currently.

So two possible solutions:
- Change the Phoenix test cases to cast null in these cases. The challenge 
would to find all the test cases that do this. I've looked and I'm not finding 
any, so maybe add one to QueryMetaDataTest. I do see in 
ModulusExpressionIT.testNullEverything() that we use null in the select clause, 
but that case is slightly different because we can infer the type based on it's 
context (though not the exact type):
{code}
SELECT null % my_col FROM my_table
{code}
- Change Calcite to handle this. Not sure if this is feasible, but I suspect 
[~julianhyde] would have an idea.

> Replace use of SELECT null with CAST(null AS <type>)
> ----------------------------------------------------
>
>                 Key: PHOENIX-3267
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-3267
>             Project: Phoenix
>          Issue Type: Sub-task
>            Reporter: James Taylor
>            Assignee: Eric Lomore
>
> It appears that Calcite doesn't allow null as a SELECT expression. If this is 
> difficult to change, we can change our tests to cast null to a given data 
> type instead, like this: {{CAST(null AS VARCHAR)}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to