rui-mo commented on code in PR #13697:
URL: https://github.com/apache/gluten/pull/13697#discussion_r4807896805
##########
gluten-core/src/main/scala/org/apache/spark/sql/errors/NativeErrorTranslator.scala:
##########
@@ -16,14 +16,22 @@
*/
package org.apache.spark.sql.errors
-import org.apache.spark.{QueryContext, SparkRuntimeException}
+import org.apache.gluten.exception.GlutenNativeException
+
+import org.apache.spark.{QueryContext, SparkArithmeticException,
SparkRuntimeException}
import org.apache.spark.internal.Logging
import
org.apache.spark.sql.execution.datasources.SchemaColumnConvertNotSupportedException
+import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.util.SparkVersionUtil
/**
- * Translates native errors into the matching Spark exceptions. An error is
recognized by the first
- * non-null message in its cause chain.
+ * Translates native errors into the matching Spark exceptions.
+ *
+ * The JNI boundary raises a GlutenNativeException for a native error that its
backend describes.
+ * Its error condition is the Spark error condition of the error, for example
"DIVIDE_BY_ZERO".
+ * Errors whose condition is not supported yet, or that have none, fall back
to translation based on
+ * the error message. The message-based translation can be removed for an
error once native code
+ * attaches its condition.
*
* This is for the Velox backend only: the messages it recognizes are Velox's
error messages.
*/
Review Comment:
Agreed. The Velox-only part is the message parsing, and the error-condition
mapping this PR adds doesn't depend on Velox: the condition is Spark's own
name.
Could we split it by keeping only the condition → Spark exception mapping,
and moving the Velox message patterns to backends-velox?
ColumnarBatchOutIterator could call a new `IteratorApi.translateNativeError`
hook.
Ultimately, Velox message patterns may be removable once all error
conditions are fully covered.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]