Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/main/scala/shark/execution/HadoopTableReader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import org.apache.hadoop.hive.serde2.`lazy`.LazyStruct
import org.apache.hadoop.hive.serde2.objectinspector.{StructObjectInspector, ObjectInspectorConverters}
import org.apache.hadoop.io.Writable
import org.apache.hadoop.mapred.{FileInputFormat, InputFormat, JobConf}
import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorConverters.IdentityConverter

import org.apache.spark.broadcast.Broadcast
import org.apache.spark.rdd.{EmptyRDD, HadoopRDD, RDD, UnionRDD}
Expand Down Expand Up @@ -209,10 +210,14 @@ class HadoopTableReader(@transient _tableDesc: TableDesc, @transient _localHConf
convertedRow match {
case _: LazyStruct => convertedRow
case _: HiveColumnarStruct => convertedRow
case _ => tableSerDe.deserialize(
tableSerDe.asInstanceOf[Serializer].serialize(
convertedRow, tblConvertedOI))
}
case _ =>
if (partTblObjectInspectorConverter.isInstanceOf[IdentityConverter]) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's better to move the branch out of the iter.map.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the case, where partTblObjectInspectorConverter.isInstanceOf[IdentityConverter] is true,
the deserialized value needs to be calculated anyways, which is done as part of iter.map, so would it make sense to pull it out of this iter.map, and push it in another one.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I mean how about like this?

rowWithPartArr.update(1, partValues) 
if (!partTblObjectInspectorConverter.isInstanceOf[IdentityConverter]) {
  iter.map {...// do as it previously
  }
} else {
  iter.map {
    rowWithPartArr.update(0, partSerDe.deserialize(value))
    rowWithPartArr.asInstanceOf[Object]
 }
}

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I will edit it.

convertedRow
}
else {
tableSerDe.deserialize( tableSerDe.asInstanceOf[Serializer].serialize( convertedRow, tblConvertedOI))
}
}
}
}
rowWithPartArr.update(0, deserializedRow)
Expand Down