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-6212][SQL] Fix bug of explain CTAS #7980

Closed
wants to merge 2 commits into from

Conversation

chenghao-intel
Copy link
Contributor

As we assume the CreateTableAsSelect is the leaf node, so it breaks the transformation rules applied recursively, while we do the explain command.

To execute the explain for CTAS like:

explain extended create table temp__b as select key, 1+4 from src limit 2;

W/o this PR:

== Parsed Logical Plan ==
'CreateTableAsSelect HiveTable(None,temp__b,List(),List(),Map(),Map(),ManagedTable,None,Some(org.apache.hadoop.mapred.TextInputFormat),Some(org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat),None,None), false
 'Limit 2
  'Project [unresolvedalias('key),unresolvedalias((1 + 4))]
   'UnresolvedRelation [src], None

== Analyzed Logical Plan ==

CreateTableAsSelect [Database:default, TableName: temp__b, InsertIntoHiveTable]
Limit 2
 Project [key#1,(1 + 4) AS _c1#3]
  MetastoreRelation default, src, None

== Optimized Logical Plan ==
CreateTableAsSelect [Database:default, TableName: temp__b, InsertIntoHiveTable]
Limit 2
 Project [key#1,(1 + 4) AS _c1#3]
  MetastoreRelation default, src, None

== Physical Plan ==
ExecutedCommand (CreateTableAsSelect [Database:default, TableName: temp__b, InsertIntoHiveTable]
Limit 2
 Project [key#1,(1 + 4) AS _c1#3]
  MetastoreRelation default, src, None)

Code Generation: true
== RDD ==

W/ this PR:

== Parsed Logical Plan ==
'CreateTableAsSelect HiveTable(None,temp__b,List(),List(),Map(),Map(),ManagedTable,None,Some(org.apache.hadoop.mapred.TextInputFormat),Some(org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat),None,None), false
 'Limit 2
  'Project [unresolvedalias('key),unresolvedalias((1 + 4))]
   'UnresolvedRelation [src], None

== Analyzed Logical Plan ==

CreateTableAsSelect [AllowExisting: false, HiveTable: HiveTable(Some(default),temp__b,List(),List(),Map(),Map(),ManagedTable,None,Some(org.apache.hadoop.mapred.TextInputFormat),Some(org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat),Some(org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe),None)]
 Limit 2
  Project [key#1,(1 + 4) AS _c1#3]
   MetastoreRelation default, src, None

== Optimized Logical Plan ==
CreateTableAsSelect [AllowExisting: false, HiveTable: HiveTable(Some(default),temp__b,List(),List(),Map(),Map(),ManagedTable,None,Some(org.apache.hadoop.mapred.TextInputFormat),Some(org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat),Some(org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe),None)]
 Limit 2
  Project [key#1,5 AS _c1#3]
   MetastoreRelation default, src, None

== Physical Plan ==
ExecutedCommand [cmd:CreateTableAsSelect [AllowExisting: false, HiveTable: HiveTable(Some(default),temp__b,List(),List(),Map(),Map(),ManagedTable,None,Some(org.apache.hadoop.mapred.TextInputFormat),Some(org.apache.hadoop.hive.ql.io.IgnoreKeyTextOutputFormat),Some(org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe),None)]
 Limit 2
  Project [key#1,5 AS _c1#3]
   MetastoreRelation default, src, None
]

Code Generation: true
== RDD ==

@SparkQA
Copy link

SparkQA commented Aug 6, 2015

Test build #39963 has finished for PR 7980 at commit f6961e5.

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

@SparkQA
Copy link

SparkQA commented Aug 6, 2015

Test build #40003 has finished for PR 7980 at commit 8dc37e9.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants