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/08/03 07:46:08 UTC
[GitHub] [spark] maropu commented on a change in pull request #29199: [SPARK-32403][SQL] Refactor current ScriptTransformationExec
maropu commented on a change in pull request #29199:
URL: https://github.com/apache/spark/pull/29199#discussion_r464246909
##########
File path: sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/HiveScriptTransformationExec.scala
##########
@@ -172,66 +118,94 @@ case class HiveScriptTransformationExec(
if (!hasNext) {
throw new NoSuchElementException
}
- if (outputSerde == null) {
- val prevLine = curLine
- curLine = reader.readLine()
- if (!ioschema.schemaLess) {
- new GenericInternalRow(
- prevLine.split(ioschema.outputRowFormatMap("TOK_TABLEROWFORMATFIELD"))
- .map(CatalystTypeConverters.convertToCatalyst))
+ val raw = outputSerde.deserialize(scriptOutputWritable)
+ scriptOutputWritable = null
+ val dataList = outputSoi.getStructFieldsDataAsList(raw)
+ var i = 0
+ while (i < dataList.size()) {
+ if (dataList.get(i) == null) {
+ mutableRow.setNullAt(i)
} else {
- new GenericInternalRow(
- prevLine.split(ioschema.outputRowFormatMap("TOK_TABLEROWFORMATFIELD"), 2)
- .map(CatalystTypeConverters.convertToCatalyst))
+ unwrappers(i)(dataList.get(i), mutableRow, i)
}
- } else {
- val raw = outputSerde.deserialize(scriptOutputWritable)
- scriptOutputWritable = null
- val dataList = outputSoi.getStructFieldsDataAsList(raw)
- var i = 0
- while (i < dataList.size()) {
- if (dataList.get(i) == null) {
- mutableRow.setNullAt(i)
- } else {
- unwrappers(i)(dataList.get(i), mutableRow, i)
- }
- i += 1
- }
- mutableRow
+ i += 1
}
+ mutableRow
}
}
+ }
+
+ override def processIterator(
+ inputIterator: Iterator[InternalRow],
+ hadoopConf: Configuration): Iterator[InternalRow] = {
+
+ val (outputStream, proc, inputStream, stderrBuffer) = initProc
+
+ // This nullability is a performance optimization in order to avoid an Option.foreach() call
+ // inside of a loop
+ @Nullable val (inputSerde, inputSoi) = initInputSerDe(ioschema, input).getOrElse((null, null))
Review comment:
How about checking performance numbers with/without it?
----------------------------------------------------------------
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