You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by viirya <gi...@git.apache.org> on 2016/06/01 02:29:48 UTC
[GitHub] spark pull request: [SPARK-15657][SQL] RowEncoder should validate the data t...
Github user viirya commented on a diff in the pull request:
https://github.com/apache/spark/pull/13401#discussion_r65294127
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/objects/objects.scala ---
@@ -721,8 +716,55 @@ case class GetExternalRowField(
"cannot be null.");
}
- final ${ctx.javaType(dataType)} ${ev.value} = $getField;
+ final Object ${ev.value} = ${row.value}.get($index);
"""
ev.copy(code = code, isNull = "false")
}
}
+
+/**
+ * Validates the actual data type of input expression at runtime. If it doesn't match the
+ * expectation, throw an exception.
+ */
+case class ValidateExternalType(child: Expression, expected: DataType)
--- End diff --
hmm, for the trust, it should be said that we leave the responsibility of data correctness to users. Actually when the data is in wrong type, we will not get wrong result. There is of course an exception regarding data converting will be thrown. However, better error handling is always good if as you said the performance is not big issue here.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org