You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by "Khurram Faraaz (JIRA)" <ji...@apache.org> on 2017/11/14 22:53:00 UTC

[jira] [Created] (DRILL-5965) Array index access returns an empty array

Khurram Faraaz created DRILL-5965:
-------------------------------------

             Summary: Array index access returns an empty array
                 Key: DRILL-5965
                 URL: https://issues.apache.org/jira/browse/DRILL-5965
             Project: Apache Drill
          Issue Type: Bug
          Components: Storage - JSON
    Affects Versions: 1.12.0
            Reporter: Khurram Faraaz


Accessing an array with [<array-index>] from JSON data, returns an empty string, whereas it should return the actual data from the array at the index and not an empty array. 

Drill 1.11.0-mapr  commit: 065d72ba48c7af6b389b763753ecb6bf7d229ce8

{noformat}
0: jdbc:drill:schema=dfs.tmp> select t.structured_rep[0] from `cornell_nlvr_train.json` t limit 1;
+---------+
| EXPR$0  |
+---------+
| []      |
+---------+
1 row selected (0.249 seconds)
{noformat}

Where as accessing the elements of the array returns correct results.

{noformat}
0: jdbc:drill:schema=dfs.tmp> select t.structured_rep[0][0] from `cornell_nlvr_train.json` t limit 1;
+-----------------------------------------------------------------------+
|                                EXPR$0                                 |
+-----------------------------------------------------------------------+
| {"y_loc":21,"size":20,"type":"triangle","x_loc":27,"color":"Yellow"}  |
+-----------------------------------------------------------------------+
1 row selected (0.325 seconds)
0: jdbc:drill:schema=dfs.tmp> select t.structured_rep[0][1] from `cornell_nlvr_train.json` t limit 1;
+---------------------------------------------------------------------+
|                               EXPR$0                                |
+---------------------------------------------------------------------+
| {"y_loc":60,"size":10,"type":"circle","x_loc":59,"color":"Yellow"}  |
+---------------------------------------------------------------------+
1 row selected (0.247 seconds)
{noformat}

Data used in the test
{noformat}
{
	"sentence": "There is a circle closely touching a corner of a box.",
	"label": "true",
	"identifier": "1304-0",
	"directory": "74",
	"evals": {
		"r0": "true"
	},
	"structured_rep": [
		[{
			"y_loc": 21,
			"size": 20,
			"type": "triangle",
			"x_loc": 27,
			"color": "Yellow"
		}, {
			"y_loc": 60,
			"size": 10,
			"type": "circle",
			"x_loc": 59,
			"color": "Yellow"
		}],
		[{
			"y_loc": 81,
			"size": 10,
			"type": "triangle",
			"x_loc": 48,
			"color": "Yellow"
		}, {
			"y_loc": 64,
			"size": 20,
			"type": "circle",
			"x_loc": 77,
			"color": "#0099ff"
		}],
		[{
			"y_loc": 2,
			"size": 20,
			"type": "triangle",
			"x_loc": 62,
			"color": "Yellow"
		}, {
			"y_loc": 70,
			"size": 30,
			"type": "circle",
			"x_loc": 70,
			"color": "Black"
		}, {
			"y_loc": 51,
			"size": 20,
			"type": "circle",
			"x_loc": 30,
			"color": "#0099ff"
		}, {
			"y_loc": 42,
			"size": 20,
			"type": "circle",
			"x_loc": 67,
			"color": "Yellow"
		}, {
			"y_loc": 73,
			"size": 20,
			"type": "circle",
			"x_loc": 37,
			"color": "Black"
		}, {
			"y_loc": 14,
			"size": 30,
			"type": "triangle",
			"x_loc": 7,
			"color": "Yellow"
		}, {
			"y_loc": 27,
			"size": 10,
			"type": "circle",
			"x_loc": 48,
			"color": "Black"
		}]
	]
}
{noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)