You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "ege-st (via GitHub)" <gi...@apache.org> on 2023/06/15 14:20:47 UTC

[GitHub] [pinot] ege-st opened a new issue, #10921: Improve Syntax Error Messages

ege-st opened a new issue, #10921:
URL: https://github.com/apache/pinot/issues/10921

   Syntax error messages are very hard to read. Usually, they are just stack traces from Calcite along with an HTTP Code 200. This creates a very confusing message for users: a stack trace tells the user that the database itself has faulted but the 200 code says that everything is fine. Compounding the problem is that the stack trace is the same across all syntax error messages; therefore, it does not provide any information on what the syntax problem is or how to fix it.
   
   The result is a poor user experience for a person trying to learn how to use Pinot and for experienced people writing complex queries.
   
   The goal for this ticket is to have Pinot return human readable error messages for syntax problems.
   
   ### Example
   This query `select * from mytable WHEE ActualElapsedTime = 100` returns this error:
   
   ```
   SQLParsingError:
   java.lang.Exception: Unable to parse the SQL: 'select * from mytable WHEE ActualElapsedTime = 100'
   	at org.apache.pinot.controller.api.resources.PinotQueryResource.executeSqlQuery(PinotQueryResource.java:144)
   	at org.apache.pinot.controller.api.resources.PinotQueryResource.handlePostSql(PinotQueryResource.java:110)
   	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   ```
   
   It should return something which states that `WHEE` is invalid like `Invalid keyword: 'WHEE'` or `Expected 'WHERE' but found 'WHEE'`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] abhioncbr commented on issue #10921: Improve Syntax Error Messages

Posted by "abhioncbr (via GitHub)" <gi...@apache.org>.
abhioncbr commented on issue #10921:
URL: https://github.com/apache/pinot/issues/10921#issuecomment-1615303999

   @ege-st, can we close this issue or any further work you have in mind? Thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] walterddr commented on issue #10921: Improve Syntax Error Messages

Posted by "walterddr (via GitHub)" <gi...@apache.org>.
walterddr commented on issue #10921:
URL: https://github.com/apache/pinot/issues/10921#issuecomment-1615305989

   ah. actually i have a follow up @abhioncbr 
   
   in your PR's description. you can see that the query is single-lined --> if the query is multiple line. can you confirm that if the query has more than 5 lines the error is going to be truncated? (e.g. it will show the first 5 line of the error, then the Cause by)
   
   if that happens, i was wondering if we should squash the multi-line query into just 1 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] ege-st commented on issue #10921: Improve Syntax Error Messages

Posted by "ege-st (via GitHub)" <gi...@apache.org>.
ege-st commented on issue #10921:
URL: https://github.com/apache/pinot/issues/10921#issuecomment-1598796538

   Awesome, thank you.
   
   On Sat, Jun 17, 2023 at 9:15 PM Abhishek Sharma ***@***.***>
   wrote:
   
   > It's possible through Calcite, IMO. I was once looking at the code
   > <https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/advise/SqlAdvisor.java#L603>,
   > and it seems like it can help us in achieving the ask.
   >
   > I want to try it if it's not urgent and no one is working on it. Please
   > assign it to me. Thanks
   >
   > —
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/pinot/issues/10921#issuecomment-1595915711>,
   > or unsubscribe
   > <https://github.com/notifications/unsubscribe-auth/BAASDJ3VWMV76VYSKULSNODXLZJDHANCNFSM6AAAAAAZH5Z7BA>
   > .
   > You are receiving this because you authored the thread.Message ID:
   > ***@***.***>
   >
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] mayankshriv commented on issue #10921: Improve Syntax Error Messages

Posted by "mayankshriv (via GitHub)" <gi...@apache.org>.
mayankshriv commented on issue #10921:
URL: https://github.com/apache/pinot/issues/10921#issuecomment-1601157028

   @abhioncbr thanks, I have assigned this to you now.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] abhioncbr commented on issue #10921: Improve Syntax Error Messages

Posted by "abhioncbr (via GitHub)" <gi...@apache.org>.
abhioncbr commented on issue #10921:
URL: https://github.com/apache/pinot/issues/10921#issuecomment-1615310104

   Got it; that's a very going point. I'll confirm it here. Thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] abhioncbr commented on issue #10921: Improve Syntax Error Messages

Posted by "abhioncbr (via GitHub)" <gi...@apache.org>.
abhioncbr commented on issue #10921:
URL: https://github.com/apache/pinot/issues/10921#issuecomment-1613688643

   Thanks, @walterddr; I noticed one issue because of my [changes](https://github.com/apache/pinot/commit/dc3b6fd3192b9301017e91a564241479e67727b9#diff-2ef8e7d90492c8e2f69f0b08251ec4d0882900f78bbd40c72152b1632657a66cL136). I am going to raise the PR for the fix. Thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] walterddr commented on issue #10921: Improve Syntax Error Messages

Posted by "walterddr (via GitHub)" <gi...@apache.org>.
walterddr commented on issue #10921:
URL: https://github.com/apache/pinot/issues/10921#issuecomment-1613847919

   yup ^ that's where. it should encapsulate not just the sqlQuery but also the error 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] Jackie-Jiang commented on issue #10921: Improve Syntax Error Messages

Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang commented on issue #10921:
URL: https://github.com/apache/pinot/issues/10921#issuecomment-1595572662

   Great suggestion!
   Currently we simply return the exception thrown by the Calcite SQL parser. We can explore if Calcite supports identifying the syntax error from a query.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] abhioncbr commented on issue #10921: Improve Syntax Error Messages

Posted by "abhioncbr (via GitHub)" <gi...@apache.org>.
abhioncbr commented on issue #10921:
URL: https://github.com/apache/pinot/issues/10921#issuecomment-1615321856

   It seems good enough to me.
   
   <img width="1135" alt="Screen Shot 2023-06-30 at 9 03 02 PM" src="https://github.com/apache/pinot/assets/1076944/d432909f-d12b-4c5b-974e-4093963c9ce1">
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] abhioncbr commented on issue #10921: Improve Syntax Error Messages

Posted by "abhioncbr (via GitHub)" <gi...@apache.org>.
abhioncbr commented on issue #10921:
URL: https://github.com/apache/pinot/issues/10921#issuecomment-1595915711

   It's possible through Calcite, IMO. I was once looking at the [code](https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/advise/SqlAdvisor.java#L603), and it seems like it can help us in achieving the ask.
   
   I want to try it if it's not urgent and no one is working on it. Please assign it to me. Thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] walterddr commented on issue #10921: Improve Syntax Error Messages

Posted by "walterddr (via GitHub)" <gi...@apache.org>.
walterddr commented on issue #10921:
URL: https://github.com/apache/pinot/issues/10921#issuecomment-1607754155

   I think the error messages you shared are generated internally. but it is not piped back to the end-user. 
   it has to do with 
   1. the boxing of the controller handler error on top of the calcite error; and 
   2. the `QueryException.getException` truncates the error messages to only 5 lines (per caused-by i think)
   3. (potentially) the UI renders only the first 5 lines
   thus for some reason the "Caused by part of the error is not returned"
   
   so i think the next step is:
   1. verify with browser plugin and see what the actual json payload is returned to the browser (to see if it is the UI render problem)
   2. verify the error thrown in controller to see if it actually encodes the error message to the per-caused-by level)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] abhioncbr commented on issue #10921: Improve Syntax Error Messages

Posted by "abhioncbr (via GitHub)" <gi...@apache.org>.
abhioncbr commented on issue #10921:
URL: https://github.com/apache/pinot/issues/10921#issuecomment-1606536699

   I tried to use the [Calcite SqlAdvisor code](https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/sql/advise/SqlAdvisor.java#L603) mentioned in my above comment for the below incorrect query
   
   ```SELECT intCol FROMM select_expression_test_tbl1```
    
   and the error message I got for the above query is below
   ```
   Encountered "select_expression_test_tbl1" at line 1, column 21.
   Was expecting one of:
       <EOF> 
       "EXCEPT" ...
       "FETCH" ...
       "FROM" ...
       "INTERSECT" ...
       "LIMIT" ...
       "OFFSET" ...
       "ORDER" ...
       "MINUS" ...
       "UNION" ...
       "," ...
   ```
   
   It is a bit much better than our current exception message content
   ```
   Encountered " <IDENTIFIER> "select_expression_test_tbl1 "" at line 1, column 21.
   Was expecting:
       <EOF> 
   ```
   
   I am not sure if it's more helpful or not. 
   
   @walterddr do you have any ideas around this? Thanks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] walterddr closed issue #10921: Improve Syntax Error Messages

Posted by "walterddr (via GitHub)" <gi...@apache.org>.
walterddr closed issue #10921: Improve Syntax Error Messages
URL: https://github.com/apache/pinot/issues/10921


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org