You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by ku...@apache.org on 2019/05/30 09:16:38 UTC
[carbondata] branch master updated: [CARBONDATA-3382] Fixed
compressor type display in desc formatted
This is an automated email from the ASF dual-hosted git repository.
kunalkapoor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/carbondata.git
The following commit(s) were added to refs/heads/master by this push:
new d733af7 [CARBONDATA-3382] Fixed compressor type display in desc formatted
d733af7 is described below
commit d733af70c5bd7908a65e5c4ec8dbaadc6ddf0e9e
Author: RamKrishnan77 <ra...@gmail.com>
AuthorDate: Mon May 13 20:37:46 2019 +0530
[CARBONDATA-3382] Fixed compressor type display in desc formatted
Problem :
Describe formatted table does not display the correct compression
type when its is configured in carbon.properties instead it always
shows the default compressor type.
Solution :
Get the compressor type from the instance of CarbonProperties.
This closes #3214
---
.../spark/testsuite/describeTable/TestDescribeTable.scala | 15 +++++++++++++++
.../command/table/CarbonDescribeFormattedCommand.scala | 4 +++-
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/describeTable/TestDescribeTable.scala b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/describeTable/TestDescribeTable.scala
index 0f7a4f6..be5d3a8 100644
--- a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/describeTable/TestDescribeTable.scala
+++ b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/describeTable/TestDescribeTable.scala
@@ -20,6 +20,9 @@ import org.apache.spark.sql.Row
import org.apache.spark.sql.test.util.QueryTest
import org.scalatest.BeforeAndAfterAll
+import org.apache.carbondata.core.constants.CarbonCommonConstants
+import org.apache.carbondata.core.util.CarbonProperties
+
/**
* test class for describe table .
*/
@@ -65,10 +68,22 @@ class TestDescribeTable extends QueryTest with BeforeAndAfterAll {
assert(descPar.exists(_.toString().contains("Partition Parameters:")))
}
+ test(testName = "Compressor Type update from carbon properties") {
+ sql("drop table if exists b")
+ sql(sqlText = "create table b(a int,b string) stored by 'carbondata'")
+ CarbonProperties.getInstance().addProperty(CarbonCommonConstants.COMPRESSOR, "gzip")
+ val result = sql(sqlText = "desc formatted b").collect()
+ assert(result.filter(row => row.getString(0).contains("Data File Compressor")).head.getString
+ (1).equalsIgnoreCase("gzip"))
+ }
+
override def afterAll: Unit = {
sql("DROP TABLE Desc1")
sql("DROP TABLE Desc2")
sql("drop table if exists a")
+ sql("drop table if exists b")
+ CarbonProperties.getInstance().addProperty(CarbonCommonConstants.COMPRESSOR,
+ CarbonCommonConstants.DEFAULT_COMPRESSOR)
}
}
diff --git a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/table/CarbonDescribeFormattedCommand.scala b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/table/CarbonDescribeFormattedCommand.scala
index e8f0f23..ebe4daf 100644
--- a/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/table/CarbonDescribeFormattedCommand.scala
+++ b/integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/table/CarbonDescribeFormattedCommand.scala
@@ -113,7 +113,9 @@ private[sql] case class CarbonDescribeFormattedCommand(
CarbonCommonConstants.CARBON_LOAD_MIN_SIZE_INMB_DEFAULT).toFloat), ""),
("Data File Compressor ", tblProps
.getOrElse(CarbonCommonConstants.COMPRESSOR,
- CarbonCommonConstants.DEFAULT_COMPRESSOR), ""),
+ CarbonProperties.getInstance()
+ .getProperty(CarbonCommonConstants.COMPRESSOR,
+ CarbonCommonConstants.DEFAULT_COMPRESSOR)), ""),
//////////////////////////////////////////////////////////////////////////////
// Index Information
//////////////////////////////////////////////////////////////////////////////