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

Maksim Zhuravkov commented on IGNITE-23269:
-------------------------------------------

[~xtern] Could you please review my patch?

> Sql. Reduce try/catch block used to wrap Exception into RUNTIME_ERR 
> SqlException in ScanNode#push
> -------------------------------------------------------------------------------------------------
>
>                 Key: IGNITE-23269
>                 URL: https://issues.apache.org/jira/browse/IGNITE-23269
>             Project: Ignite
>          Issue Type: Improvement
>          Components: sql
>            Reporter: Pavel Pereslegin
>            Assignee: Maksim Zhuravkov
>            Priority: Major
>              Labels: ignite-3
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently in ScanNode#push  we handling Exception and wrapping it into 
> SqlException with RUNTIME_ERR code.
> {code:java}
>         try {
>             if (inst == null) {
>                 inst = func.createInstance(context());
>             }
>             int processed = 0;
>             while (requested > 0 && inst.hasNext()) {
>                 checkState();
>                 requested--;
>                 downstream().push(inst.next());
>                 if (++processed == inBufSize && requested > 0) {
>                     // allow others to do their job
>                     context().execute(this::push, this::onError);
>                     return;
>                 }
>             }
>         } catch (Exception e) {
>             throw new SqlException(Sql.RUNTIME_ERR, e);
>         }
> {code}
> Looks like it's done only to handle possible errors from user-side in 
> statement
> {code:java}
> inst = func.createInstance(context());
> {code}
> But this try/catch block is wider then required.
> For example we can catch QueryCancelledException and wrap it into 
> RUNTIME_ERR-exception, or other internal errors wrap into RUNTIME_ERR.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to