Skip to content

Commit

Permalink
Pass the SparkSession when resolving the tables in the DeltaTableBuilder
Browse files Browse the repository at this point in the history
Signed-off-by: Helge Bruegner <helge@bruegner.de>

## Description

- Forward the SparkSession when resolving the tables in the DeltaTableBuilder
- Remove some unused imports

Resolves #1475

/

## Does this PR introduce _any_ user-facing changes?

No.

Closes #1476

Signed-off-by: Shixiong Zhu <zsxwing@gmail.com>
GitOrigin-RevId: 880de0f55ee79289cecd19d74c4c177c76d30aeb
  • Loading branch information
moredatapls authored and allisonport-db committed Nov 28, 2022
1 parent 5e9a417 commit 68c8e18
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions core/src/main/scala/io/delta/tables/DeltaTableBuilder.scala
Expand Up @@ -25,12 +25,10 @@ import io.delta.tables.execution._
import org.apache.spark.annotation._
import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.catalyst.TableIdentifier
import org.apache.spark.sql.catalyst.expressions.Attribute
import org.apache.spark.sql.catalyst.plans.logical.{CreateTable, LeafNode, LogicalPlan, ReplaceTable}
import org.apache.spark.sql.catalyst.plans.logical.{CreateTable, LogicalPlan, ReplaceTable}
import org.apache.spark.sql.catalyst.util.CaseInsensitiveMap
import org.apache.spark.sql.connector.expressions.Transform
import org.apache.spark.sql.execution.SQLExecution
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.types.{DataType, StructField, StructType}

/**
Expand Down Expand Up @@ -365,9 +363,9 @@ class DeltaTableBuilder private[tables](

// Return DeltaTable Object.
if (DeltaTableUtils.isValidPath(tableId)) {
DeltaTable.forPath(location.get)
DeltaTable.forPath(spark, location.get)
} else {
DeltaTable.forName(this.identifier)
DeltaTable.forName(spark, this.identifier)
}
}
}

0 comments on commit 68c8e18

Please sign in to comment.