Skip to content

Commit

Permalink
only support default insert mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Matagits committed Apr 11, 2024
1 parent 4a39403 commit 6216081
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ object InsertPlan {
val stmt = node.GetInsertStmt()
require(stmt != null, "Fail to get insert statement")

val insertMode = stmt.getInsert_mode_
require("DEFAULT_MODE".equals(insertMode.toString), s"insert mode: $insertMode is unsupported in offline mode")

val dbInStmt = stmt.getDb_name_
val db = if (dbInStmt.nonEmpty) dbInStmt else ctx.getConf.defaultDb
val table = stmt.getTable_name_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,14 @@ class TestInsertPlan extends SparkTestSuite {
"options(format='csv', deep_copy=false);")
assertThrows[IllegalArgumentException](openmldbSession.sql(s"insert into $db.$table values (1, 1, 1)"))
}

test("Test random columns and empty column") {
val table = "t8"
openmldbConnector.executeDDL(db, s"create table $table(c1 string, c2 int);")
openmldbConnector.refreshCatalog()
assert(openmldbConnector.getTableInfo(db, table).getName.nonEmpty)

val sql = s"insert or ignore into $db.$table values ('a', 1)"
assertThrows[IllegalArgumentException](openmldbSession.sql(sql))
}
}

0 comments on commit 6216081

Please sign in to comment.