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

HIVE-24920: TRANSLATED_TO_EXTERNAL tables may write to the same location #2191

Merged
merged 40 commits into from Jun 1, 2021

Conversation

kgyrtkirk
Copy link
Member

What changes were proposed in this pull request?

Why are the changes needed?

Does this PR introduce any user-facing change?

How was this patch tested?

@@ -822,7 +934,7 @@ private Table validateTablePaths(Table table) throws MetaException {
+ table.getTableName() + ",location:" + tablePath + ",Database's managed warehouse:" + dbLocation);
}
} else {
if (FileUtils.isSubdirectory(whRootPath.toString(), tablePath.toString())) {
if (isExternalWarehouseSet() && FileUtils.isSubdirectory(whRootPath.toString(), tablePath.toString())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

So we only care that an external table is outside the managed warehouse root. It does not have to be within the external warehouse. So even if external warehouse isnt set, we shouldnt have to reject a path so long as it is not in the managed warehouse root.

Copy link
Member Author

Choose a reason for hiding this comment

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

I just bumped into this while fixing this issue - in case the externalWarehouse is not set both external and managed tables are placed at the same location with the default configs:

create external table te (a integer); // file:/data/hive/warehouse/t
desc formatted te;
[...]
| Location:                     | file:/data/hive/warehouse/te                       | NULL                                               |
| Table Parameters:             | NULL                                               | NULL                                               |
|                               | EXTERNAL                                           | TRUE                                               |

[...]
create  table tm (a integer);
desc formatted tm;
[...]
| Location:                     | file:/data/hive/warehouse/tm                       | NULL                                               |
| Table Type:                   | EXTERNAL_TABLE                                     | NULL                                               |
|                               | EXTERNAL                                           | TRUE                                               |
|                               | TRANSLATED_TO_EXTERNAL                             | TRUE                                               |
[...]

the root cause of this is that

since the managed location is the same I don't think checking that would make sense...

don't you think that the current change aligns with the existing decisions/behaiour/etc in the above case?

Copy link
Contributor

@nrg4878 nrg4878 left a comment

Choose a reason for hiding this comment

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

Thanks for the changes. Looks good to me.

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