-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
[SPARK-34710][SQL] Add tableType column for SHOW TABLES to distinguish view and tables #31804
Changes from all commits
587477b
5090900
2546812
423796f
6bc1614
d2bb4f9
0946863
903adc9
5e9dbcc
bee8cbe
eaba257
f50d87b
3ef5b5f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -843,11 +843,22 @@ case class ShowTablesCommand( | |
val database = tableIdent.database.getOrElse("") | ||
val tableName = tableIdent.table | ||
val isTemp = catalog.isTempView(tableIdent) | ||
val catalogTable = catalog.getTempViewOrPermanentTableMetadata(tableIdent) | ||
val tableType = classicTableTypeString(catalogTable.tableType) | ||
if (isExtended) { | ||
val information = catalog.getTempViewOrPermanentTableMetadata(tableIdent).simpleString | ||
Row(database, tableName, isTemp, s"$information\n") | ||
val information = catalogTable.simpleString | ||
if (output.size == 5) { | ||
Row(database, tableName, isTemp, s"$information\n", tableType) | ||
} else { | ||
Row(database, tableName, isTemp, s"$information\n") | ||
} | ||
} else { | ||
Row(database, tableName, isTemp) | ||
if (output.size == 4) { | ||
Row(database, tableName, isTemp, tableType) | ||
} else { | ||
Row(database, tableName, isTemp) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we still have a test coverage for this line? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, the new |
||
} | ||
|
||
} | ||
} | ||
} else { | ||
|
@@ -870,7 +881,12 @@ case class ShowTablesCommand( | |
val tableName = tableIdent.table | ||
val isTemp = catalog.isTempView(tableIdent) | ||
val information = partition.simpleString | ||
Seq(Row(database, tableName, isTemp, s"$information\n")) | ||
if (output.size == 5) { | ||
val tableType = classicTableTypeString(table.tableType) | ||
Seq(Row(database, tableName, isTemp, s"$information\n", tableType)) | ||
} else { | ||
Seq(Row(database, tableName, isTemp, s"$information\n")) | ||
} | ||
} | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ log4j.rootLogger=INFO, CA, FA | |
log4j.appender.CA=org.apache.log4j.ConsoleAppender | ||
log4j.appender.CA.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.CA.layout.ConversionPattern=%d{HH:mm:ss.SSS} %p %c: %m%n | ||
log4j.appender.CA.Threshold = WARN | ||
log4j.appender.CA.Threshold = FATAL | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oversized log for GA console output cause truncation fo useful test errors, andthe unit-tests.log is enough There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If so, Is it better to backport this change into the previous branches? cc: @HyukjinKwon @dongjoon-hyun There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, I guess so. we can mute console output for most modules. we call When we mute them, the error stacktraces for failed tests can still be kept. I can make a separate PR to fix it if it makes senses to the CCers too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But the current threshold (WARN) can help catch a bug like the following early: #31273 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
These warning messages still can be found in the But when we encounter test failures but got omitted by the CI, it is hard for us to locate to them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's okay as long as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, I'll send a PR then |
||
log4j.appender.CA.follow = true | ||
|
||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--SET spark.sql.legacy.keepCommandOutputSchema=true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might be useful to verify the legacy schema There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it relevant to this PR's There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the code change is related, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
--IMPORT show-tables.sql |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, this seems inconsistent with the doc. The current document means
spark.sql.legacy.keepCommandOutputSchema
means the 3.1 or earlier schema, doesn't it?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Introducing a new
legacy
conf for this behavior change seems kind of trivial and might bring cognition burdens for users. So the config is reused for now and the doc will be updated if it is the right way to goThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not reused technically. If we reuse the existing conf, this should be
output.length == 4
because it disable this PR and the previous commit simultaneously.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, this is true.
output.head.withName("database") +: output.slice(1, 4)
will cut theisView
off