Github user ajithme commented on a diff in the pull request: https://github.com/apache/carbondata/pull/2522#discussion_r203618925 --- Diff: store/sql/src/main/java/org/apache/carbondata/horizon/rest/controller/SqlHorizonController.java --- @@ -42,20 +43,24 @@ public ResponseEntity<SqlResponse> sql(@RequestBody SqlRequest request) throws StoreException { RequestValidator.validateSql(request); List<Row> rows; + Dataset<Row> sqlDataFrame = null; try { - rows = SparkSqlWrapper.sql(SqlHorizon.getSession(), request.getSqlStatement()) + sqlDataFrame = SparkSqlWrapper.sql(SqlHorizon.getSession(), + request.getSqlStatement()); + rows = sqlDataFrame .collectAsList(); } catch (AnalysisException e) { throw new StoreException(e.getSimpleMessage()); } catch (Exception e) { throw new StoreException(e.getMessage()); } - Object[][] result = new Object[rows.size()][]; + Object[][] result = new Object[rows.size()+1][]; --- End diff -- Done
---