Skip to content

Commit

Permalink
[Spark 4.0] Account for CommandUtils.uncacheTableOrView signature c…
Browse files Browse the repository at this point in the history
…hange. (#10863)

* Account for `CommandUtils.uncacheTableOrView` signature change.

Fixes #10710.

This commit accounts for the changes in the signature of `CommandUtils.uncacheTableOrView`
in Apache Spark 4.0. (See [SPARK-47191](apache/spark#45289).)

Signed-off-by: MithunR <[email protected]>

* Removed unnecessary base class.

---------

Signed-off-by: MithunR <[email protected]>
  • Loading branch information
mythrocks authored May 30, 2024
1 parent a7cdaa9 commit 499a45b
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright (c) 2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*** spark-rapids-shim-json-lines
{"spark": "311"}
{"spark": "312"}
{"spark": "313"}
{"spark": "320"}
{"spark": "321"}
{"spark": "321cdh"}
{"spark": "322"}
{"spark": "323"}
{"spark": "324"}
{"spark": "330"}
{"spark": "330cdh"}
{"spark": "330db"}
{"spark": "331"}
{"spark": "332"}
{"spark": "332cdh"}
{"spark": "332db"}
{"spark": "333"}
{"spark": "334"}
{"spark": "340"}
{"spark": "341"}
{"spark": "341db"}
{"spark": "342"}
{"spark": "343"}
{"spark": "350"}
{"spark": "351"}
spark-rapids-shim-json-lines ***/
package org.apache.spark.sql.hive.rapids.shims

import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.catalyst.TableIdentifier
import org.apache.spark.sql.execution.command.CommandUtils

object CommandUtilsShim {

// Shim for CommandUtils.uncacheTableOrView, whose signature changed in Apache Spark 4.0.
def uncacheTableOrView(sparkSession: SparkSession, tableId: TableIdentifier): Unit = {
CommandUtils.uncacheTableOrView(sparkSession, tableId.quotedString)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ case class GpuInsertIntoHiveTable(
}

// un-cache this table.
CommandUtils.uncacheTableOrView(sparkSession, table.identifier.quotedString)
CommandUtilsShim.uncacheTableOrView(sparkSession, table.identifier)
sparkSession.sessionState.catalog.refreshTable(table.identifier)

CommandUtils.updateTableStats(sparkSession, table)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ case class GpuInsertIntoHiveTable(
}

// un-cache this table.
CommandUtils.uncacheTableOrView(sparkSession, table.identifier.quotedString)
CommandUtilsShim.uncacheTableOrView(sparkSession, table.identifier)
sparkSession.sessionState.catalog.refreshTable(table.identifier)

CommandUtils.updateTableStats(sparkSession, table)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/*** spark-rapids-shim-json-lines
{"spark": "400"}
spark-rapids-shim-json-lines ***/
package org.apache.spark.sql.hive.rapids.shims

import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.catalyst.TableIdentifier
import org.apache.spark.sql.execution.command.CommandUtils

object CommandUtilsShim {

// Shim for CommandUtils.uncacheTableOrView, whose signature changed in Apache Spark 4.0.
def uncacheTableOrView(sparkSession: SparkSession, tableId: TableIdentifier): Unit = {
CommandUtils.uncacheTableOrView(sparkSession, tableId)
}

}

0 comments on commit 499a45b

Please sign in to comment.