You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/11/17 07:47:06 UTC
[GitHub] [spark] maropu commented on a change in pull request #30372: [SPARK-33172][SQL] Adding support for UserDefinedType for Spark SQL Code generator
maropu commented on a change in pull request #30372:
URL: https://github.com/apache/spark/pull/30372#discussion_r524941488
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/CodeGenerator.scala
##########
@@ -1734,15 +1734,17 @@ object CodeGenerator extends Logging {
* Returns the specialized code to access a value from a column vector for a given `DataType`.
*/
def getValueFromVector(vector: String, dataType: DataType, rowId: String): String = {
- if (dataType.isInstanceOf[StructType]) {
- // `ColumnVector.getStruct` is different from `InternalRow.getStruct`, it only takes an
- // `ordinal` parameter.
- s"$vector.getStruct($rowId)"
- } else {
- getValue(vector, dataType, rowId)
+ dataType match {
+ case udt: UserDefinedType[_] => getValueFromVector(vector, udt.sqlType, rowId)
Review comment:
Does this issue only happens when using `spark-bigquery-with-dependencies`? In the current spark codebase, it seems dataType cannot be an user-defined type in this method.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org