[ 
https://issues.apache.org/jira/browse/DRILL-7266?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Shan Sikdar updated DRILL-7266:
-------------------------------
    Description: 
Not sure if this is a bug or intended behavior.

Using the Drill REST API query.json endpoint, inside the query parameter adding 
a semicolon ; at the end of a query statement will cause an error to be 
returned. While making the query with no semicolon will work normally.

 

To reproduce:

 

Running the docker container

```

$ docker run -i -p 8047:8047 --detach -t drill/apache-drill:1.16.0 /bin/bash
 8571e69831bcb731f61c40eb5219be9b624e78d79ad76069bee0a3ed04a70c1a

 

$ docker ps
 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
 8571e69831bc drill/apache-drill:1.16.0 "/bin/sh -c /opt/dri..." 3 seconds ago 
Up 2 seconds 0.0.0.0:8047->8047/tcp optimistic_greider

```

Here if I put a semicolon at the end of the query, it errors out:

```

$ curl -X POST -H "Content-Type: application/json" -d '\{"queryType":"SQL", 
"query": "select * from sys.version;", "autoLimit":1}' 
[http://localhost:8047/query.json]

{ "errorMessage" : "PARSE ERROR: Encountered \";\" at line 1, column 26.\nWas 
expecting one of:\n <EOF> \n \"ORDER\" ...\n \"LIMIT\" ...\n \"OFFSET\" ...\n 
\"FETCH\" ...\n \"NATURAL\" ...\n \"JOIN\" ...\n \"INNER\" ...\n \"LEFT\" ...\n 
\"RIGHT\" ...\n \"FULL\" ...\n \"CROSS\" ...\n \",\" ...\n \"OUTER\" ...\n 
\"(\" ...\n \"MATCH_RECOGNIZE\" ...\n <IDENTIFIER> ...\n <QUOTED_IDENTIFIER> 
...\n <BACK_QUOTED_IDENTIFIER> ...\n <BRACKET_QUOTED_IDENTIFIER> ...\n 
<UNICODE_QUOTED_IDENTIFIER> ...\n \"TABLESAMPLE\" ...\n \"WHERE\" ...\n 
\"GROUP\" ...\n \"HAVING\" ...\n \"WINDOW\" ...\n \"UNION\" ...\n \"INTERSECT\" 
...\n \"EXCEPT\" ...\n \"MINUS\" ...\n \".\" ...\n \"[\" ...\n \n\nSQL Query 
select * from sys.version;\n ^\n\n\n[Error Id: 
e12a2dc8-14da-46a1-be29-26eb507a9c0b ]"  

```  

 

 

Here if I put no semicolon and it works: ```  $ curl -X POST -H "Content-Type: 
application/json" -d '\\{"queryType":"SQL", "query": "select * from 
sys.version", "autoLimit":1}

' [http://localhost:8047/query.json] | jq
 % Total % Received % Xferd Average Speed Time Time Time Current
 Dload Upload Total Spent Left Speed
 100 701 100 629 100 72 2727 312 --:--:-- --:--:-- --:--:-- 2734
 {
 "queryId": "23210500-99ed-9562-f956-12e189e0743f",
 "columns": [
 "version",
 "commit_id",
 "commit_message",
 "commit_time",
 "build_email",
 "build_time"
 ],
 "rows": [

{ "build_email": "[email protected]", "build_time": "06.05.2019 @ 17:29:53 
PDT", "commit_message": "[maven-release-plugin] prepare release drill-1.16.0", 
"commit_time": "25.04.2019 @ 22:24:03 PDT", "version": "1.16.0", "commit_id": 
"751e87736c2ddbc184b52cfa56f4e29c68417cfe" }

],
 "metadata": [
 "VARCHAR",
 "VARCHAR",
 "VARCHAR",
 "VARCHAR",
 "VARCHAR",
 "VARCHAR"
 ],
 "queryState": "COMPLETED",
 "attemptedAutoLimit": 1
 }

```

 

  was:
Not sure if this is a bug or intended behavior.

Using the Drill REST API query.json endpoint, inside the query parameter adding 
a semicolon ; at the end of a query statement will cause an error to be 
returned. While making the query with no semicolon will work normally.

 

To reproduce:

 

Running the docker container

```

$ docker run -i -p 8047:8047 --detach -t drill/apache-drill:1.16.0 /bin/bash
8571e69831bcb731f61c40eb5219be9b624e78d79ad76069bee0a3ed04a70c1a

 

$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8571e69831bc drill/apache-drill:1.16.0 "/bin/sh -c /opt/dri..." 3 seconds ago 
Up 2 seconds 0.0.0.0:8047->8047/tcp optimistic_greider

```

Here if I put a semicolon at the end of the query, it errors out:

```

$ curl -X POST -H "Content-Type: application/json" -d '\{"queryType":"SQL", 
"query": "select * from sys.version;", "autoLimit":1}' 
http://localhost:8047/query.json 
{
 "errorMessage" : "PARSE ERROR: Encountered \";\" at line 1, column 26.\nWas 
expecting one of:\n <EOF> \n \"ORDER\" ...\n \"LIMIT\" ...\n \"OFFSET\" ...\n 
\"FETCH\" ...\n \"NATURAL\" ...\n \"JOIN\" ...\n \"INNER\" ...\n \"LEFT\" ...\n 
\"RIGHT\" ...\n \"FULL\" ...\n \"CROSS\" ...\n \",\" ...\n \"OUTER\" ...\n 
\"(\" ...\n \"MATCH_RECOGNIZE\" ...\n <IDENTIFIER> ...\n <QUOTED_IDENTIFIER> 
...\n <BACK_QUOTED_IDENTIFIER> ...\n <BRACKET_QUOTED_IDENTIFIER> ...\n 
<UNICODE_QUOTED_IDENTIFIER> ...\n \"TABLESAMPLE\" ...\n \"WHERE\" ...\n 
\"GROUP\" ...\n \"HAVING\" ...\n \"WINDOW\" ...\n \"UNION\" ...\n \"INTERSECT\" 
...\n \"EXCEPT\" ...\n \"MINUS\" ...\n \".\" ...\n \"[\" ...\n \n\nSQL Query 
select * from sys.version;\n ^\n\n\n[Error Id: 
e12a2dc8-14da-46a1-be29-26eb507a9c0b ]"

 ```

 

Here if I put no semicolon and it works:

```

 $ curl -X POST -H "Content-Type: application/json" -d '\{"queryType":"SQL", 
"query": "select * from sys.version", "autoLimit":1}' 
http://localhost:8047/query.json | jq
 % Total % Received % Xferd Average Speed Time Time Time Current
 Dload Upload Total Spent Left Speed
100 701 100 629 100 72 2727 312 --:--:-- --:--:-- --:--:-- 2734
{
 "queryId": "23210500-99ed-9562-f956-12e189e0743f",
 "columns": [
 "version",
 "commit_id",
 "commit_message",
 "commit_time",
 "build_email",
 "build_time"
 ],
 "rows": [
 {
 "build_email": "[email protected]",
 "build_time": "06.05.2019 @ 17:29:53 PDT",
 "commit_message": "[maven-release-plugin] prepare release drill-1.16.0",
 "commit_time": "25.04.2019 @ 22:24:03 PDT",
 "version": "1.16.0",
 "commit_id": "751e87736c2ddbc184b52cfa56f4e29c68417cfe"
 }
 ],
 "metadata": [
 "VARCHAR",
 "VARCHAR",
 "VARCHAR",
 "VARCHAR",
 "VARCHAR",
 "VARCHAR"
 ],
 "queryState": "COMPLETED",
 "attemptedAutoLimit": 1
}

```

 


> adding semicolon in query when using query.json REST API causes an error
> ------------------------------------------------------------------------
>
>                 Key: DRILL-7266
>                 URL: https://issues.apache.org/jira/browse/DRILL-7266
>             Project: Apache Drill
>          Issue Type: Bug
>         Environment: MAC OSX using docker
>            Reporter: Shan Sikdar
>            Priority: Minor
>
> Not sure if this is a bug or intended behavior.
> Using the Drill REST API query.json endpoint, inside the query parameter 
> adding a semicolon ; at the end of a query statement will cause an error to 
> be returned. While making the query with no semicolon will work normally.
>  
> To reproduce:
>  
> Running the docker container
> ```
> $ docker run -i -p 8047:8047 --detach -t drill/apache-drill:1.16.0 /bin/bash
>  8571e69831bcb731f61c40eb5219be9b624e78d79ad76069bee0a3ed04a70c1a
>  
> $ docker ps
>  CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
>  8571e69831bc drill/apache-drill:1.16.0 "/bin/sh -c /opt/dri..." 3 seconds 
> ago Up 2 seconds 0.0.0.0:8047->8047/tcp optimistic_greider
> ```
> Here if I put a semicolon at the end of the query, it errors out:
> ```
> $ curl -X POST -H "Content-Type: application/json" -d '\{"queryType":"SQL", 
> "query": "select * from sys.version;", "autoLimit":1}' 
> [http://localhost:8047/query.json]
> { "errorMessage" : "PARSE ERROR: Encountered \";\" at line 1, column 26.\nWas 
> expecting one of:\n <EOF> \n \"ORDER\" ...\n \"LIMIT\" ...\n \"OFFSET\" ...\n 
> \"FETCH\" ...\n \"NATURAL\" ...\n \"JOIN\" ...\n \"INNER\" ...\n \"LEFT\" 
> ...\n \"RIGHT\" ...\n \"FULL\" ...\n \"CROSS\" ...\n \",\" ...\n \"OUTER\" 
> ...\n \"(\" ...\n \"MATCH_RECOGNIZE\" ...\n <IDENTIFIER> ...\n 
> <QUOTED_IDENTIFIER> ...\n <BACK_QUOTED_IDENTIFIER> ...\n 
> <BRACKET_QUOTED_IDENTIFIER> ...\n <UNICODE_QUOTED_IDENTIFIER> ...\n 
> \"TABLESAMPLE\" ...\n \"WHERE\" ...\n \"GROUP\" ...\n \"HAVING\" ...\n 
> \"WINDOW\" ...\n \"UNION\" ...\n \"INTERSECT\" ...\n \"EXCEPT\" ...\n 
> \"MINUS\" ...\n \".\" ...\n \"[\" ...\n \n\nSQL Query select * from 
> sys.version;\n ^\n\n\n[Error Id: e12a2dc8-14da-46a1-be29-26eb507a9c0b ]"  
> ```  
>  
>  
> Here if I put no semicolon and it works: ```  $ curl -X POST -H 
> "Content-Type: application/json" -d '\\{"queryType":"SQL", "query": "select * 
> from sys.version", "autoLimit":1}
> ' [http://localhost:8047/query.json] | jq
>  % Total % Received % Xferd Average Speed Time Time Time Current
>  Dload Upload Total Spent Left Speed
>  100 701 100 629 100 72 2727 312 --:--:-- --:--:-- --:--:-- 2734
>  {
>  "queryId": "23210500-99ed-9562-f956-12e189e0743f",
>  "columns": [
>  "version",
>  "commit_id",
>  "commit_message",
>  "commit_time",
>  "build_email",
>  "build_time"
>  ],
>  "rows": [
> { "build_email": "[email protected]", "build_time": "06.05.2019 @ 17:29:53 
> PDT", "commit_message": "[maven-release-plugin] prepare release 
> drill-1.16.0", "commit_time": "25.04.2019 @ 22:24:03 PDT", "version": 
> "1.16.0", "commit_id": "751e87736c2ddbc184b52cfa56f4e29c68417cfe" }
> ],
>  "metadata": [
>  "VARCHAR",
>  "VARCHAR",
>  "VARCHAR",
>  "VARCHAR",
>  "VARCHAR",
>  "VARCHAR"
>  ],
>  "queryState": "COMPLETED",
>  "attemptedAutoLimit": 1
>  }
> ```
>  



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

Reply via email to