Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-23269

Sql. Reduce try/catch block used to wrap Exception into RUNTIME_ERR SqlException in ScanNode#push

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0
    • sql

    Description

      Currently in ScanNode#push we handling Exception and wrapping it into SqlException with RUNTIME_ERR code.

              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);
              }
      

      Looks like it's done only to handle possible errors from user-side in statement

      inst = func.createInstance(context());
      

      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.

      Attachments

        Issue Links

          Activity

            People

              mzhuravkov Maksim Zhuravkov
              xtern Pavel Pereslegin
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 10m
                  1h 10m