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 @@ -1207,6 +1207,8 @@ class Analyzer(
val relation = table match {
case u: UnresolvedRelation if !u.isStreaming =>
resolveRelation(u).getOrElse(u)
case r: V2TableReference =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this ever be DataSourceV2Relation itself? I am asking primarily as there is resolveAsV2Relation that handles both below.

Copy link
Member Author

Choose a reason for hiding this comment

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

We already have ResolveInsertInto to handle it.

relationResolution.resolveReference(r)
case other => other
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3986,6 +3986,19 @@ class DataSourceV2SQLSuiteV1Filter
}
}

test("SPARK-54491: insert into temp view on DSv2 table") {
val t = s"testcat.default.t"
val v = "v"
withTable(t) {
withTempView(v) {
sql(s"CREATE TABLE $t (id INT) USING foo")
spark.table(t).createOrReplaceTempView(v)
sql(s"INSERT INTO v VALUES (1)")
checkAnswer(sql(s"SELECT * FROM $t"), Seq(Row(1)))
}
}
}

private def testNotSupportedV2Command(
sqlCommand: String,
sqlParams: String,
Expand Down