Repository: carbondata Updated Branches: refs/heads/master 0c94559e2 -> 12c0d8ae4
[CARBONDATA-3141] Removed Carbon Table Detail Command Test case Removed Carbon Table Detail Command Test case, as this is not used. This closes #2968 Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/12c0d8ae Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/12c0d8ae Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/12c0d8ae Branch: refs/heads/master Commit: 12c0d8ae471218c8d99252fd65d109555ae0935f Parents: 0c94559 Author: praveenmeenakshi56 <[email protected]> Authored: Fri Nov 30 18:05:08 2018 +0530 Committer: kunal642 <[email protected]> Committed: Tue Dec 11 11:28:02 2018 +0530 ---------------------------------------------------------------------- .../schema/CarbonGetTableDetailCommand.scala | 61 -------------------- .../CarbonGetTableDetailComandTestCase.scala | 56 ------------------ 2 files changed, 117 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/carbondata/blob/12c0d8ae/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/schema/CarbonGetTableDetailCommand.scala ---------------------------------------------------------------------- diff --git a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/schema/CarbonGetTableDetailCommand.scala b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/schema/CarbonGetTableDetailCommand.scala deleted file mode 100644 index 90da68a..0000000 --- a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/schema/CarbonGetTableDetailCommand.scala +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.command.schema - -import org.apache.spark.sql.{CarbonEnv, Row, SparkSession} -import org.apache.spark.sql.catalyst.expressions.{Attribute, AttributeReference} -import org.apache.spark.sql.execution.command.DataCommand -import org.apache.spark.sql.types.{LongType, StringType} - -import org.apache.carbondata.core.metadata.AbsoluteTableIdentifier -import org.apache.carbondata.core.statusmanager.SegmentStatusManager -import org.apache.carbondata.core.util.CarbonProperties - -/** - * collect dynamic detail information of the table, including table size, last modified time, etc. - */ -case class CarbonGetTableDetailCommand( - databaseName: String, - tableNames: Option[Seq[String]]) - extends DataCommand { - - override def processData(sparkSession: SparkSession): Seq[Row] = { - if (tableNames.isDefined) { - tableNames.get.map { tablename => - val carbonTable = CarbonEnv.getCarbonTable(Option(databaseName), - tablename)(sparkSession) - - Row( - tablename, - carbonTable.size, - SegmentStatusManager - .getTableStatusLastModifiedTime(carbonTable.getAbsoluteTableIdentifier)) - } - } else { - Seq.empty[Row] - } - } - - override def output: Seq[Attribute] = { - Seq(AttributeReference("table name", StringType, nullable = false)(), - AttributeReference("table size", LongType, nullable = false)(), - AttributeReference("last modified time", LongType, nullable = false)()) - } - - override protected def opName: String = "GET TABLE DETAIL" -} http://git-wip-us.apache.org/repos/asf/carbondata/blob/12c0d8ae/integration/spark2/src/test/scala/org/apache/spark/sql/CarbonGetTableDetailComandTestCase.scala ---------------------------------------------------------------------- diff --git a/integration/spark2/src/test/scala/org/apache/spark/sql/CarbonGetTableDetailComandTestCase.scala b/integration/spark2/src/test/scala/org/apache/spark/sql/CarbonGetTableDetailComandTestCase.scala deleted file mode 100644 index 51be5a8..0000000 --- a/integration/spark2/src/test/scala/org/apache/spark/sql/CarbonGetTableDetailComandTestCase.scala +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 - -import org.apache.spark.sql.execution.QueryExecution -import org.apache.spark.sql.execution.command.schema.CarbonGetTableDetailCommand -import org.apache.spark.sql.test.util.QueryTest -import org.scalatest.BeforeAndAfterAll - -class CarbonGetTableDetailCommandTestCase extends QueryTest with BeforeAndAfterAll { - override def beforeAll(): Unit = { - sql("drop table if exists table_info1") - sql("create table table_info1 (empno int, workgroupcategory string, deptno int, projectcode int, attendance int) stored by 'org.apache.carbondata.format' tblproperties('local_dictionary_enable'='false')") - sql(s"""load data local inpath '$resourcesPath/data.csv' into table table_info1 options('delimiter'=',', 'quotechar'='\"', 'fileheader'='')""") - - sql("drop table if exists table_info2") - sql("create table table_info2 (empno int, workgroupcategory string, deptno int, projectcode int, attendance int) stored by 'org.apache.carbondata.format' tblproperties('local_dictionary_enable'='false')") - sql(s"""load data local inpath '$resourcesPath/data.csv' into table table_info2 options('delimiter'=',', 'quotechar'='\"', 'fileheader'='')""") - } - - test("collect the information of tables") { - val logicalPlan = CarbonGetTableDetailCommand("default", Some(Seq("table_info1", "table_info2"))) - val result =new QueryExecution(sqlContext.sparkSession, logicalPlan) - .executedPlan - .execute - .collect - - assertResult(2)(result.length) - assertResult("table_info1")(result(0).getString(0)) - // 2282 is the size of carbon table. Note that since 1.5.0, we add additional compressor name in metadata - // and more metadata like written_by and version details are added - assertResult(2267)(result(0).getLong(1)) - assertResult("table_info2")(result(1).getString(0)) - assertResult(2267)(result(1).getLong(1)) - } - - override def afterAll: Unit = { - sql("drop table if exists table_info1") - sql("drop table if exists table_info2") - } -}
