Skip to content
Closed
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
Next Next commit
Converting converters in RDDConversions into arrays to improve their …
…access performance
  • Loading branch information
eatoncys committed Dec 8, 2018
commit ddb252892a439281b16bc14fdfdb7faf756f1067
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ object RDDConversions {
data.mapPartitions { iterator =>
val numColumns = outputTypes.length
val mutableRow = new GenericInternalRow(numColumns)
val converters = outputTypes.map(CatalystTypeConverters.createToCatalystConverter)
val converters = outputTypes.map(CatalystTypeConverters.createToCatalystConverter).toArray
Copy link
Contributor

Choose a reason for hiding this comment

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

shall we use ExpressionEncoder here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is a good suggestion, and has been modified, would you like to review it again, thanks.

iterator.map { r =>
var i = 0
while (i < numColumns) {
Expand All @@ -53,7 +53,7 @@ object RDDConversions {
data.mapPartitions { iterator =>
val numColumns = outputTypes.length
val mutableRow = new GenericInternalRow(numColumns)
val converters = outputTypes.map(CatalystTypeConverters.createToCatalystConverter)
val converters = outputTypes.map(CatalystTypeConverters.createToCatalystConverter).toArray
Copy link
Contributor

Choose a reason for hiding this comment

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

shall we use RowEncoder here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It has been modified, and the performance is the same as converting to arrays.

iterator.map { r =>
var i = 0
while (i < numColumns) {
Expand Down