[
https://issues.apache.org/jira/browse/DRILL-1741?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mehant Baid updated DRILL-1741:
-------------------------------
Attachment: DRILL-1741.patch
Added test that maps within a map per [~jaltekruse]'s comment
> kvgen does not work with nested map/unions
> ------------------------------------------
>
> Key: DRILL-1741
> URL: https://issues.apache.org/jira/browse/DRILL-1741
> Project: Apache Drill
> Issue Type: Bug
> Components: Functions - Drill
> Affects Versions: 0.7.0
> Reporter: Hao Zhu
> Assignee: Mehant Baid
> Fix For: 0.7.0
>
> Attachments: DRILL-1741.patch
>
>
> Tested on latest 0.7.0.
> kvgen function does not work well with nested maps/unions.
> 1. This works fine:
> {code}
> $ cat test_work.json
> {
> "data" : {
> "col1" : "aaa"
> }
> }
> {code}
> {code}
> 0: jdbc:drill:zk=local> select kvgen(tab.data) from `test_work.json` tab;
> +------------+
> | EXPR$0 |
> +------------+
> | [{"key":"col1","value":"aaa"}] |
> +------------+
> 1 row selected (0.034 seconds)
> {code}
> 2. This failed:
> {code}
> $ cat test7.json
> {
> "data" : {
> "col1" : {
> "one" : "aaa"
> }
> }
> }
> {code}
> {code}
> 0: jdbc:drill:zk=local> select kvgen(tab.data) from `test7.json` tab;
> +------------+
> | EXPR$0 |
> +------------+
> Query failed: Failure while running fragment., Mappify does not support input
> of type: MAP [ d2bfea52-9935-4d63-8ecc-52315a3c7c7b on 10.250.0.115:31010 ]
> java.lang.RuntimeException: java.sql.SQLException: Failure while executing
> query.
> at sqlline.SqlLine$IncrementalRows.hasNext(SqlLine.java:2514)
> at sqlline.SqlLine$TableOutputFormat.print(SqlLine.java:2148)
> at sqlline.SqlLine.print(SqlLine.java:1809)
> at sqlline.SqlLine$Commands.execute(SqlLine.java:3766)
> at sqlline.SqlLine$Commands.sql(SqlLine.java:3663)
> at sqlline.SqlLine.dispatch(SqlLine.java:889)
> at sqlline.SqlLine.begin(SqlLine.java:763)
> at sqlline.SqlLine.start(SqlLine.java:498)
> at sqlline.SqlLine.main(SqlLine.java:460)
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)