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.