You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@carbondata.apache.org by GitBox <gi...@apache.org> on 2021/05/13 05:48:45 UTC

[GitHub] [carbondata] Indhumathi27 commented on a change in pull request #4133: [CARBONDATA-4184] alter table Set TBLPROPERTIES for RANGE_COLUMN sets unsupported datatype(complex_datatypes/Binary/Boolean/Decimal) as RANGE_COLUMN.

Indhumathi27 commented on a change in pull request #4133:
URL: https://github.com/apache/carbondata/pull/4133#discussion_r631579778



##########
File path: integration/spark/src/main/scala/org/apache/spark/util/AlterTableUtil.scala
##########
@@ -652,6 +652,16 @@ object AlterTableUtil {
         throw new MalformedCarbonCommandException(
           s"Table property ${ CarbonCommonConstants.RANGE_COLUMN }: ${ rangeColumnProp }" +
           s" is not exists in the table")
+      }
+      val dataType = rangeColumn.getDataType.getName;
+      if (DataTypes.BINARY.getName.equalsIgnoreCase(dataType) ||

Review comment:
       This check is same as CarbonParserUtil range column check. can extract to method and reuse

##########
File path: integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/dataload/TestRangeColumnDataLoad.scala
##########
@@ -836,15 +836,52 @@ class TestRangeColumnDataLoad extends QueryTest with BeforeAndAfterEach with Bef
   test("set and unset table property: range_column") {
     sql(
       """
-        | CREATE TABLE carbon_range_column6(id INT, name STRING, city STRING, age INT)
-        | STORED AS carbondata
+        | CREATE TABLE carbon_range_column6(id INT, name STRING, city STRING, age INT, bin binary,
+        |  bool1 boolean, arr1 array<int>, struct1 struct<id1:string,name1:string>,
+        |  map1 map<string,string>, dec1 decimal(10,5)) STORED AS carbondata
         | TBLPROPERTIES('SORT_SCOPE'='LOCAL_SORT', 'SORT_COLUMNS'='name, city')
       """.stripMargin)
 
     sql("ALTER TABLE carbon_range_column6 SET TBLPROPERTIES('range_column'='city')")
     sql("ALTER TABLE carbon_range_column6 SET TBLPROPERTIES('range_column'='name')")
     sql("ALTER TABLE carbon_range_column6 UNSET TBLPROPERTIES('range_column')")
     sql("ALTER TABLE carbon_range_column6 SET TBLPROPERTIES('range_column'='name')")
+
+    var ex = intercept[RuntimeException] {
+      sql("ALTER TABLE carbon_range_column6 SET TBLPROPERTIES('range_column'='bin')")

Review comment:
       Can move this alter exception validation to method. method could be validateInvalidRangecolumn(rangeColumn: String, dataType: String)




-- 
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:
users@infra.apache.org