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 @@ -179,13 +179,12 @@ object DatasetManager extends Logging {
}

// Wipe the data if we need to
val dropTable = (isFullRefresh || !table.isStreamingTable) && existingTableOpt.isDefined
if (dropTable) {
catalog.dropTable(identifier)
if ((isFullRefresh || !table.isStreamingTable) && existingTableOpt.isDefined) {
context.spark.sql(s"TRUNCATE TABLE ${table.identifier.quotedString}")
}

// Alter the table if we need to
if (existingTableOpt.isDefined && !dropTable) {
if (existingTableOpt.isDefined) {
val existingSchema = v2ColumnsToStructType(existingTableOpt.get.columns())

val targetSchema = if (table.isStreamingTable && !isFullRefresh) {
Expand All @@ -200,7 +199,7 @@ object DatasetManager extends Logging {
}

// Create the table if we need to
if (dropTable || existingTableOpt.isEmpty) {
if (existingTableOpt.isEmpty) {
catalog.createTable(
identifier,
new TableInfo.Builder()
Expand Down