-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-19923][SQL] Remove unnecessary type conversions per call in Hive #17264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I'm not sure this makes sense, so could you check? cc: @hvanhovell |
|
I quickly did check performance changes; |
|
Test build #74396 has finished for PR 17264 at commit
|
| row.get(i, dataSchema(i).dataType), | ||
| fieldRefs.get(i).getFieldObjectInspector, | ||
| dataSchema(i).dataType)) | ||
| wrappers(i)(row.get(i, dataSchema(i).dataType)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @maropu .
This seems to be improvement, too. Could you add some description about this?
The current description only mentions hiveUDFs.scala.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the description to explain wrappers: https://github.com/apache/spark/pull/17264/files#diff-01999ccbf13e95a0ea2d223f69d8ae23R201
| private[this] val wrappers = dataSchema.zip(structOI.getAllStructFieldRefs().asScala.toSeq) | ||
| .map { case (f, i) => | ||
| wrapperFor(i.getFieldObjectInspector, f.dataType) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(my personal taste that might be worth considering..
private[this] val wrappers = dataSchema
.zip(structOI.getAllStructFieldRefs.asScala.toSeq)
.map { case (f, i) => wrapperFor(i.getFieldObjectInspector, f.dataType) }or maybe
private[this] val wrappers =
structOI.getAllStructFieldRefs.asScala.toSeq.zip(dataSchema).map { case (ref, field) =>
wrapperFor(ref.getFieldObjectInspector, field.dataType)
}which resembles
spark/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveInspectors.scala
Lines 364 to 366 in 226d388
| val wrappers = ssoi.getAllStructFieldRefs.asScala.zip(structType).map { | |
| case (ref, tpe) => wrapperFor(ref.getFieldObjectInspector, tpe.dataType) | |
| } |
)
|
Thanks for valuable comments! I'll update soon. |
|
@maropu this looks like a nice improvement. It is an idea to check all uses of |
|
@hvanhovell I checked all the related code and then I think this pr includes all the place we could replace |
|
Test build #74537 has finished for PR 17264 at commit
|
|
LGTM merging to master. Thanks! |
|
In the future can we put the perf result in PR descriptions? |
|
@rxin okay! |
What changes were proposed in this pull request?
This pr removed unnecessary type conversions per call in Hive: https://github.com/apache/spark/blob/master/sql/hive/src/main/scala/org/apache/spark/sql/hive/hiveUDFs.scala#L116
How was this patch tested?
Existing tests