[
https://issues.apache.org/jira/browse/DRILL-2183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14311760#comment-14311760
]
Jacques Nadeau commented on DRILL-2183:
---------------------------------------
Remember, flatten is an operator, not a function. What you're looking for is
that flatten(null) => null rather than error. Since we're defining FLATTEN
semantics, I guess that could make sense. Only question is whether that is a
little weird. As of right now FLATTEN(<<EMPTY_LIST>>) removes the record. It
seems like FLATTEN(<<NULL>>) would behave similarly. So we should pick one
pattern or the other for both operations.
> Flatten behavior not consistent with rest of drill when we use it on a
> non-existent field
> -----------------------------------------------------------------------------------------
>
> Key: DRILL-2183
> URL: https://issues.apache.org/jira/browse/DRILL-2183
> Project: Apache Drill
> Issue Type: Bug
> Components: Execution - Relational Operators
> Reporter: Rahul Challapalli
> Priority: Minor
>
> git.commit.id.abbrev=c54bd6a
> Projecting a non-existent column
> {code}
> 0: jdbc:drill:schema=dfs_eea> select field_not_present from `data1.json`;
> +-------------------+
> | field_not_present |
> +-------------------+
> | null |
> | null |
> +-------------------+
> {code}
> Using a non existent column in a function :
> {code}
> 0: jdbc:drill:schema=dfs_eea> select MAX(field_not_present) from `data1.json`;
> +------------+
> | EXPR$0 |
> +------------+
> | null |
> +------------+
> 1 row selected (0.07 seconds)
> {code}
> Using a non-existent column in a filter
> {code}
> 0: jdbc:drill:schema=dfs_eea> select MAX(uid) from `data1.json` where
> field_not_present > 1;
> +------------+
> | EXPR$0 |
> +------------+
> +------------+
> {code}
> However when we use flatten things work differently
> {code}
> 0: jdbc:drill:schema=dfs_eea> select uid , flatten(field_not_present) from
> `data1.json`;
> Query failed: RemoteRpcException: Failure while running fragment.,
> org.apache.drill.exec.vector.NullableIntVector cannot be cast to
> org.apache.drill.exec.vector.RepeatedVector [
> afe463ac-2523-43b2-882f-814ae4a116e1 on qa-node191.qa.lab:31010 ]
> [ afe463ac-2523-43b2-882f-814ae4a116e1 on qa-node191.qa.lab:31010 ]
> Error: exception while executing query: Failure while executing query.
> (state=,code=0)
> {code}
> Even if we do not make it consistent, we should at-least make the error
> message more clear
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)