Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -759,15 +759,17 @@ private[hive] class HiveClientImpl(
dbName: String,
pattern: String,
tableType: CatalogTableType): Seq[String] = withHiveState {
val hiveTableType = toHiveTableType(tableType)
try {
// Try with Hive API getTablesByType first, it's supported from Hive 2.3+.
shim.getTablesByType(client, dbName, pattern, toHiveTableType(tableType))
shim.getTablesByType(client, dbName, pattern, hiveTableType)
} catch {
case _: UnsupportedOperationException =>
// Fallback to filter logic if getTablesByType not supported.
val tableNames = client.getTablesByPattern(dbName, pattern).asScala
val tables = getTablesByName(dbName, tableNames).filter(_.tableType == tableType)
Copy link
Member Author

@MaxGekk MaxGekk Aug 6, 2020

Choose a reason for hiding this comment

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

Master's patch conflicts with branch-3.0 because of different base line:

  • master: tableNames.toSeq
  • branch-3.0: tableNames

Not on purpose but I removed @srowen 's changes c28a6fa#diff-6fd847124f8eae45ba2de1cf7d6296feR769 . I have realised that when I tried to cherry-pick the changes to branch-3.0. I will prepare a follow up PR for master.

Copy link
Member Author

Choose a reason for hiding this comment

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

Here is the fix for master #29379

Copy link
Member

Choose a reason for hiding this comment

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

It's fine if we 'break' Scala 2.13 a bit in master while we're still getting it working, if it makes it easier to not reason about it. If you carry back to .toSeq / .toMap-style changes into 3.0 it's fine though, still works

tables.map(_.identifier.table)
getRawTablesByName(dbName, tableNames)
.filter(_.getTableType == hiveTableType)
.map(_.getTableName)
}
}

Expand Down