Skip to content

Conversation

@gengliangwang
Copy link
Member

@gengliangwang gengliangwang commented Feb 28, 2022

What changes were proposed in this pull request?

The V1 "DESC TABLE EXTENDED" command contains info of "Database" and "Table", which can be used by external tools like DBT: #17394

However, the V2 version contains only one field "name" representing "catalog.database.table". External tools can't recognize it.
Also, it is weird to have different command outputs from the same command.

This PR is to make the database/table name output of V1/V2 "desc extended table" consistent. For the output of V2 tables, this PR also shows the catalog name in the output.

Why are the changes needed?

Make the database/table name output of V1/V2 "desc extended table" consistent so that it can be parsed by external tools like DBT.

Does this PR introduce any user-facing change?

Yes, it changes the database/table name output of V2 "desc extended table" so that it becomes consistent with V1 tables.

How was this patch tested?

UT

@github-actions github-actions bot added the SQL label Feb 28, 2022
@gengliangwang
Copy link
Member Author

rows += toCatalystRow("# Detailed Table Information", "", "")
rows += toCatalystRow("Name", table.name(), "")
rows += toCatalystRow("Catalog", resolvedTable.catalog.name(), "")
rows += toCatalystRow("Database", resolvedTable.identifier.namespace().mkString("."), "")

Choose a reason for hiding this comment

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

is namespace() returning a list? Should this be a single identifier?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, namespace() returns a list. It's a feature of DS V2. Usually the length should be 1.

Choose a reason for hiding this comment

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

so if it returns a list will the Database name contain periods?

Copy link
Member Author

Choose a reason for hiding this comment

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

If the length of the namespace is 1, there is no any period

Choose a reason for hiding this comment

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

we spoke online with Wenchen and Gengliang, didn't realize the namespace is a multi part name.

" COMMENT 'this is a test table'" +
" LOCATION 'file:/tmp/testcat/table_name'")
val descriptionDf = spark.sql("DESCRIBE TABLE EXTENDED testcat.table_name")
val descriptionDf = spark.sql("DESCRIBE TABLE EXTENDED testcat.default.table_name")

Choose a reason for hiding this comment

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

Does this also fix SHOW TABLE EXTENDED?

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no V2 version of SHOW TABLE EXTENDED yet.

Choose a reason for hiding this comment

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

makes sense

@gengliangwang gengliangwang changed the title [SPARK-38350][SQL] Make the output of V1/V2 "desc extended table" consistent [SPARK-38350][SQL] Make the table name output of V1/V2 "desc extended table" consistent Mar 2, 2022
@gengliangwang
Copy link
Member Author

I am closing this one for now, in favor of #35265
cc @imback82

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants