Jinfeng Ni created DRILL-1689:
---------------------------------
Summary: Drill could not query a repeated map, and get all the
values of one field into an array.
Key: DRILL-1689
URL: https://issues.apache.org/jira/browse/DRILL-1689
Project: Apache Drill
Issue Type: Bug
Reporter: Jinfeng Ni
Suppose we have the following JSON data:
{code}
{
"uid" : 1,
"events" : [
{ "evnt_id":"e1", "campaign_id":"c1", "event_name":"e1_name",
"event_time":1000000},
{ "evnt_id":"e2", "campaign_id":"c1", "event_name":"e2_name",
"event_time":2000000},
{ "evnt_id":"e3", "campaign_id":"c1", "event_name":"e3_name",
"event_time":3000000},
{ "evnt_id":"e4", "campaign_id":"c1", "event_name":"e4_name",
"event_time":4000000},
{ "evnt_id":"e5", "campaign_id":"c2", "event_name":"e5_name",
"event_time":5000000},
{ "evnt_id":"e6", "campaign_id":"c1", "event_name":"e6_name",
"event_time":6000000},
{ "evnt_id":"e7", "campaign_id":"c1", "event_name":"e7_name",
"event_time":7000000},
{ "evnt_id":"e8", "campaign_id":"c2", "event_name":"e8_name",
"event_time":8000000},
{ "evnt_id":"e9", "campaign_id":"c2", "event_name":"e9_name",
"event_time":9000000}
],
"transactions" : [
{ "trans_id":"t1", "amount":100, "trans_time":7777777},
{ "trans_id":"t2", "amount":100, "trans_time":8888888}
]
}
{code}
"transactions" is repeated map. We could return a field "trans_id" in i-th map
in this repeated map.
{code}
select t.transactions[1].trans_id from
dfs.`/Users/jni/work/data/json/single-user-transactions.json` t;
+------------+
| EXPR$0 |
+------------+
| t2 |
+------------+
{code}
However, if we want to get field "trans_id" from "ALL" the maps in this array,
Drill will fail with exception:
{code}
select t.transactions.trans_id from
dfs.`/Users/jni/work/data/json/single-user-transactions.json` t;
Query failed: Failure while running fragment.,
org.apache.drill.exec.vector.complex.RepeatedMapVector cannot be cast to
org.apache.drill.exec.vector.complex.MapVector [
1317f855-b33a-4023-9164-3f22e7e8f1bf on 10.250.0.112:31013 ]
{code}
For the above query, SchemaPath "t.transactions.trans_id" should return an
array of "trans_id", i.e ["t1", "t2"].
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)