You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@drill.apache.org by Gayathri Selvaraj <ga...@gmail.com> on 2019/05/13 11:00:13 UTC

Apache Drill REST API returns numeric column value as String

Hi team,

I am working on a project that make use of Apache Drill REST API to run
queries on JSON data. The response which I get from Drill is having rows
with all values as string irrespective of numeric or boolean.

Below is the sample:

*test.json:*

[{"a":"uxv","b":1,"c":2.0},{"a":"uxv","b":2,"c":3.15}]

*Request:* {"queryType" : "SQL","query" : "select * from
dfs.`\files\test.json`"};

*Response:* { "queryId": " ",
"columns": ["a","b","c"],
"rows": [
{ "b": "1", "c": " 2.0", "a": "uxv"}

, { "b": "2", "c": "3.15", "a": "uxv"} ] }

*Expected: *Numeric values without double quotes in response.


One of our requirement is failing because of this. Can anyone please give
some inputs or any configuration needs to be done to make it work as
expected.

Highly appreciating your response in advance.


Thanks,
Gayathri

Re: Apache Drill REST API returns numeric column value as String

Posted by SorabhApache <so...@apache.org>.
Hi Gayathri,
That is the expected behavior. There is already a JIRA[1] filed for this,
but no one got chance to work on it. The other option is to use JDBC/ODBC
drivers instead which will preserve the result data type.

[1]: https://issues.apache.org/jira/browse/DRILL-5072

Thanks,
Sorabh

On Mon, May 13, 2019 at 4:00 AM Gayathri Selvaraj <
gayathri.selvaraaj@gmail.com> wrote:

> Hi team,
>
> I am working on a project that make use of Apache Drill REST API to run
> queries on JSON data. The response which I get from Drill is having rows
> with all values as string irrespective of numeric or boolean.
>
> Below is the sample:
>
> *test.json:*
>
> [{"a":"uxv","b":1,"c":2.0},{"a":"uxv","b":2,"c":3.15}]
>
> *Request:* {"queryType" : "SQL","query" : "select * from
> dfs.`\files\test.json`"};
>
> *Response:* { "queryId": " ",
> "columns": ["a","b","c"],
> "rows": [
> { "b": "1", "c": " 2.0", "a": "uxv"}
>
> , { "b": "2", "c": "3.15", "a": "uxv"} ] }
>
> *Expected: *Numeric values without double quotes in response.
>
>
> One of our requirement is failing because of this. Can anyone please give
> some inputs or any configuration needs to be done to make it work as
> expected.
>
> Highly appreciating your response in advance.
>
>
> Thanks,
> Gayathri
>