[SPARK-22003][SQL] support array column in vectorized reader with UDF - #19230
[SPARK-22003][SQL] support array column in vectorized reader with UDF#19230liufengdb wants to merge 4 commits into
Conversation
|
Add a test for it? |
| } else if (dt instanceof StringType) { | ||
| for (int i = 0; i < length; i++) { | ||
| if (!data.isNullAt(offset + i)) { | ||
| list[i] = getUTF8String(i).toString(); |
There was a problem hiding this comment.
This looks suspicious. Why we get String before? Seems we should get UTF8String.
| for (int i = 0; i < length; i++) { | ||
| if (!data.isNullAt(offset + i)) { | ||
| list[i] = data.getDouble(offset + i); | ||
| list[i] = getAtMethod.call(i); |
There was a problem hiding this comment.
can we just call get(i + offset, dt)? The getAtMethod seems not very useful, as we still need to go through the if-else branches in get everytime.
There was a problem hiding this comment.
It should be get(i, dt)? I updated it anyway.
There was a problem hiding this comment.
yea should be get(i, dt).
|
Test build #81759 has finished for PR 19230 at commit
|
|
since |
|
Yea we should add an unit test for it. |
|
@viirya @cloud-fan unit test updated. |
| */ | ||
| package org.apache.spark.sql.execution.vectorized; | ||
|
|
||
| import org.apache.spark.api.java.function.Function; |
There was a problem hiding this comment.
@liufengdb I think we don't need to import this now?
|
Test build #81835 has finished for PR 19230 at commit
|
| // Populate it with arrays [0], [1, 2], [], [3, 4, 5] | ||
| testVector.putArray(0, 0, 1) | ||
| testVector.putArray(1, 1, 2) | ||
| testVector.putArray(2, 2, 0) |
There was a problem hiding this comment.
I think it doesn't affect the result. But looks like the third array should be testVector.putArray(2, 3, 0)?
|
@liufengdb The PR description looks like an end-to-end failure. I'm curious are you facing the failure in an end-to-end case? |
| dst.getChildColumn(1).appendLong(c.microseconds); | ||
| } else if (t instanceof DateType) { | ||
| dst.appendInt(DateTimeUtils.fromJavaDate((Date)o)); | ||
| dst.appendInt((int) DateTimeUtils.fromJavaDate((Date)o)); |
|
LGTM except some minor comments |
|
LGTM too. |
|
Test build #81850 has finished for PR 19230 at commit
|
| */ | ||
| package org.apache.spark.sql.execution.vectorized; | ||
|
|
||
| import org.apache.spark.api.java.function.Function; |
| assert(array.get(1, schema).asInstanceOf[ColumnarBatch.Row].get(0, IntegerType) === 456) | ||
| assert(array.get(1, schema).asInstanceOf[ColumnarBatch.Row].get(1, DoubleType) === 5.67) | ||
| } | ||
| } |
There was a problem hiding this comment.
Is it better to add a test for map, too?
There was a problem hiding this comment.
mapType is not supported in ColumnVector: https://github.com/apache/spark/blob/master/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/ColumnVector.java#L235
There was a problem hiding this comment.
I see.
Does your change expect that this call finally throws an exception for Map element in array?
|
retest this please |
|
Test build #81861 has finished for PR 19230 at commit
|
|
retest this please |
1 similar comment
|
retest this please |
|
Can we add test code for |
|
Test build #81872 has finished for PR 19230 at commit
|
|
retest this please |
|
Test build #81877 has finished for PR 19230 at commit
|
|
Thanks! Merged to master. |
What changes were proposed in this pull request?
The UDF needs to deserialize the
UnsafeRow. When the column type is Array, thegetmethod from theColumnVector, which is used by the vectorized reader, is called, but this method is not implemented.How was this patch tested?
(Please explain how this patch was tested. E.g. unit tests, integration tests, manual tests)
(If this patch involves UI changes, please attach a screenshot; otherwise, remove this)
Please review http://spark.apache.org/contributing.html before opening a pull request.