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

Vladimir Sitnikov edited comment on CALCITE-3040 at 4/30/19 9:09 PM:
---------------------------------------------------------------------

Well, {{SQLException(String reason, Throwable cause)}} is there since Java 1.6 
(December 2006), and {{Throwable#initCause}}  was added in 1.4 (February 2002).
I guess clients might just need be updated to account "new" APIs.

Technically speaking, there's a fun relationship:
1) OpenJDK uses {{Throwable#toString}} for {{printStackTrace}} implementation
2) SQL clients that do not know of {{getCause}} seem to use {{getMessage}}.

Then Avatica can play a devil hack: sub-class SQLException and override 
{{toString}} to be different from {{getMessage}}.
In other words it could return just "while executing SQL select..." for 
{{toString}} (so {{printStackTrace}} is does not duplicate things), and 
{{getMessage}} could walk all the exceptions and collect the messages (so the 
one who uses "just" {{getMessage}} still receives all the messages).

However it would stop the progress even more since everybody would assume 
"getCause" is not required in decent SQL clients.



was (Author: vladimirsitnikov):
Well, {{SQLException(String reason, Throwable cause)}} is there since Java 1.6 
(December 2006), and {{Throwable#initCause}}  was added in 1.4 (February 2002).
I guess clients might just need be updated to account "new" APIs.

Technically speaking, there's a fun relationship:
1) OpenJDK uses {{Throwable#toString}} for {{printStackTrace}} implementation
2) SQL clients that do not know of {{getCause}} seem to use {{getMessage}}.

Then Avatica can play a devil hack: sub-class SQLException and override 
{{toString}} to be different from {{getMessage}}.

However it would stop the progress even more since everybody would assume 
"getCause" is not required in decent SQL clients.


> Avatica drops exception messages starting in 1.14.0
> ---------------------------------------------------
>
>                 Key: CALCITE-3040
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3040
>             Project: Calcite
>          Issue Type: Bug
>          Components: avatica
>    Affects Versions: avatica-1.14.0
>         Environment: Beam 2.13.0-SNAPSHOT
>  Avatica 1.14.0
> [https://github.com/apache/beam/pull/8437]
>            Reporter: Andrew Pilloud
>            Priority: Major
>
> With Avatica 1.13.0 we get detailed exceptions:
> {code:java}
> Welcome to Beam SQL 2.13.0-SNAPSHOT (based on sqlline version 1.4.0)
> 0: BeamSQL> create external table testing (a int) type text location 
> '/tmp/test';
> No rows affected (0.246 seconds)
> 0: BeamSQL> set runner = bogus;
> No rows affected (0.009 seconds)
> 0: BeamSQL> select * from testing;
> Error: Error while executing SQL "select * from testing": Unknown 'runner' 
> specified 'bogus', supported pipeline runners [DirectRunner] (state=,code=0)
> 0: BeamSQL>
> {code}
> In 1.14.0 the details of the failure are missing:
> {code:java}
> Welcome to Beam SQL 2.13.0-SNAPSHOT (based on sqlline version 1.4.0)
> 0: BeamSQL> create external table testing (a int) type text location 
> '/tmp/test';
> No rows affected (0.244 seconds)
> 0: BeamSQL> set runner = bogus;
> No rows affected (0.009 seconds)
> 0: BeamSQL> select * from testing;
> Error: Error while executing SQL "select * from testing" (state=,code=0)
> 0: BeamSQL>
> {code}
> This appears to be caused by CALCITE-2845



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

Reply via email to