turboFei commented on code in PR #7029: URL: https://github.com/apache/kyuubi/pull/7029#discussion_r2062480914
########## kyuubi-server/src/main/scala/org/apache/kyuubi/server/metadata/jdbc/JdbcDatabaseDialect.scala: ########## @@ -19,14 +19,71 @@ package org.apache.kyuubi.server.metadata.jdbc trait JdbcDatabaseDialect { def limitClause(limit: Int, offset: Int): String + def insertOrReplace( + table: String, + cols: Seq[String], + keyCol: String, + keyVal: String): String } class GenericDatabaseDialect extends JdbcDatabaseDialect { override def limitClause(limit: Int, offset: Int): String = { s"LIMIT $limit OFFSET $offset" } + + override def insertOrReplace( + table: String, + cols: Seq[String], + keyCol: String, + keyVal: String): String = { + s""" + |INSERT INTO $table (${cols.mkString(",")}) + |SELECT ${cols.map(_ => "?").mkString(",")} + |WHERE NOT EXISTS ( + | SELECT 1 FROM $table WHERE $keyCol = '$keyVal') + |) + |""".stripMargin Review Comment: cc @pan3793 how about now? I have to inject the keyVal here. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@kyuubi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@kyuubi.apache.org For additional commands, e-mail: notifications-h...@kyuubi.apache.org