[ 
https://issues.apache.org/jira/browse/DRILL-7218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16826321#comment-16826321
 ] 

Paul Rogers commented on DRILL-7218:
------------------------------------

Historically, Drill uses a name-based system for columns rather than the 
traditional ordered list. Reason: in file A, you might have (x,y), while in 
file B you might have (y,x). Drill treats the schema as a bundle of (unordered) 
vectors.

AFAIK, there has been no real discussion about the need for a specified column 
order.

This came up in the context of the new scan framework based on the row set 
work. That framework *does* attempt to preserve column order. In doing this, it 
was very clear that, prior to that work, column order was undefined.

It is also not clear how other operators deal with column order given that 
Drill has no schema other than the incoming batches.

So, it might be worth while to determine if column order should be retained, 
and, if so, how to ensure consistent ordering in each of the various operators. 
(And, more fundamentally, what that order should be in the case in which 
readers see different column orders.)

> Apache Drill API doesn't preserve the column order
> --------------------------------------------------
>
>                 Key: DRILL-7218
>                 URL: https://issues.apache.org/jira/browse/DRILL-7218
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.14.0
>            Reporter: Gayathri
>            Priority: Blocker
>              Labels: REST_API, drill
>
> When we try to query through Apache Drill REST API, the returned response 
> doesn't maintain the column order as given in the query.
> +Example:+ *Request:* \{"queryType" : "SQL","query" : "select a,b,c from 
> dfs.`\files\test.json`"};
> *Response:* { "queryId": "233ff474-0902-828b-9efd-0a0bd57eee51",
>  "columns": [
>  "a",
>  "b",
>  "c"
>  ],
>  "rows": [
> { "b": "abc", "c": " xyz", "a": "uxv"}, \{ "b": "abc", "c": " xyz", "a": 
> "uxv"}
> ]
>  }
> Is there any way we can maintain the column order through REST API call?
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to