Skip to content
This repository was archived by the owner on Apr 27, 2024. It is now read-only.

Conversation

@mkressirer
Copy link
Collaborator

…he rule OptimizeMetadataOnlyQuery

This PR is to backport apache#20684 and apache#20693 to Spark 2.3 branch


What changes were proposed in this pull request?

val tablePath = new File(s"${path.getCanonicalPath}/cOl3=c/cOl1=a/cOl5=e")
 Seq(("a", "b", "c", "d", "e")).toDF("cOl1", "cOl2", "cOl3", "cOl4", "cOl5")
 .write.json(tablePath.getCanonicalPath)
 val df = spark.read.json(path.getCanonicalPath).select("CoL1", "CoL5", "CoL3").distinct()
 df.show()

It generates a wrong result.

[c,e,a]

We have a bug in the rule OptimizeMetadataOnlyQuery . We should respect the attribute order in the original leaf node. This PR is to fix it.

How was this patch tested?

Added a test case

Author: Xingbo Jiang [email protected]
Author: gatorsmile [email protected]

Closes apache#20763 from gatorsmile/backport23523.

What changes were proposed in this pull request?

(Please fill in changes proposed in this fix)

How was this patch tested?

(Please explain how this patch was tested. E.g. unit tests, integration tests, manual tests)
(If this patch involves UI changes, please attach a screenshot; otherwise, remove this)

Please review http://spark.apache.org/contributing.html before opening a pull request.

…he rule OptimizeMetadataOnlyQuery

This PR is to backport #20684 and #20693 to Spark 2.3 branch

---

## What changes were proposed in this pull request?
```Scala
val tablePath = new File(s"${path.getCanonicalPath}/cOl3=c/cOl1=a/cOl5=e")
 Seq(("a", "b", "c", "d", "e")).toDF("cOl1", "cOl2", "cOl3", "cOl4", "cOl5")
 .write.json(tablePath.getCanonicalPath)
 val df = spark.read.json(path.getCanonicalPath).select("CoL1", "CoL5", "CoL3").distinct()
 df.show()
```

It generates a wrong result.
```
[c,e,a]
```

We have a bug in the rule `OptimizeMetadataOnlyQuery `. We should respect the attribute order in the original leaf node. This PR is to fix it.

## How was this patch tested?
Added a test case

Author: Xingbo Jiang <[email protected]>
Author: gatorsmile <[email protected]>

Closes #20763 from gatorsmile/backport23523.
@mkressirer mkressirer merged commit 88209e1 into toasttab:branch-2.3 Mar 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants