huaxingao commented on code in PR #37112:
URL: https://github.com/apache/spark/pull/37112#discussion_r917314242
##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/H2Dialect.scala:
##########
@@ -74,6 +77,40 @@ private[sql] object H2Dialect extends JdbcDialect {
functionMap.clear()
}
+ override def createIndex(
+ indexName: String,
+ tableIdent: Identifier,
+ columns: Array[NamedReference],
+ columnsProperties: util.Map[NamedReference, util.Map[String, String]],
+ properties: util.Map[String, String]): String = {
+ val columnList = columns.map(col => col.fieldNames.head)
+ val (indexType, _) = JdbcUtils.processIndexProperties(properties, "h2")
+ s"CREATE INDEX ${indexNameWithSchema(tableIdent, indexName)} $indexType ON
" +
Review Comment:
Is the schema required here for index name? If not putting schema, does it
default to the same schema as the table schema?
##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/H2Dialect.scala:
##########
@@ -74,6 +77,40 @@ private[sql] object H2Dialect extends JdbcDialect {
functionMap.clear()
}
+ override def createIndex(
+ indexName: String,
+ tableIdent: Identifier,
+ columns: Array[NamedReference],
+ columnsProperties: util.Map[NamedReference, util.Map[String, String]],
+ properties: util.Map[String, String]): String = {
+ val columnList = columns.map(col => col.fieldNames.head)
+ val (indexType, _) = JdbcUtils.processIndexProperties(properties, "h2")
+ s"CREATE INDEX ${indexNameWithSchema(tableIdent, indexName)} $indexType ON
" +
+ s"${tableNameWithSchema(tableIdent)} (${columnList.mkString(", ")})"
+ }
+
+ override def dropIndex(indexName: String, tableIdent: Identifier): String = {
+ s"DROP INDEX ${indexNameWithSchema(tableIdent, indexName)}"
+ }
+
Review Comment:
Could you include the link for H2 SELECT INDEXES 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]