[ https://issues.apache.org/jira/browse/DRILL-3150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14622954#comment-14622954 ]
Steven Phillips commented on DRILL-3150: ---------------------------------------- I actually think the correct thing is to use VARBINARY as the default. It's true that comapring a non-numeric string to a valid integer field would fail, but that's ok. Our rules for implicit cast require casting the VARCHAR to NUMERIC, since NUMERIC types have a higher precedence. So doing a comparison between a non-numeric string and a numeric type should fail. In that case, it is necessary to explicitly cast the int as a string. I actually filed DRILL-3477 the other day, without realizing this issue was here. > Error when filtering non-existent field with a string > ----------------------------------------------------- > > Key: DRILL-3150 > URL: https://issues.apache.org/jira/browse/DRILL-3150 > Project: Apache Drill > Issue Type: Bug > Components: Execution - Relational Operators > Affects Versions: 1.0.0 > Reporter: Adam Gilmore > Assignee: Parth Chandra > Priority: Critical > Fix For: 1.2.0 > > Attachments: DRILL-3150.1.patch.txt > > > The following query throws an exception: > {code} > select count(*) from cp.`employee.json` where `blah` = 'test' > {code} > "blah" does not exist as a field in the JSON. The expected behaviour would > be to filter out all rows as that field is not present (thus cannot equal the > string 'test'). > Instead, the following exception occurs: > {code} > org.apache.drill.common.exceptions.UserRemoteException: SYSTEM ERROR: test > Fragment 0:0 > [Error Id: 5d6c9a82-8f87-41b2-a496-67b360302b76 on > ip-10-1-50-208.ec2.internal:31010] > {code} > Apart from the fact the real error message is hidden, the issue is that we're > trying to cast the varchar to int ('test' to an int). This seems to be > because the projection out of the scan when a field is not found becomes > INT:OPTIONAL. > The filter should not fail on this - if the varchar fails to convert to an > int, the filter should just simply not allow any records through. -- This message was sent by Atlassian JIRA (v6.3.4#6332)