GitHub user kiszk opened a pull request:
https://github.com/apache/spark/pull/18002
[SPARK-20770][SQL] Improve ColumnStats
## What changes were proposed in this pull request?
This PR improves the implementation of `ColumnStats` by using the following
appoaches.
1. Declare subclasses of `ColumnStats` as `final`
2. Remove unnecessary call of `row.isNullAt(ordinal)`
3. Remove the dependency on `GenericInternalRow`
For 1., this declaration encourages method inlining and other optimizations
of JIT compiler
For 2., in `gatherStats()`, while previous code in subclasses of
`ColumnStats` always calls `row.isNullAt()` twice, the PR just calls
`row.isNullAt()` only once.
For 3., `collectedStatistics()` returns `Array[Any]` instead of
`GenericInternalRow`. This removes the dependency of unnecessary package and
reduces the number of allocations of `GenericInternalRow`.
In addition to that, in the future, `gatherValueStats()`, which is
specialized for each data type, can be effectively called from the generated
code without using generic data structure `InternalRow`.
## How was this patch tested?
Tested by existing test suite
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/kiszk/spark SPARK-20770
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/18002.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #18002
----
----
---
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]