spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From liancheng <>
Subject [GitHub] spark pull request: [SPARK-14237][SQL] De-duplicate partition valu...
Date Tue, 03 May 2016 11:10:33 GMT
GitHub user liancheng opened a pull request:

    [SPARK-14237][SQL] De-duplicate partition value appending logic in various buildReader()

    ## What changes were proposed in this pull request?
    Currently, various `FileFormat` data sources share approximately the same code for partition
value appending. This PR tries to eliminate this duplication.
    A new method `buildReaderWithPartitionValues()` is added to `FileFormat` with a default
implementation that appends partition values to `InternalRow`s produced by the reader function
returned by `buildReader`.
    Special data sources like Parquet, which implements partition value appending inside `buildReader`
because of the vectorized reader, and the Text data source, which doesn't support partitioning,
override `buildReaderWithPartitionValues()` and simply delegate to `buildReader`.
    This PR brings two benefits:
    1. Apparently, it de-duplicates partition value appending logic
    2. The reader function returned by `FileFormat.buildReader()` is only required to produce
`InternalRow`s rather than `UnsafeRow`s now.
       Because the safe-to-unsafe conversion is also performed while appending partition values.
This makes 3rd-party data sources (e.g. spark-avro) easier to implement since they no longer
need to access private APIs involving `UnsafeRow`.
    ## How was this patch tested?
    Existing tests should do the work.

You can merge this pull request into a Git repository by running:

    $ git pull spark-14237-simplify-partition-values-appending

Alternatively you can review and apply these changes as the patch at:

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #12866
commit fa0d19d89ee01ba871c0f13f53fe92fb4927854c
Author: Cheng Lian <>
Date:   2016-05-03T10:27:57Z

    Abstracts away partition value appending

commit 4c946a91e390f902f31581df58fe4e43477a9ce8
Author: Cheng Lian <>
Date:   2016-05-03T10:53:30Z

    Fixes serialization


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 or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message