Yikf commented on code in PR #38007: URL: https://github.com/apache/spark/pull/38007#discussion_r980876832
########## sql/hive/src/test/resources/ql/src/test/queries/clientpositive/index_bitmap2.q: ########## @@ -4,7 +4,10 @@ CREATE INDEX src1_index ON TABLE src(key) as 'BITMAP' WITH DEFERRED REBUILD; EXPLAIN CREATE INDEX src2_index ON TABLE src(value) as 'BITMAP' WITH DEFERRED REBUILD; -CREATE INDEX src1_index ON TABLE src(key) as 'BITMAP' WITH DEFERRED REBUILD; +CREATE INDEX src1_index ON T + + +ABLE src(key) as 'BITMAP' WITH DEFERRED REBUILD; Review Comment: nit, undo irrelevant changes please. ########## sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowIndexExec.scala: ########## @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.spark.sql.execution.datasources.v2 + +import scala.collection.mutable.ArrayBuffer + +import org.apache.spark.sql.catalyst.InternalRow +import org.apache.spark.sql.catalyst.expressions.Attribute +import org.apache.spark.sql.connector.catalog.index.SupportsIndex +import org.apache.spark.sql.execution.LeafExecNode + +/** + * Physical plan node for show indexes. + */ +case class ShowIndexExec(output: Seq[Attribute], + table: SupportsIndex) extends V2CommandExec with LeafExecNode { + + override protected def run(): Seq[InternalRow] = { + val rows = new ArrayBuffer[InternalRow]() + table.listIndexes().foreach(tableIndex => + rows += toCatalystRow(tableIndex.indexName(), tableIndex.indexType())) Review Comment: It looks like that `output` is only index, but row has two columns ########## sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowIndexExec.scala: ########## @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.spark.sql.execution.datasources.v2 + +import scala.collection.mutable.ArrayBuffer + +import org.apache.spark.sql.catalyst.InternalRow +import org.apache.spark.sql.catalyst.expressions.Attribute +import org.apache.spark.sql.connector.catalog.index.SupportsIndex +import org.apache.spark.sql.execution.LeafExecNode + +/** + * Physical plan node for show indexes. + */ +case class ShowIndexExec(output: Seq[Attribute], + table: SupportsIndex) extends V2CommandExec with LeafExecNode { Review Comment: nit: indentation ########## sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowIndexExec.scala: ########## @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.spark.sql.execution.datasources.v2 + +import scala.collection.mutable.ArrayBuffer + +import org.apache.spark.sql.catalyst.InternalRow +import org.apache.spark.sql.catalyst.expressions.Attribute +import org.apache.spark.sql.connector.catalog.index.SupportsIndex +import org.apache.spark.sql.execution.LeafExecNode + +/** + * Physical plan node for show indexes. + */ +case class ShowIndexExec(output: Seq[Attribute], Review Comment: Do we plan to implememt `EXTENDED` and `WHERE` syntax? ########## sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseParser.g4: ########## @@ -216,6 +216,7 @@ statement LEFT_PAREN columns=multipartIdentifierPropertyList RIGHT_PAREN (OPTIONS options=propertyList)? #createIndex | DROP INDEX (IF EXISTS)? identifier ON TABLE? multipartIdentifier #dropIndex + | SHOW INDEX ON TABLE? multipartIdentifier #showIndex Review Comment: FORM or ON? https://dev.mysql.com/doc/refman/8.0/en/show-index.html -- 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]
