Skip to content

Commit 5c73b72

Browse files
SPARK-3807: SparkSql does not work for tables created using custom serde
1 parent 964e3aa commit 5c73b72

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/HiveTableScan.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,15 @@ case class HiveTableScan(
8080
ColumnProjectionUtils.appendReadColumnIDs(hiveConf, neededColumnIDs)
8181
ColumnProjectionUtils.appendReadColumnNames(hiveConf, attributes.map(_.name))
8282

83+
val td = relation.tableDesc
84+
val deClass = td.getDeserializerClass;
85+
val de = deClass.newInstance();
86+
de.initialize(hiveConf, td.getProperties);
87+
8388
// Specifies types and object inspectors of columns to be scanned.
8489
val structOI = ObjectInspectorUtils
8590
.getStandardObjectInspector(
86-
relation.tableDesc.getDeserializer.getObjectInspector,
91+
de.getObjectInspector,
8792
ObjectInspectorCopyOption.JAVA)
8893
.asInstanceOf[StructObjectInspector]
8994

0 commit comments

Comments
 (0)