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-14349] [SQL] Issue Error Messages for Unsupported Operators/DML/DDL in SQL Context. #12134

Closed
wants to merge 64 commits into from

Conversation

gatorsmile
Copy link
Member

What changes were proposed in this pull request?

Currently, the weird error messages are issued if we use Hive Context-only operations in SQL Context.

For example,

  • When calling Drop Table in SQL Context, we got the following message:
Expected exception org.apache.spark.sql.catalyst.parser.ParseException to be thrown, but java.lang.ClassCastException was thrown.
  • When calling Script Transform in SQL Context, we got the message:
assertion failed: No plan for ScriptTransformation [key#9,value#10], cat, [tKey#155,tValue#156], null
+- LogicalRDD [key#9,value#10], MapPartitionsRDD[3] at beforeAll at BeforeAndAfterAll.scala:187

Updates:
Based on the investigation from @hvanhovell , the root cause is visitChildren, which is the default implementation. It always returns the result of the last defined context child. After merging the code changes from @hvanhovell , it works! Thank you @hvanhovell !

How was this patch tested?

A few test cases are added.

Not sure if the same issue exist for the other operators/DDL/DML. @hvanhovell

gatorsmile and others added 30 commits November 13, 2015 14:50
@SparkQA
Copy link

SparkQA commented Apr 4, 2016

Test build #54835 has finished for PR 12134 at commit c7c9461.

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

@SparkQA
Copy link

SparkQA commented Apr 4, 2016

Test build #54838 has finished for PR 12134 at commit e69a7e8.

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

inRowFormat: RowFormatContext,
recordWriter: Token,
outRowFormat: RowFormatContext,
recordReader: Token,
schemaLess: Boolean): ScriptInputOutputSchema = null
Copy link
Contributor

Choose a reason for hiding this comment

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

Undo this change and throw the exception here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Thank you!

@SparkQA
Copy link

SparkQA commented Apr 4, 2016

Test build #54850 has finished for PR 12134 at commit e4f06f9.

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

@SparkQA
Copy link

SparkQA commented Apr 4, 2016

Test build #54851 has finished for PR 12134 at commit 07264c0.

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

@SparkQA
Copy link

SparkQA commented Apr 4, 2016

Test build #54852 has finished for PR 12134 at commit c618a78.

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

@@ -201,6 +202,31 @@ class HiveQlSuite extends SparkFunSuite with BeforeAndAfterAll {
assert(plan.children.head.asInstanceOf[Generate].generator.isInstanceOf[JsonTuple])
}

test("transform query spec") {
val plan1 = parser.parsePlan("select transform(a, b) using 'func' as c, d from e")
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason for changing the test? Is HiveQlSuite written in a different style?

Copy link
Member Author

Choose a reason for hiding this comment

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

: ) Let me import all the dsl from Catalyst. I have no clue why the test cases in sql/hive does not do it.

@hvanhovell
Copy link
Contributor

@gatorsmile we are getting there. Two minor comments.

@SparkQA
Copy link

SparkQA commented Apr 4, 2016

Test build #54868 has finished for PR 12134 at commit 4486c75.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class HiveQlSuite extends PlanTest

@SparkQA
Copy link

SparkQA commented Apr 5, 2016

Test build #54919 has finished for PR 12134 at commit 249febf.

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

@@ -351,7 +364,8 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef] with Logging {
string(script),
attributes,
withFilter,
withScriptIOSchema(inRowFormat, recordWriter, outRowFormat, recordReader, schemaLess))
withScriptIOSchema(
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: one line (i.e. revert this).

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! After we adding ctx, it has 102 characters. Thus, have to split it into two lines.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, my bad :)

Copy link
Member Author

Choose a reason for hiding this comment

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

: )

@hvanhovell
Copy link
Contributor

LGTM - pending rebase/merge and jenkins.

# Conflicts:
#	sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLCommandSuite.scala
@SparkQA
Copy link

SparkQA commented Apr 5, 2016

Test build #54965 has finished for PR 12134 at commit 8a7fcf6.

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

@gatorsmile
Copy link
Member Author

retest this please

@SparkQA
Copy link

SparkQA commented Apr 5, 2016

Test build #54966 has finished for PR 12134 at commit 8a7fcf6.

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

@SparkQA
Copy link

SparkQA commented Apr 5, 2016

Test build #2756 has finished for PR 12134 at commit 8a7fcf6.

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

@hvanhovell
Copy link
Contributor

Merging to master. Thanks!

@asfgit asfgit closed this in 7807173 Apr 5, 2016
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