CarbonDataQA1 commented on pull request #3938: URL: https://github.com/apache/carbondata/pull/3938#issuecomment-696754597 Build Failed with Spark 2.4.5, Please check CI http://121.244.95.60:12545/job/ApacheCarbon_PR_Builder_2.4.5/2434/ ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [hidden email] |
In reply to this post by GitBox
CarbonDataQA1 commented on pull request #3938: URL: https://github.com/apache/carbondata/pull/3938#issuecomment-696805184 Build Success with Spark 2.3.4, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/4177/ ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [hidden email] |
In reply to this post by GitBox
VenuReddy2103 commented on pull request #3938: URL: https://github.com/apache/carbondata/pull/3938#issuecomment-696851559 retest this please ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [hidden email] |
In reply to this post by GitBox
CarbonDataQA1 commented on pull request #3938: URL: https://github.com/apache/carbondata/pull/3938#issuecomment-696917979 Build Success with Spark 2.3.4, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/4186/ ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [hidden email] |
In reply to this post by GitBox
CarbonDataQA1 commented on pull request #3938: URL: https://github.com/apache/carbondata/pull/3938#issuecomment-696918364 Build Success with Spark 2.4.5, Please check CI http://121.244.95.60:12545/job/ApacheCarbon_PR_Builder_2.4.5/2443/ ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [hidden email] |
In reply to this post by GitBox
CarbonDataQA1 commented on pull request #3938: URL: https://github.com/apache/carbondata/pull/3938#issuecomment-696663738 ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [hidden email] |
In reply to this post by GitBox
VenuReddy2103 commented on pull request #3938: URL: https://github.com/apache/carbondata/pull/3938#issuecomment-696678341 ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [hidden email] |
In reply to this post by GitBox
VenuReddy2103 commented on a change in pull request #3938: URL: https://github.com/apache/carbondata/pull/3938#discussion_r492609629 ########## File path: integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/ShowTable/TestShowTable.scala ########## @@ -0,0 +1,94 @@ +/* + * 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.carbondata.spark.testsuite.ShowTable + +import org.apache.spark.sql.Row +import org.apache.spark.sql.test.util.QueryTest +import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach} + +import org.apache.carbondata.common.exceptions.sql.MalformedIndexCommandException + +/** + * Test class for show tables. + */ +class TestShowTable extends QueryTest with BeforeAndAfterAll with BeforeAndAfterEach { + val dbName = "testshowtable" + override def beforeAll: Unit = { + sql(s"drop database if exists $dbName cascade") + sql(s"create database $dbName") + sql(s"use $dbName") + } + + test("test show tables") { + sql("create table employee(id string, name string) stored as carbondata") + sql("create table employee_part(name string) partitioned by (grade int)") + sql("create index employee_si on table employee(name) as 'carbondata'") + sql("create materialized view employee_mv as select name from employee group by name") + val df = sql("show tables").toDF + val rows = df.collect() + val schema = rows(0).schema + assert(schema.length == 3) + assert(schema(0).name.equals("database")) + assert(schema(1).name.equals("tableName")) + assert(schema(2).name.equals("isTemporary")) + // show tables query can return views as well. Just validate if expected rows are present + // and unexpected rows are not present. + val expectedRows = Seq(Row(dbName, "employee", false), + Row(dbName, "employee_part", false), + Row(dbName, "employee_si", false)) + val expectedRowsDF = sqlContext.sparkSession + .createDataFrame(sqlContext.sparkContext.makeRDD[Row](expectedRows), schema) + checkAnswer(df.intersect(expectedRowsDF), expectedRows) + // check if mv table is not present + val notExpectedRows = Seq(Row(dbName, "employee_mv", false)) + val notExpectedRowsDF = sqlContext.sparkSession + .createDataFrame(sqlContext.sparkContext.makeRDD[Row](notExpectedRows), schema) + assert(df.intersect(notExpectedRowsDF).count() == 0) + } + + test("test show table extended like") { + sql("create table employee(id string, name string) stored as carbondata") Review comment: employee_part table is non carbon table ########## File path: integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/ShowTable/TestShowTable.scala ########## @@ -0,0 +1,94 @@ +/* + * 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.carbondata.spark.testsuite.ShowTable + +import org.apache.spark.sql.Row +import org.apache.spark.sql.test.util.QueryTest +import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach} + +import org.apache.carbondata.common.exceptions.sql.MalformedIndexCommandException + +/** + * Test class for show tables. + */ +class TestShowTable extends QueryTest with BeforeAndAfterAll with BeforeAndAfterEach { + val dbName = "testshowtable" + override def beforeAll: Unit = { + sql(s"drop database if exists $dbName cascade") + sql(s"create database $dbName") + sql(s"use $dbName") + } + + test("test show tables") { + sql("create table employee(id string, name string) stored as carbondata") + sql("create table employee_part(name string) partitioned by (grade int)") + sql("create index employee_si on table employee(name) as 'carbondata'") + sql("create materialized view employee_mv as select name from employee group by name") + val df = sql("show tables").toDF Review comment: Had done that because show tables returns views as well. Have refactored it now such that we intersection of received rows and expected rows to check. ########## File path: integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/ShowTable/TestShowTable.scala ########## @@ -0,0 +1,94 @@ +/* + * 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.carbondata.spark.testsuite.ShowTable + +import org.apache.spark.sql.Row +import org.apache.spark.sql.test.util.QueryTest +import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach} + +import org.apache.carbondata.common.exceptions.sql.MalformedIndexCommandException + +/** + * Test class for show tables. + */ +class TestShowTable extends QueryTest with BeforeAndAfterAll with BeforeAndAfterEach { + val dbName = "testshowtable" + override def beforeAll: Unit = { + sql(s"drop database if exists $dbName cascade") + sql(s"create database $dbName") + sql(s"use $dbName") + } + + test("test show tables") { + sql("create table employee(id string, name string) stored as carbondata") + sql("create table employee_part(name string) partitioned by (grade int)") + sql("create index employee_si on table employee(name) as 'carbondata'") + sql("create materialized view employee_mv as select name from employee group by name") + val df = sql("show tables").toDF + val rows = df.collect() + val schema = rows(0).schema + assert(schema.length == 3) + assert(schema(0).name.equals("database")) + assert(schema(1).name.equals("tableName")) + assert(schema(2).name.equals("isTemporary")) + // show tables query can return views as well. Just validate if expected rows are present + // and unexpected rows are not present. + val expectedRows = Seq(Row(dbName, "employee", false), + Row(dbName, "employee_part", false), + Row(dbName, "employee_si", false)) + val expectedRowsDF = sqlContext.sparkSession Review comment: have refactored it now. ########## File path: integration/spark/src/main/scala/org/apache/spark/sql/execution/strategy/DDLHelper.scala ########## @@ -398,9 +398,7 @@ object DDLHelper { } def showTables(showTablesCommand: ShowTablesCommand): Seq[SparkPlan] = { Review comment: Not required. Have removed it ########## File path: integration/spark/src/main/scala/org/apache/spark/sql/execution/command/table/CarbonShowTablesCommand.scala ########## @@ -18,35 +18,23 @@ package org.apache.spark.sql.execution.command.table import org.apache.spark.sql.{Row, SparkSession} -import org.apache.spark.sql.catalyst.TableIdentifier -import org.apache.spark.sql.catalyst.expressions.{Attribute, AttributeReference} -import org.apache.spark.sql.execution.command.MetadataCommand -import org.apache.spark.sql.types.{BooleanType, StringType} +import org.apache.spark.sql.catalyst.expressions.Attribute +import org.apache.spark.sql.execution.command.{MetadataCommand, ShowTablesCommand} -private[sql] case class CarbonShowTablesCommand ( databaseName: Option[String], - tableIdentifierPattern: Option[String]) extends MetadataCommand{ +private[sql] case class CarbonShowTablesCommand(showTablesCommand: ShowTablesCommand) + extends MetadataCommand { - // The result of SHOW TABLES has three columns: database, tableName and isTemporary. - override val output: Seq[Attribute] = { - AttributeReference("database", StringType, nullable = false)() :: - AttributeReference("tableName", StringType, nullable = false)() :: - AttributeReference("isTemporary", BooleanType, nullable = false)() :: Nil - } + override val output: Seq[Attribute] = showTablesCommand.output override def processMetadata(sparkSession: SparkSession): Seq[Row] = { - // Since we need to return a Seq of rows, we will call getTables directly - // instead of calling tables in sparkSession. - val catalog = sparkSession.sessionState.catalog - val db = databaseName.getOrElse(catalog.getCurrentDatabase) - val tables = - tableIdentifierPattern.map(catalog.listTables(db, _)).getOrElse(catalog.listTables(db)) + val rows = showTablesCommand.run(sparkSession) val externalCatalog = sparkSession.sharedState.externalCatalog // this method checks whether the table is mainTable or MV based on property "isVisible" - def isMainTable(tableIdent: TableIdentifier) = { + def isMainTable(db: String, table: String) = { Review comment: I think, current one looks ok. Because, Filtered rows are implicitly returned at line 46. If we move this isMainTable() method def to after line 46, need to take filtered rows to temp and use it retured. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [hidden email] |
In reply to this post by GitBox
akashrn5 commented on pull request #3938: URL: https://github.com/apache/carbondata/pull/3938#issuecomment-697132560 LGTM ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [hidden email] |
In reply to this post by GitBox
asfgit closed pull request #3938: URL: https://github.com/apache/carbondata/pull/3938 ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [hidden email] |
Free forum by Nabble | Edit this page |