GitHub user xwu0226 opened a pull request:
https://github.com/apache/spark/pull/12716
[Spark-14933][SQL] Failed to create view out of a parquet or orc table
## What changes were proposed in this pull request?
If a table is created as parquet or ORC table with hive syntaxt DDL, such as
`create table t1 (c1 int, c2 string) stored as parquet`
The following command will fail
`create view v1 as select * from t1`
The root cause is that when resolving the relation for the parquet table
t1, `HiveMetaStoreCatalog` convert it to a `LogicalRelation`, but without a
tableIdentifier attached to it. So when `SQLBuilder `is trying to create a
`SQLTable `out of it, the `LogicalRelation` created earlier does not mach due
to the lack of tableIdentifier. Thus, `SQLBuilder.toSQL `can not recognize this
logical plan and issue exception.
The fix in this PR is to also give `TableIdentifier `to the
`LogicalRelation `created for parquet or orc table in `HiveMetaStoreCatalog`
## How was this patch tested?
testcases created and dev/run-tests is run.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/xwu0226/spark SPARK_14933
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/12716.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #12716
----
commit 82bf3e2d7de879c3ca1fca7c733c1d8cfd1bed1a
Author: xin Wu <[email protected]>
Date: 2016-04-26T21:41:50Z
pass along the table identifier when converting parquet table to
LogicalRelation in HiveMetastoreCatalog
commit fc971a0eeaed1e8881ce2bb94cd886e841313177
Author: xin Wu <[email protected]>
Date: 2016-04-26T22:27:12Z
modify testcase name
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]