Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-20718][SQL][followup] Fix canonicalization for HiveTableScanExec #17962

Closed
wants to merge 3 commits into from

Conversation

wzhfy
Copy link
Contributor

@wzhfy wzhfy commented May 12, 2017

What changes were proposed in this pull request?

Fix canonicalization for different filter orders in HiveTableScanExec.

How was this patch tested?

Added a new test case.

@wzhfy
Copy link
Contributor Author

wzhfy commented May 12, 2017

cc @gatorsmile @cloud-fan

@@ -442,4 +442,14 @@ object QueryPlan {
}
}.canonicalized.asInstanceOf[T]
}

/** Normalize and reorder the expressions in the given sequence. */
def canonicalizeExprSeq(exprSeq: Seq[Expression], output: AttributeSeq): Seq[Expression] = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: normalizePredicates

/** Normalize and reorder the expressions in the given sequence. */
def canonicalizeExprSeq(exprSeq: Seq[Expression], output: AttributeSeq): Seq[Expression] = {
if (exprSeq.nonEmpty) {
val normalizedExprs = QueryPlan.normalizeExprId(exprSeq.reduce(And), output)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: QueryPlan.normalizeExprId -> normalizeExprId

@@ -442,4 +442,14 @@ object QueryPlan {
}
}.canonicalized.asInstanceOf[T]
}

/** Normalize and reorder the expressions in the given sequence. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do we reorder the predicates?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It links predicates with AND and pass it to def normalizeExprId, in which Canonicalize.execute is called. That's where we do the reordering.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. Could you update the above comment, since this is a little bit confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I'll update the comments.

@gatorsmile
Copy link
Member

LGTM cc @cloud-fan

@cloud-fan
Copy link
Contributor

LGTM

@SparkQA
Copy link

SparkQA commented May 12, 2017

Test build #76853 has finished for PR 17962 at commit a61e865.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
  • trait DataSourceScanExec extends LeafExecNode with CodegenSupport

@SparkQA
Copy link

SparkQA commented May 12, 2017

Test build #76859 has finished for PR 17962 at commit eee74e7.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented May 12, 2017

Test build #76861 has finished for PR 17962 at commit dd9dace.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

asfgit pushed a commit that referenced this pull request May 12, 2017
## What changes were proposed in this pull request?

Fix canonicalization for different filter orders in `HiveTableScanExec`.

## How was this patch tested?

Added a new test case.

Author: wangzhenhua <[email protected]>

Closes #17962 from wzhfy/canonicalizeHiveTableScanExec.

(cherry picked from commit 54b4f2a)
Signed-off-by: Wenchen Fan <[email protected]>
@cloud-fan
Copy link
Contributor

thanks, merging to master/2.2!

@asfgit asfgit closed this in 54b4f2a May 12, 2017
robert3005 pushed a commit to palantir/spark that referenced this pull request May 19, 2017
## What changes were proposed in this pull request?

Fix canonicalization for different filter orders in `HiveTableScanExec`.

## How was this patch tested?

Added a new test case.

Author: wangzhenhua <[email protected]>

Closes apache#17962 from wzhfy/canonicalizeHiveTableScanExec.
liyichao pushed a commit to liyichao/spark that referenced this pull request May 24, 2017
## What changes were proposed in this pull request?

Fix canonicalization for different filter orders in `HiveTableScanExec`.

## How was this patch tested?

Added a new test case.

Author: wangzhenhua <[email protected]>

Closes apache#17962 from wzhfy/canonicalizeHiveTableScanExec.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants