Skip to content
Closed
Show file tree
Hide file tree
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 @@ -125,7 +125,6 @@ abstract class ExternalCatalog {
table: String,
loadPath: String,
isOverwrite: Boolean,
holdDDLTime: Boolean,
isSrcLocal: Boolean): Unit

/**
Expand All @@ -140,7 +139,6 @@ abstract class ExternalCatalog {
loadPath: String,
partition: TablePartitionSpec,
isOverwrite: Boolean,
holdDDLTime: Boolean,
inheritTableSpecs: Boolean,
isSrcLocal: Boolean): Unit

Expand All @@ -150,8 +148,7 @@ abstract class ExternalCatalog {
loadPath: String,
partition: TablePartitionSpec,
replace: Boolean,
numDP: Int,
holdDDLTime: Boolean): Unit
numDP: Int): Unit

// --------------------------------------------------------------------------
// Partitions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ class InMemoryCatalog(
table: String,
loadPath: String,
isOverwrite: Boolean,
holdDDLTime: Boolean,
isSrcLocal: Boolean): Unit = {
throw new UnsupportedOperationException("loadTable is not implemented")
}
Expand All @@ -336,7 +335,6 @@ class InMemoryCatalog(
loadPath: String,
partition: TablePartitionSpec,
isOverwrite: Boolean,
holdDDLTime: Boolean,
inheritTableSpecs: Boolean,
isSrcLocal: Boolean): Unit = {
throw new UnsupportedOperationException("loadPartition is not implemented.")
Expand All @@ -348,8 +346,7 @@ class InMemoryCatalog(
loadPath: String,
partition: TablePartitionSpec,
replace: Boolean,
numDP: Int,
holdDDLTime: Boolean): Unit = {
numDP: Int): Unit = {
throw new UnsupportedOperationException("loadDynamicPartitions is not implemented.")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,12 @@ class SessionCatalog(
name: TableIdentifier,
loadPath: String,
isOverwrite: Boolean,
holdDDLTime: Boolean,
isSrcLocal: Boolean): Unit = {
val db = formatDatabaseName(name.database.getOrElse(getCurrentDatabase))
val table = formatTableName(name.table)
requireDbExists(db)
requireTableExists(TableIdentifier(table, Some(db)))
externalCatalog.loadTable(db, table, loadPath, isOverwrite, holdDDLTime, isSrcLocal)
externalCatalog.loadTable(db, table, loadPath, isOverwrite, isSrcLocal)
}

/**
Expand All @@ -341,7 +340,6 @@ class SessionCatalog(
loadPath: String,
spec: TablePartitionSpec,
isOverwrite: Boolean,
holdDDLTime: Boolean,
inheritTableSpecs: Boolean,
isSrcLocal: Boolean): Unit = {
val db = formatDatabaseName(name.database.getOrElse(getCurrentDatabase))
Expand All @@ -350,7 +348,7 @@ class SessionCatalog(
requireTableExists(TableIdentifier(table, Some(db)))
requireNonEmptyValueInPartitionSpec(Seq(spec))
externalCatalog.loadPartition(
db, table, loadPath, spec, isOverwrite, holdDDLTime, inheritTableSpecs, isSrcLocal)
db, table, loadPath, spec, isOverwrite, inheritTableSpecs, isSrcLocal)
}

def defaultTablePath(tableIdent: TableIdentifier): String = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,15 +312,13 @@ case class LoadDataCommand(
loadPath.toString,
partition.get,
isOverwrite,
holdDDLTime = false,
inheritTableSpecs = true,
isSrcLocal = isLocal)
} else {
catalog.loadTable(
targetTable.identifier,
loadPath.toString,
isOverwrite,
holdDDLTime = false,
isSrcLocal = isLocal)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -736,14 +736,12 @@ private[spark] class HiveExternalCatalog(conf: SparkConf, hadoopConf: Configurat
table: String,
loadPath: String,
isOverwrite: Boolean,
holdDDLTime: Boolean,
isSrcLocal: Boolean): Unit = withClient {
requireTableExists(db, table)
client.loadTable(
loadPath,
s"$db.$table",
isOverwrite,
holdDDLTime,
isSrcLocal)
}

Expand All @@ -753,7 +751,6 @@ private[spark] class HiveExternalCatalog(conf: SparkConf, hadoopConf: Configurat
loadPath: String,
partition: TablePartitionSpec,
isOverwrite: Boolean,
holdDDLTime: Boolean,
inheritTableSpecs: Boolean,
isSrcLocal: Boolean): Unit = withClient {
requireTableExists(db, table)
Expand All @@ -773,7 +770,6 @@ private[spark] class HiveExternalCatalog(conf: SparkConf, hadoopConf: Configurat
table,
orderedPartitionSpec,
isOverwrite,
holdDDLTime,
inheritTableSpecs,
isSrcLocal)
}
Expand All @@ -784,8 +780,7 @@ private[spark] class HiveExternalCatalog(conf: SparkConf, hadoopConf: Configurat
loadPath: String,
partition: TablePartitionSpec,
replace: Boolean,
numDP: Int,
holdDDLTime: Boolean): Unit = withClient {
numDP: Int): Unit = withClient {
requireTableExists(db, table)

val orderedPartitionSpec = new util.LinkedHashMap[String, String]()
Expand All @@ -803,8 +798,7 @@ private[spark] class HiveExternalCatalog(conf: SparkConf, hadoopConf: Configurat
table,
orderedPartitionSpec,
replace,
numDP,
holdDDLTime)
numDP)
}

// --------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ private[hive] trait HiveClient {
tableName: String,
partSpec: java.util.LinkedHashMap[String, String], // Hive relies on LinkedHashMap ordering
replace: Boolean,
holdDDLTime: Boolean,
inheritTableSpecs: Boolean,
isSrcLocal: Boolean): Unit

Expand All @@ -217,7 +216,6 @@ private[hive] trait HiveClient {
loadPath: String, // TODO URI
tableName: String,
replace: Boolean,
holdDDLTime: Boolean,
isSrcLocal: Boolean): Unit

/** Loads new dynamic partitions into an existing table. */
Expand All @@ -227,8 +225,7 @@ private[hive] trait HiveClient {
tableName: String,
partSpec: java.util.LinkedHashMap[String, String], // Hive relies on LinkedHashMap ordering
replace: Boolean,
numDP: Int,
holdDDLTime: Boolean): Unit
numDP: Int): Unit

/** Create a function in an existing database. */
def createFunction(db: String, func: CatalogFunction): Unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,6 @@ private[hive] class HiveClientImpl(
tableName: String,
partSpec: java.util.LinkedHashMap[String, String],
replace: Boolean,
holdDDLTime: Boolean,
inheritTableSpecs: Boolean,
isSrcLocal: Boolean): Unit = withHiveState {
val hiveTable = client.getTable(dbName, tableName, true /* throw exception */)
Expand All @@ -678,7 +677,6 @@ private[hive] class HiveClientImpl(
s"$dbName.$tableName",
partSpec,
replace,
holdDDLTime,
inheritTableSpecs,
isSkewedStoreAsSubdir = hiveTable.isStoredAsSubDirectories,
isSrcLocal = isSrcLocal)
Expand All @@ -688,14 +686,12 @@ private[hive] class HiveClientImpl(
loadPath: String, // TODO URI
tableName: String,
replace: Boolean,
holdDDLTime: Boolean,
isSrcLocal: Boolean): Unit = withHiveState {
shim.loadTable(
client,
new Path(loadPath),
tableName,
replace,
holdDDLTime,
isSrcLocal)
}

Expand All @@ -705,8 +701,7 @@ private[hive] class HiveClientImpl(
tableName: String,
partSpec: java.util.LinkedHashMap[String, String],
replace: Boolean,
numDP: Int,
holdDDLTime: Boolean): Unit = withHiveState {
numDP: Int): Unit = withHiveState {
val hiveTable = client.getTable(dbName, tableName, true /* throw exception */)
shim.loadDynamicPartitions(
client,
Expand All @@ -715,7 +710,6 @@ private[hive] class HiveClientImpl(
partSpec,
replace,
numDP,
holdDDLTime,
listBucketingEnabled = hiveTable.isStoredAsSubDirectories)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ private[client] sealed abstract class Shim {
tableName: String,
partSpec: JMap[String, String],
replace: Boolean,
holdDDLTime: Boolean,
inheritTableSpecs: Boolean,
isSkewedStoreAsSubdir: Boolean,
isSrcLocal: Boolean): Unit
Expand All @@ -106,7 +105,6 @@ private[client] sealed abstract class Shim {
loadPath: Path,
tableName: String,
replace: Boolean,
holdDDLTime: Boolean,
isSrcLocal: Boolean): Unit

def loadDynamicPartitions(
Expand All @@ -116,7 +114,6 @@ private[client] sealed abstract class Shim {
partSpec: JMap[String, String],
replace: Boolean,
numDP: Int,
holdDDLTime: Boolean,
listBucketingEnabled: Boolean): Unit

def createFunction(hive: Hive, db: String, func: CatalogFunction): Unit
Expand Down Expand Up @@ -332,22 +329,20 @@ private[client] class Shim_v0_12 extends Shim with Logging {
tableName: String,
partSpec: JMap[String, String],
replace: Boolean,
holdDDLTime: Boolean,
inheritTableSpecs: Boolean,
isSkewedStoreAsSubdir: Boolean,
isSrcLocal: Boolean): Unit = {
loadPartitionMethod.invoke(hive, loadPath, tableName, partSpec, replace: JBoolean,
holdDDLTime: JBoolean, inheritTableSpecs: JBoolean, isSkewedStoreAsSubdir: JBoolean)
JBoolean.FALSE, inheritTableSpecs: JBoolean, isSkewedStoreAsSubdir: JBoolean)
}

override def loadTable(
hive: Hive,
loadPath: Path,
tableName: String,
replace: Boolean,
holdDDLTime: Boolean,
isSrcLocal: Boolean): Unit = {
loadTableMethod.invoke(hive, loadPath, tableName, replace: JBoolean, holdDDLTime: JBoolean)
loadTableMethod.invoke(hive, loadPath, tableName, replace: JBoolean, JBoolean.FALSE)
}

override def loadDynamicPartitions(
Expand All @@ -357,10 +352,9 @@ private[client] class Shim_v0_12 extends Shim with Logging {
partSpec: JMap[String, String],
replace: Boolean,
numDP: Int,
holdDDLTime: Boolean,
listBucketingEnabled: Boolean): Unit = {
loadDynamicPartitionsMethod.invoke(hive, loadPath, tableName, partSpec, replace: JBoolean,
numDP: JInteger, holdDDLTime: JBoolean, listBucketingEnabled: JBoolean)
numDP: JInteger, JBoolean.FALSE, listBucketingEnabled: JBoolean)
}

override def dropIndex(hive: Hive, dbName: String, tableName: String, indexName: String): Unit = {
Expand Down Expand Up @@ -703,12 +697,11 @@ private[client] class Shim_v0_14 extends Shim_v0_13 {
tableName: String,
partSpec: JMap[String, String],
replace: Boolean,
holdDDLTime: Boolean,
inheritTableSpecs: Boolean,
isSkewedStoreAsSubdir: Boolean,
isSrcLocal: Boolean): Unit = {
loadPartitionMethod.invoke(hive, loadPath, tableName, partSpec, replace: JBoolean,
holdDDLTime: JBoolean, inheritTableSpecs: JBoolean, isSkewedStoreAsSubdir: JBoolean,
JBoolean.FALSE, inheritTableSpecs: JBoolean, isSkewedStoreAsSubdir: JBoolean,
isSrcLocal: JBoolean, JBoolean.FALSE)
}

Expand All @@ -717,9 +710,8 @@ private[client] class Shim_v0_14 extends Shim_v0_13 {
loadPath: Path,
tableName: String,
replace: Boolean,
holdDDLTime: Boolean,
isSrcLocal: Boolean): Unit = {
loadTableMethod.invoke(hive, loadPath, tableName, replace: JBoolean, holdDDLTime: JBoolean,
loadTableMethod.invoke(hive, loadPath, tableName, replace: JBoolean, JBoolean.FALSE,
isSrcLocal: JBoolean, JBoolean.FALSE, JBoolean.FALSE)
}

Expand All @@ -730,10 +722,9 @@ private[client] class Shim_v0_14 extends Shim_v0_13 {
partSpec: JMap[String, String],
replace: Boolean,
numDP: Int,
holdDDLTime: Boolean,
listBucketingEnabled: Boolean): Unit = {
loadDynamicPartitionsMethod.invoke(hive, loadPath, tableName, partSpec, replace: JBoolean,
numDP: JInteger, holdDDLTime: JBoolean, listBucketingEnabled: JBoolean, JBoolean.FALSE)
numDP: JInteger, JBoolean.FALSE, listBucketingEnabled: JBoolean, JBoolean.FALSE)
}

override def dropTable(
Expand Down Expand Up @@ -818,10 +809,9 @@ private[client] class Shim_v1_2 extends Shim_v1_1 {
partSpec: JMap[String, String],
replace: Boolean,
numDP: Int,
holdDDLTime: Boolean,
listBucketingEnabled: Boolean): Unit = {
loadDynamicPartitionsMethod.invoke(hive, loadPath, tableName, partSpec, replace: JBoolean,
numDP: JInteger, holdDDLTime: JBoolean, listBucketingEnabled: JBoolean, JBoolean.FALSE,
numDP: JInteger, JBoolean.FALSE, listBucketingEnabled: JBoolean, JBoolean.FALSE,
0L: JLong)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,6 @@ case class InsertIntoHiveTable(
refreshFunction = _ => (),
options = Map.empty)

// TODO: Correctly set holdDDLTime.
// In most of the time, we should have holdDDLTime = false.
// holdDDLTime will be true when TOK_HOLD_DDLTIME presents in the query as a hint.
val holdDDLTime = false
if (partition.nonEmpty) {
if (numDynamicPartitions > 0) {
externalCatalog.loadDynamicPartitions(
Expand All @@ -313,8 +309,7 @@ case class InsertIntoHiveTable(
tmpLocation.toString,
partitionSpec,
overwrite,
numDynamicPartitions,
holdDDLTime = holdDDLTime)
numDynamicPartitions)
} else {
// scalastyle:off
// ifNotExists is only valid with static partition, refer to
Expand Down Expand Up @@ -357,7 +352,6 @@ case class InsertIntoHiveTable(
tmpLocation.toString,
partitionSpec,
isOverwrite = doHiveOverwrite,
holdDDLTime = holdDDLTime,
inheritTableSpecs = inheritTableSpecs,
isSrcLocal = false)
}
Expand All @@ -368,7 +362,6 @@ case class InsertIntoHiveTable(
table.catalogTable.identifier.table,
tmpLocation.toString, // TODO: URI
overwrite,
holdDDLTime,
isSrcLocal = false)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ class VersionsSuite extends QueryTest with SQLTestUtils with TestHiveSingleton w
emptyDir,
tableName = "src",
replace = false,
holdDDLTime = false,
isSrcLocal = false)
}

Expand Down Expand Up @@ -313,7 +312,6 @@ class VersionsSuite extends QueryTest with SQLTestUtils with TestHiveSingleton w
"src_part",
partSpec,
replace = false,
holdDDLTime = false,
inheritTableSpecs = false,
isSrcLocal = false)
}
Expand All @@ -329,8 +327,7 @@ class VersionsSuite extends QueryTest with SQLTestUtils with TestHiveSingleton w
"src_part",
partSpec,
replace = false,
numDP = 1,
holdDDLTime = false)
numDP = 1)
}

test(s"$version: renamePartitions") {
Expand Down