Github user kiszk commented on the issue:
https://github.com/apache/spark/pull/13758
@hvanhovell and @cloud-fan This```GenericArrayData``` can be used in
generated code for a program with an primitive array written in DataFrame or
Dataset. I newly added Dataframe benchmark program and results. The performance
improvements are up to 4.4x.
Here is use case of this```GenericArrayData``` in the generated code of
this benchmark program.
```java
// source program
sc.parallelize(Seq(Array.fill[Double](10000)(1),
1).selectExpr("value[0]").count
// part of generated code
double[] value1 = ...
final ArrayData value = isNull ? null : GenericArrayData.allocate(value1);
```
Another use case is PR https://github.com/apache/spark/pull/13704.
https://github.com/apache/spark/pull/13704 can generate the following code. At
Line 046, this PR can eliminate data conversion from a primitive array and
```Array[Any]```. At Line 051, this PR can also eliminate data conversion.
```java
/* 044 */ if (!inputadapter_isNull) {
/* 045 */ final double[] deserializetoobject_values =
inputadapter_value.toDoubleArray();
/* 046 */ deserializetoobject_value1 = new
GenericArrayData(deserializetoobject_values);
/* 047 */
/* 048 */ }
/* 049 */
/* 050 */ boolean deserializetoobject_isNull =
deserializetoobject_isNull1;
/* 051 */ final double[] deserializetoobject_value =
deserializetoobject_isNull ? null : (double[])
deserializetoobject_value1.toDoubleArray();
```
If https://github.com/apache/spark/pull/13680 is also merged, we can
improve performance of format conversion between ```UnsafeArrayData``` and
```GenericArrayData``` by using ```Platform.copy```.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]