Remove location from SHOW CREATE TABLE for translated table#28494
Remove location from SHOW CREATE TABLE for translated table#28494Kundannitp wants to merge 3 commits intotrinodb:masterfrom
Conversation
In the output of "SHOW CREATE TABLE" cmd 'external_location' is getting printed for managed table as well. This change will restrict that for those managed table which got translated to external table by hive.
|
Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla |
|
Could you please add a test? |
|
@ebyhr Thanks for the review. |
|
@Kundannitp We already have test classes (e.g. BaseTestHiveOnDataLake) with dockerized Hive. |
|
okay thanks |
|
Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla |
|
Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla |
|
@ebyhr |
Fixes #28483
Currently, the SHOW CREATE TABLE command for the Hive connector returns the managed table's path as external_location. This causes confusion as to whether the table is actually managed or external, violating the Principle of Least Surprise.
This change restricts the external_location property from being printed for managed tables that were silently translated to external tables by Hive.
Additional context and related issues
Previously, the if condition only checked if the table type was EXTERNAL_TABLE before appending the external_location property to the DDL.
However, in Hive 3.x+, Hive intercepts non-transactional managed table creations and silently converts them to external tables to bypass ACID requirements. When doing so, Hive marks the table parameter "TRANSLATED_TO_EXTERNAL" as "true".
To fix this, we now explicitly check this parameter. If the table is external but was translated by Hive, we treat it as a managed table for the purpose of SHOW CREATE TABLE and omit the external_location property.
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
(x) Release notes are required, with the following suggested text:
Hive Connector
SHOW CREATE TABLEexposingexternal_locationfor managed tables. ({issue}28483)