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-3911] [SQL] HiveSimpleUdf can not be optimized in constant folding #2771

Closed

Conversation

chenghao-intel
Copy link
Contributor

explain extended select cos(null) from src limit 1;

outputs:

 Project [HiveSimpleUdf#org.apache.hadoop.hive.ql.udf.UDFCos(null) AS c_0#5]
  MetastoreRelation default, src, None

== Optimized Logical Plan ==
Limit 1
 Project [HiveSimpleUdf#org.apache.hadoop.hive.ql.udf.UDFCos(null) AS c_0#5]
  MetastoreRelation default, src, None

== Physical Plan ==
Limit 1
 Project [HiveSimpleUdf#org.apache.hadoop.hive.ql.udf.UDFCos(null) AS c_0#5]
  HiveTableScan [], (MetastoreRelation default, src, None), None

After patching this PR it outputs

== Parsed Logical Plan ==
Limit 1
 Project ['cos(null) AS c_0#0]
  UnresolvedRelation None, src, None

== Analyzed Logical Plan ==
Limit 1
 Project [HiveSimpleUdf#org.apache.hadoop.hive.ql.udf.UDFCos(null) AS c_0#0]
  MetastoreRelation default, src, None

== Optimized Logical Plan ==
Limit 1
 Project [null AS c_0#0]
  MetastoreRelation default, src, None

== Physical Plan ==
Limit 1
 Project [null AS c_0#0]
  HiveTableScan [], (MetastoreRelation default, src, None), None

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@SparkQA
Copy link

SparkQA commented Oct 11, 2014

QA tests have started for PR 2771 at commit cc3091e.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Oct 11, 2014

QA tests have finished for PR 2771 at commit cc3091e.

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

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/21647/Test PASSed.

@transient
protected lazy val isUDFDeterministic = {
val udfType = function.getClass().getAnnotation(classOf[HiveUDFType])
(udfType != null && udfType.deterministic())
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: redundant parenthesis.

@liancheng
Copy link
Contributor

This LGTM. Would you mind to add some tests? Probably in ExpressionOptimizationSuite. Thanks.

@chenghao-intel
Copy link
Contributor Author

Thank you @liancheng , I've updated the code.

@chenghao-intel
Copy link
Contributor Author

test this please.

@marmbrus
Copy link
Contributor

ok to test

@SparkQA
Copy link

SparkQA commented Oct 21, 2014

QA tests have started for PR 2771 at commit 405d9cf.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Oct 21, 2014

QA tests have finished for PR 2771 at commit 405d9cf.

  • This patch fails to build.
  • This patch merges cleanly.
  • This patch adds no public classes.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/21940/
Test FAILed.

@liancheng
Copy link
Contributor

retest this please

@SparkQA
Copy link

SparkQA commented Oct 22, 2014

QA tests have started for PR 2771 at commit 405d9cf.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Oct 22, 2014

QA tests have finished for PR 2771 at commit 405d9cf.

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

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/22033/
Test PASSed.

@chenghao-intel
Copy link
Contributor Author

@marmbrus @liancheng any more comments on this?

@@ -74,4 +76,30 @@ class QueryTest extends FunSuite {
""".stripMargin)
}
}

// The following copy is copied from org.apache.spark.sql.catalyst.plans.PlanTest
Copy link
Contributor

Choose a reason for hiding this comment

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

How about making QueryTest inherit from PlanTest instead? Just like what we did in another PlanTest in sql/core.

@SparkQA
Copy link

SparkQA commented Oct 25, 2014

Test build #445 has started for PR 2771 at commit 405d9cf.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Oct 25, 2014

Test build #445 timed out for PR 2771 at commit 405d9cf after a configured wait of 120m.

@SparkQA
Copy link

SparkQA commented Oct 26, 2014

Test build #457 has started for PR 2771 at commit 405d9cf.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Oct 26, 2014

Test build #461 has started for PR 2771 at commit 405d9cf.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Oct 26, 2014

Test build #457 has finished for PR 2771 at commit 405d9cf.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Oct 27, 2014

Test build #461 timed out for PR 2771 at commit 405d9cf after a configured wait of 120m.

@chenghao-intel
Copy link
Contributor Author

test this please.

@SparkQA
Copy link

SparkQA commented Oct 27, 2014

Test build #22280 has started for PR 2771 at commit 1379c73.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Oct 27, 2014

Test build #22280 has finished for PR 2771 at commit 1379c73.

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

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/22280/
Test PASSed.

@chenghao-intel
Copy link
Contributor Author

@marmbrus @liancheng any more comment on this?

@marmbrus
Copy link
Contributor

Thanks! Merged to master.

@asfgit asfgit closed this in 418ad83 Oct 28, 2014
@chenghao-intel chenghao-intel deleted the hive_udf_constant_folding branch July 2, 2015 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants