Github user arjansh commented on a diff in the pull request: https://github.com/apache/metamodel/pull/179#discussion_r190899732 --- Diff: neo4j/src/main/java/org/apache/metamodel/neo4j/Neo4jDataSet.java --- @@ -44,28 +44,32 @@ public Neo4jDataSet(List<SelectItem> selectItems, JSONObject resultJSONObject) { @Override public boolean next() { try { - JSONArray resultsArray = _resultJSONObject.getJSONArray("results"); + final JSONArray resultsArray = _resultJSONObject.getJSONArray("results"); + if (resultsArray.length() > 0) { - JSONObject results = resultsArray.getJSONObject(0); - JSONArray data = results.getJSONArray("data"); + final JSONObject results = resultsArray.getJSONObject(0); + final JSONArray data = results.getJSONArray("data"); + if (_currentRowIndex < data.length()) { - JSONObject row = data.getJSONObject(_currentRowIndex); - JSONArray jsonValues = row.getJSONArray("row"); - - Object[] objectValues = new Object[jsonValues.length()]; + final JSONObject row = data.getJSONObject(_currentRowIndex); + final JSONArray jsonValues = row.getJSONArray("row"); + final Object[] objectValues = new Object[jsonValues.length()]; + for (int i = 0; i < jsonValues.length(); i++) { - objectValues[i] = jsonValues.getString(i); + objectValues[i] = jsonValues.get(i); --- End diff -- Now that the `ColumnTypeResolver` resolves JSONArray objects to List objects, we should add some logic here that the values which are actually returned are of the type List.
---