[SPAKRK-33639][SQL]The external table does not specify a location#30719
Closed
guixiaowen wants to merge 1 commit intoapache:branch-2.4from
Closed
[SPAKRK-33639][SQL]The external table does not specify a location#30719guixiaowen wants to merge 1 commit intoapache:branch-2.4from
guixiaowen wants to merge 1 commit intoapache:branch-2.4from
Conversation
|
Can one of the admins verify this patch? |
Member
|
@guixiaowen, new features should target master branch. Also, I believe this syntax is from Hive. In this case, I don't think it's worthwhile fixing it. |
|
We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
When creating an external table, if the external path is not declared, an error will be reported, so the sense of interaction is not very user-friendly.
When creating an internal table, a path is initialized, which is the default path.
If this path is also set to the path of the external table, user interaction will become more friendly.
Why are the changes needed?
Increase the friendly experience of user interaction.
Does this PR introduce any user-facing change?
The user does not need to make any modification. If the user does not want such a configuration to take effect, he can close this modification.
How was this patch tested?
State before modification:
spark-sql> create external table if not exists
external_table_spark_2(last_updateSTRING,col_aSTRING)> PARTITIONED BY (
par_dtSTRING)> ROW FORMAT SERDE 'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
> WITH SERDEPROPERTIES (
> 'field.delim' = ',',
> 'serialization.format' = ','
> )
> STORED AS
> INPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
> OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'
> ;
Error in query:
Operation not allowed: CREATE EXTERNAL TABLE must be accompanied by LOCATION(line 1, pos 0)
== SQL ==
create external table if not exists
external_table_spark_2(last_updateSTRING,col_aSTRING)^^^
PARTITIONED BY (
par_dtSTRING)ROW FORMAT SERDE 'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
WITH SERDEPROPERTIES (
'field.delim' = ',',
'serialization.format' = ','
)
STORED AS
INPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'
Modified state:
spark-sql> CREATE EXTERNAL TABLE
external_table_spark_10(last_updateSTRING,col_aSTRING)> PARTITIONED BY (
par_dtSTRING)> ROW FORMAT SERDE 'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
> WITH SERDEPROPERTIES (
> 'field.delim' = ',',
> 'serialization.format' = ','
> )
> STORED AS
> INPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
> OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat';
20/11/02 11:26:59 DEBUG log: DDL: struct external_table_spark_10 { string last_update, string col_a}
Response code
Time taken: 1.024 seconds
spark-sql>
After modification, the table creation statement will add the table creation path by default.
spark-sql> show create table external_table_spark_10;
createtab_stmt
CREATE EXTERNAL TABLE
external_table_spark_10(last_updateSTRING,col_aSTRING)PARTITIONED BY (
par_dtSTRING)ROW FORMAT SERDE 'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
WITH SERDEPROPERTIES (
'field.delim' = ',',
'serialization.format' = ','
)
STORED AS
INPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat'
LOCATION 'hdfs://xxxx/xxxx/xxxx/xxxx/xxxx/xxxx/external_table_spark_10'
TBLPROPERTIES (
'transient_lastDdlTime' = '1604287619',
'PART_LIMIT' = '10000',
'LEVEL' = '0',
'TTL' = '60'
)
If you don't want this modification to take effect, you can set spark.sql.create.external.statement.location to true.
spark.sql.create.external.statement.location=true