-
Notifications
You must be signed in to change notification settings - Fork 232
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
Improve columnarCopy for HostColumnarToGpu #4770
Conversation
Signed-off-by: sperlingxx <lovedreamf@gmail.com>
build |
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.
Just some nits. Nothing that is a blocker. Great work.
|
||
public static void booleanCopy(ColumnVector cv, ColumnBuilder b, int rows) { | ||
if (!cv.hasNull()) { | ||
for (int i = 0; i < rows; i++) b.append(cv.getBoolean(i)); |
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.
nit: I would prefer to split this line up for formatting purposes.
for (int i = 0; i < rows; i++) {
b.append(cv.getBoolean(i));
}
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.
It looks like we could benefit from an efficient bulk API in HostMemoryBuffer
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.
This ColumnVector
is the Spark class, not the CUDF class. In some cases we can know what the layout is, but not all and in many of those cases the underlying data is not exposed, so there is no good way to do a bulk data copy. We could make changes to Spark to try and improve that, but this only really shows up in cases when we are reading an input format like Parquet or ORC.
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.
Done.
sql-plugin/src/main/java/com/nvidia/spark/rapids/ColumnarCopyHelper.java
Show resolved
Hide resolved
sql-plugin/src/main/java/com/nvidia/spark/rapids/ColumnarCopyHelper.java
Outdated
Show resolved
Hide resolved
sql-plugin/src/main/java/com/nvidia/spark/rapids/ColumnarCopyHelper.java
Outdated
Show resolved
Hide resolved
sql-plugin/src/main/scala/com/nvidia/spark/rapids/HostColumnarToGpu.scala
Outdated
Show resolved
Hide resolved
sql-plugin/src/main/java/com/nvidia/spark/rapids/ColumnarCopyHelper.java
Show resolved
Hide resolved
build |
Signed-off-by: sperlingxx lovedreamf@gmail.com
Following the suggestion in #4393, this PR replaced inefficient Scala FOR loops for columnar copy with Java ones, in order to speed up Columnar to Columnar transfers. Besides, it uses
ColumnVector.hasNull
to determine whether the host column data contains any null value, which is more accurate than nullable information from read schema.According to a non-comprehensive test, the new implementation saves approximately half of time on the columnar copy, comparing to the original implementation.
Here is the test script, which generates 1 billion rows Long data with null:
The performance of original implementation (the new metric "buffer time" recording the exact time cost of columnar copy):
The performance of new implementation: