[GitHub] spark pull request #15569: [SPARK-18029][SQL] PruneFileSourcePartitions shou...

2016-10-20 Thread asfgit
Github user asfgit closed the pull request at:

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


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

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



[GitHub] spark pull request #15569: [SPARK-18029][SQL] PruneFileSourcePartitions shou...

2016-10-20 Thread rxin
Github user rxin commented on a diff in the pull request:

https://github.com/apache/spark/pull/15569#discussion_r84340141
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/interface.scala
 ---
@@ -102,8 +102,8 @@ case class CatalogTablePartition(
* Given the partition schema, returns a row with that schema holding 
the partition values.
*/
   def toRow(partitionSchema: StructType): InternalRow = {
-InternalRow.fromSeq(partitionSchema.map { case StructField(name, 
dataType, _, _) =>
-  Cast(Literal(spec(name)), dataType).eval()
+InternalRow.fromSeq(partitionSchema.map { field =>
--- End diff --

There is this one: 
https://cwiki.apache.org/confluence/display/SPARK/Spark+Code+Style+Guide

But it is fairly basic.


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

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



[GitHub] spark pull request #15569: [SPARK-18029][SQL] PruneFileSourcePartitions shou...

2016-10-20 Thread mallman
Github user mallman commented on a diff in the pull request:

https://github.com/apache/spark/pull/15569#discussion_r84338922
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/interface.scala
 ---
@@ -102,8 +102,8 @@ case class CatalogTablePartition(
* Given the partition schema, returns a row with that schema holding 
the partition values.
*/
   def toRow(partitionSchema: StructType): InternalRow = {
-InternalRow.fromSeq(partitionSchema.map { case StructField(name, 
dataType, _, _) =>
-  Cast(Literal(spec(name)), dataType).eval()
+InternalRow.fromSeq(partitionSchema.map { field =>
--- End diff --

I see. Do we have a Spark style guide?


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

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



[GitHub] spark pull request #15569: [SPARK-18029][SQL] PruneFileSourcePartitions shou...

2016-10-20 Thread rxin
Github user rxin commented on a diff in the pull request:

https://github.com/apache/spark/pull/15569#discussion_r84332975
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/interface.scala
 ---
@@ -102,8 +102,8 @@ case class CatalogTablePartition(
* Given the partition schema, returns a row with that schema holding 
the partition values.
*/
   def toRow(partitionSchema: StructType): InternalRow = {
-InternalRow.fromSeq(partitionSchema.map { case StructField(name, 
dataType, _, _) =>
-  Cast(Literal(spec(name)), dataType).eval()
+InternalRow.fromSeq(partitionSchema.map { field =>
--- End diff --

See https://github.com/databricks/scala-style-guide/pull/40


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

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



[GitHub] spark pull request #15569: [SPARK-18029][SQL] PruneFileSourcePartitions shou...

2016-10-20 Thread mallman
Github user mallman commented on a diff in the pull request:

https://github.com/apache/spark/pull/15569#discussion_r84324810
  
--- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/interface.scala
 ---
@@ -102,8 +102,8 @@ case class CatalogTablePartition(
* Given the partition schema, returns a row with that schema holding 
the partition values.
*/
   def toRow(partitionSchema: StructType): InternalRow = {
-InternalRow.fromSeq(partitionSchema.map { case StructField(name, 
dataType, _, _) =>
-  Cast(Literal(spec(name)), dataType).eval()
+InternalRow.fromSeq(partitionSchema.map { field =>
--- End diff --

Why are you proposing this change?


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

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



[GitHub] spark pull request #15569: [SPARK-18029][SQL] PruneFileSourcePartitions shou...

2016-10-20 Thread cloud-fan
GitHub user cloud-fan opened a pull request:

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

[SPARK-18029][SQL] PruneFileSourcePartitions should not change the output 
of LogicalRelation

## What changes were proposed in this pull request?

In `PruneFileSourcePartitions`, we will replace the `LogicalRelation` with 
a pruned one. However, this replacement may change the output of the 
`LogicalRelation` if it doesn't have `expectedOutputAttributes`. This PR fixes 
it.

## How was this patch tested?

the new `PruneFileSourcePartitionsSuite`

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

$ git pull https://github.com/cloud-fan/spark partition-bug

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

https://github.com/apache/spark/pull/15569.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 #15569


commit 8b4450c1e5a6b116955c0b360a1bc3905d048d3b
Author: Wenchen Fan 
Date:   2016-10-20T14:59:41Z

PruneFileSourcePartitions should not change the output of LogicalRelation




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

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