Uh oh!
There was an error while loading. Please reload this page.
[SPARK-14127][SQL][WIP] Describe table - #12460
Conversation
dilipbiswal
commented
Apr 18, 2016
@andrewor14 Looking for some early feedback on this as i was thinking to do the same for show table extended. I did have a brief discussion with @gatorsmile on this. |
gatorsmile
commented
Apr 18, 2016
Please resolve the conflicts. : ) |
dilipbiswal
commented
Apr 18, 2016
@gatorsmile Thank you. I have resolved the conflicts. |
There was a problem hiding this comment.
It is a bit more complicates than I thought. We allow strings here because Hive allows us to use the '$elem', '$keys' and '$values' 'keywords'. That is why I added strings to the rule. I am not sure if we should support this. What do you guys think?
This is what I found in the Hive manual:
DESCRIBE [EXTENDED|FORMATTED] [db_name.]table_name[ col_name ( [.field_name] | [.'$elem$'] | [.'$key$'] | [.'$value$'] )* ];See also: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-Describe
There was a problem hiding this comment.
Yeah Herman. Not supporting it would certainly simplify things. FYI - I checked that the unit test case describe_xpath.q which exercises this syntax is not getting tested in HiveCompatibleSuite.
There was a problem hiding this comment.
Ok, lets remove this from the grammar as well, and just use a dot separated list of identifiers. Actually, are we currently able to deal with nested columns?
There was a problem hiding this comment.
@hvanhovell Hi Herman, I tried very simple scenarios of using nested columns and it seems to work ok. Let me paste the output here.
map
createtablemp_t1 (a map <int, string>, b string) row format delimited collection items terminated by '$' map keys terminated by '#';
load data local inpath '/data/mapfile' overwrite into table mp_t1; select*from mp_t1;
a b
{100:"spark"} ABC
describe extended mp_t1.a.$key$;
Result
======
$key$ intfrom deserializerStruct
createtablect_t (a struct<n1: string, n2: string>, b string) stored as textfile; insert into ct_t values (('abc', 'efg'), 'ABC'); spark-sql>select*from ct_t;
{"n1":"abb","n2":"efg"} ABC
spark-sql> describe extended ct_t.a.n1;
OK
n1 string from deserializer Herman, based on hive syntax diagram, i was expecting the following command to work.
describe extended mp_t1.a.'$key$';
However, i get a parse exception and when i remove the quotes it works like following.
describe extended mp_t1.a.$key$
Given this, what kind of changes we need to make to the grammar if we need to support this ? Please let me know your thoughts.
There was a problem hiding this comment.
@hvanhovell Let me work on the grammar change. I will introduce a rule colPathIdentifier which is basically a regular identifier or the set of key, value, elem keywords.
There was a problem hiding this comment.
@dilipbiswal Do you plan on supporting the key/value/elem keywords and nested elements? Which would be cool.
There was a problem hiding this comment.
@hvanhovell Yeah. I have attempted to support the key/value/elem keywords. Could you please check to see if there are any issues ? I am also trying to test this a bit more in parallel.
SparkQA
commented
Apr 18, 2016
Test build #56071 has finished for PR 12460 at commit
|
SparkQA
commented
Apr 20, 2016
Test build #56333 has finished for PR 12460 at commit
|
SparkQA
commented
Apr 20, 2016
Test build #56335 has finished for PR 12460 at commit
|
SparkQA
commented
Apr 20, 2016
Test build #56371 has finished for PR 12460 at commit
|
dilipbiswal
commented
Apr 20, 2016
rebased.. |
SparkQA
commented
Apr 20, 2016
Test build #56394 has finished for PR 12460 at commit
|
dilipbiswal
commented
Apr 26, 2016
@liancheng Hi Lian, can you please look over this PR and give some comments. Thanks !! |
SparkQA
commented
Apr 27, 2016
Test build #57062 has finished for PR 12460 at commit
|
SparkQA
commented
Apr 27, 2016
Test build #57106 has finished for PR 12460 at commit
|
liancheng
commented
Apr 27, 2016
@dilipbiswal One purpose of re-implementing all DDL as native Spark SQL command is to minimize dependency to Hive so that we can move Hive into a separate data source some day. That said, we really don't want to make these new DDL commands rely on classes like |
dilipbiswal
commented
Apr 27, 2016
@liancheng Thank you for your comment. Actually initially i started with the idea of serving the describe command solely from
|
SparkQA
commented
Apr 30, 2016
Test build #57400 has finished for PR 12460 at commit
|
srowen
commented
May 4, 2016
It looks like this can be closed because #12844 was merged |
dilipbiswal
commented
May 5, 2016
@liancheng Hi Lian, in this PR, i had implemented "describe table partition" and "describe column". @viirya - fyi. |
What changes were proposed in this pull request?
This PR adds .support for describing partitions and columns. Support for describing
tables were already in place. The PR moves the code to SessionCatalog/HiveSessionCatalog.
Command Syntax:
How was this patch tested?
Added test cases to DDLCommandSuite to verify the plan. Added some error tests
to HiveCommandSuite. The rest of the coverage should be from existing test cases.