You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by liancheng <gi...@git.apache.org> on 2016/06/01 05:42:54 UTC

[GitHub] spark pull request: [SPARK-14343][SQL] Proper column pruning for text data s...

GitHub user liancheng opened a pull request:

    https://github.com/apache/spark/pull/13431

    [SPARK-14343][SQL] Proper column pruning for text data source

    ## What changes were proposed in this pull request?
    
    Text data source ignores requested schema, and may give wrong result when the only data column is not requested. This may happen when only partitioning column(s) are requested for a partitioned text table.
    
    ## How was this patch tested?
    
    New test case added in `TextSuite`.
    
    


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

    $ git pull https://github.com/liancheng/spark spark-14343-partitioned-text-table

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

    https://github.com/apache/spark/pull/13431.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 #13431
    
----
commit 1074fa61d5d2dd3f690a58a3a69150adc7db974a
Author: Cheng Lian <li...@databricks.com>
Date:   2016-06-01T05:40:27Z

    Proper column pruning for text data source

----


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14343][SQL] Proper column pruning for text data s...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/13431
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/59731/
    Test PASSed.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14343][SQL] Proper column pruning for text data s...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/13431
  
    **[Test build #59731 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/59731/consoleFull)** for PR 13431 at commit [`7555a4e`](https://github.com/apache/spark/commit/7555a4e484d4683976d6a1b4af89046a4204bab5).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14343][SQL] Proper column pruning for text data s...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/13431
  
    Merged build finished. Test PASSed.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14343][SQL] Proper column pruning for text data s...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/13431
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/59718/
    Test FAILed.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14343][SQL] Proper column pruning for text data s...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/13431
  
    Merged build finished. Test FAILed.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14343][SQL] Proper column pruning for text data s...

Posted by liancheng <gi...@git.apache.org>.
Github user liancheng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/13431#discussion_r65305773
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/text/TextFileFormat.scala ---
    @@ -96,16 +96,23 @@ class TextFileFormat extends FileFormat with DataSourceRegister {
           sparkSession.sparkContext.broadcast(new SerializableConfiguration(hadoopConf))
     
         (file: PartitionedFile) => {
    -      val unsafeRow = new UnsafeRow(1)
    -      val bufferHolder = new BufferHolder(unsafeRow)
    -      val unsafeRowWriter = new UnsafeRowWriter(bufferHolder, 1)
    -
    -      new HadoopFileLinesReader(file, broadcastedHadoopConf.value.value).map { line =>
    -        // Writes to an UnsafeRow directly
    -        bufferHolder.reset()
    -        unsafeRowWriter.write(0, line.getBytes, 0, line.getLength)
    -        unsafeRow.setTotalSize(bufferHolder.totalSize())
    -        unsafeRow
    +      val reader = new HadoopFileLinesReader(file, broadcastedHadoopConf.value.value)
    +
    +      if (requiredSchema.isEmpty) {
    +        val emptyUnsafeRow = new UnsafeRow(0)
    +        reader.map(_ => emptyUnsafeRow)
    +      } else {
    +        val unsafeRow = new UnsafeRow(1)
    --- End diff --
    
    Added at the beginning of this method.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14343][SQL] Proper column pruning for text data s...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/13431#discussion_r65305387
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/text/TextFileFormat.scala ---
    @@ -96,16 +96,23 @@ class TextFileFormat extends FileFormat with DataSourceRegister {
           sparkSession.sparkContext.broadcast(new SerializableConfiguration(hadoopConf))
     
         (file: PartitionedFile) => {
    -      val unsafeRow = new UnsafeRow(1)
    -      val bufferHolder = new BufferHolder(unsafeRow)
    -      val unsafeRowWriter = new UnsafeRowWriter(bufferHolder, 1)
    -
    -      new HadoopFileLinesReader(file, broadcastedHadoopConf.value.value).map { line =>
    -        // Writes to an UnsafeRow directly
    -        bufferHolder.reset()
    -        unsafeRowWriter.write(0, line.getBytes, 0, line.getLength)
    -        unsafeRow.setTotalSize(bufferHolder.totalSize())
    -        unsafeRow
    +      val reader = new HadoopFileLinesReader(file, broadcastedHadoopConf.value.value)
    +
    +      if (requiredSchema.isEmpty) {
    +        val emptyUnsafeRow = new UnsafeRow(0)
    +        reader.map(_ => emptyUnsafeRow)
    +      } else {
    +        val unsafeRow = new UnsafeRow(1)
    --- End diff --
    
    should we add an assert to guarantee `requiredSchema` has less than one element?


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14343][SQL] Proper column pruning for text data s...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/13431
  
    **[Test build #59731 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/59731/consoleFull)** for PR 13431 at commit [`7555a4e`](https://github.com/apache/spark/commit/7555a4e484d4683976d6a1b4af89046a4204bab5).


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14343][SQL] Proper column pruning for text data s...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/13431
  
    **[Test build #59719 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/59719/consoleFull)** for PR 13431 at commit [`d0fda2d`](https://github.com/apache/spark/commit/d0fda2dd86355d01b2baf8d9c47e146f0f4f931a).


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14343][SQL] Proper column pruning for text data s...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/13431
  
    **[Test build #59718 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/59718/consoleFull)** for PR 13431 at commit [`1074fa6`](https://github.com/apache/spark/commit/1074fa61d5d2dd3f690a58a3a69150adc7db974a).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14343][SQL] Proper column pruning for text data s...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/13431
  
    **[Test build #59718 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/59718/consoleFull)** for PR 13431 at commit [`1074fa6`](https://github.com/apache/spark/commit/1074fa61d5d2dd3f690a58a3a69150adc7db974a).


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14343][SQL] Proper column pruning for text data s...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/13431#discussion_r65305575
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/text/TextFileFormat.scala ---
    @@ -96,16 +96,23 @@ class TextFileFormat extends FileFormat with DataSourceRegister {
           sparkSession.sparkContext.broadcast(new SerializableConfiguration(hadoopConf))
     
         (file: PartitionedFile) => {
    -      val unsafeRow = new UnsafeRow(1)
    -      val bufferHolder = new BufferHolder(unsafeRow)
    -      val unsafeRowWriter = new UnsafeRowWriter(bufferHolder, 1)
    -
    -      new HadoopFileLinesReader(file, broadcastedHadoopConf.value.value).map { line =>
    -        // Writes to an UnsafeRow directly
    -        bufferHolder.reset()
    -        unsafeRowWriter.write(0, line.getBytes, 0, line.getLength)
    -        unsafeRow.setTotalSize(bufferHolder.totalSize())
    -        unsafeRow
    +      val reader = new HadoopFileLinesReader(file, broadcastedHadoopConf.value.value)
    +
    +      if (requiredSchema.isEmpty) {
    --- End diff --
    
    should we put this `if` out of the returned function?


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14343][SQL] Proper column pruning for text data s...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the pull request:

    https://github.com/apache/spark/pull/13431
  
    LGTM


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14343][SQL] Proper column pruning for text data s...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the pull request:

    https://github.com/apache/spark/pull/13431
  
    **[Test build #59719 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/59719/consoleFull)** for PR 13431 at commit [`d0fda2d`](https://github.com/apache/spark/commit/d0fda2dd86355d01b2baf8d9c47e146f0f4f931a).
     * This patch **fails Scala style tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14343][SQL] Proper column pruning for text data s...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/13431#discussion_r65305854
  
    --- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/text/TextFileFormat.scala ---
    @@ -96,16 +96,23 @@ class TextFileFormat extends FileFormat with DataSourceRegister {
           sparkSession.sparkContext.broadcast(new SerializableConfiguration(hadoopConf))
     
         (file: PartitionedFile) => {
    -      val unsafeRow = new UnsafeRow(1)
    -      val bufferHolder = new BufferHolder(unsafeRow)
    -      val unsafeRowWriter = new UnsafeRowWriter(bufferHolder, 1)
    -
    -      new HadoopFileLinesReader(file, broadcastedHadoopConf.value.value).map { line =>
    -        // Writes to an UnsafeRow directly
    -        bufferHolder.reset()
    -        unsafeRowWriter.write(0, line.getBytes, 0, line.getLength)
    -        unsafeRow.setTotalSize(bufferHolder.totalSize())
    -        unsafeRow
    +      val reader = new HadoopFileLinesReader(file, broadcastedHadoopConf.value.value)
    +
    +      if (requiredSchema.isEmpty) {
    --- End diff --
    
    nvm, we can't save the reader creation anyway


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14343][SQL] Proper column pruning for text data s...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/13431
  
    Merged build finished. Test FAILed.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14343][SQL] Proper column pruning for text data s...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the pull request:

    https://github.com/apache/spark/pull/13431
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/59719/
    Test FAILed.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request: [SPARK-14343][SQL] Proper column pruning for text data s...

Posted by liancheng <gi...@git.apache.org>.
Github user liancheng commented on the pull request:

    https://github.com/apache/spark/pull/13431
  
    Thanks for the review! Merging to master and branch-2.0.


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org