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: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • 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

        Activity

          People

            Unassigned Unassigned
            xtern Pavel Pereslegin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: