carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kumarvisha...@apache.org
Subject carbondata git commit: [CARBONDATA-1714] Fixed Issue for Selection of null values after having multiple alter commands
Date Wed, 20 Dec 2017 15:16:35 GMT
Repository: carbondata
Updated Branches:
  refs/heads/master 4c9af60d4 -> 64b26513f


[CARBONDATA-1714] Fixed Issue for Selection of null values after having multiple alter commands

In CarbonTableInputFormat, isFilterMesure is populated with measurelist size as this includes
the count of previous drop column having invisible true.

This closes #1629


Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/64b26513
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/64b26513
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/64b26513

Branch: refs/heads/master
Commit: 64b26513f6ad7c75e48a26b867389d038196f872
Parents: 4c9af60
Author: Jatin <jatin.demla@knoldus.in>
Authored: Thu Dec 7 10:41:37 2017 +0530
Committer: kumarvishal <kumarvishal.1802@gmail.com>
Committed: Wed Dec 20 20:46:16 2017 +0530

----------------------------------------------------------------------
 .../hadoop/api/CarbonTableInputFormat.java      |  3 ++-
 .../AlterTableValidationTestCase.scala          | 20 ++++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/64b26513/hadoop/src/main/java/org/apache/carbondata/hadoop/api/CarbonTableInputFormat.java
----------------------------------------------------------------------
diff --git a/hadoop/src/main/java/org/apache/carbondata/hadoop/api/CarbonTableInputFormat.java
b/hadoop/src/main/java/org/apache/carbondata/hadoop/api/CarbonTableInputFormat.java
index e60a588..7db9c0a 100644
--- a/hadoop/src/main/java/org/apache/carbondata/hadoop/api/CarbonTableInputFormat.java
+++ b/hadoop/src/main/java/org/apache/carbondata/hadoop/api/CarbonTableInputFormat.java
@@ -826,8 +826,9 @@ public class CarbonTableInputFormat<T> extends FileInputFormat<Void,
T> {
     // set the filter to the query model in order to filter blocklet before scan
     Expression filter = getFilterPredicates(configuration);
     boolean[] isFilterDimensions = new boolean[carbonTable.getDimensionOrdinalMax()];
+    // getAllMeasures returns list of visible and invisible columns
     boolean[] isFilterMeasures =
-        new boolean[carbonTable.getNumberOfMeasures(carbonTable.getTableName())];
+        new boolean[carbonTable.getAllMeasures().size()];
     CarbonInputFormatUtil.processFilterExpression(filter, carbonTable, isFilterDimensions,
         isFilterMeasures);
     queryModel.setIsFilterDimensions(isFilterDimensions);

http://git-wip-us.apache.org/repos/asf/carbondata/blob/64b26513/integration/spark2/src/test/scala/org/apache/spark/carbondata/restructure/AlterTableValidationTestCase.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/test/scala/org/apache/spark/carbondata/restructure/AlterTableValidationTestCase.scala
b/integration/spark2/src/test/scala/org/apache/spark/carbondata/restructure/AlterTableValidationTestCase.scala
index 92d337f..e7e0160 100644
--- a/integration/spark2/src/test/scala/org/apache/spark/carbondata/restructure/AlterTableValidationTestCase.scala
+++ b/integration/spark2/src/test/scala/org/apache/spark/carbondata/restructure/AlterTableValidationTestCase.scala
@@ -527,6 +527,26 @@ class AlterTableValidationTestCase extends Spark2QueryTest with BeforeAndAfterAl
     sql("drop table if exists preaggmain_new")
     sql("drop table if exists preaggMain_preagg1")
   }
+  test("test to check select columns after alter commands with null values"){
+    sql("drop table if exists restructure")
+    sql("drop table if exists restructure1")
+    sql(
+      "CREATE TABLE restructure (empno int, empname String, designation String, doj Timestamp,
" +
+      "workgroupcategory int, workgroupcategoryname String, deptno int, deptname String,
" +
+      "projectcode int, projectjoindate Timestamp, projectenddate Timestamp,attendance int,"
+
+      "utilization int,salary int) STORED BY 'org.apache.carbondata.format'")
+    sql(
+      s"""LOAD DATA LOCAL INPATH '$resourcesPath/data.csv' INTO TABLE restructure OPTIONS
+         |('DELIMITER'= ',', 'QUOTECHAR'= '\"')""".stripMargin)
+    sql("ALTER TABLE restructure rename to restructure1")
+    sql("ALTER TABLE restructure1 ADD COLUMNS (projId int)")
+    sql("ALTER TABLE restructure1 DROP COLUMNS (projId)")
+    sql("ALTER TABLE restructure1 CHANGE empno empno BIGINT")
+    sql("ALTER TABLE restructure1 ADD COLUMNS (a1 INT, b1 STRING) TBLPROPERTIES('DICTIONARY_EXCLUDE'='b1')")
+    checkAnswer(sql("select a1,b1,empname from restructure1 where a1 is null and b1 is null
and empname='arvind'"),Row(null,null,"arvind"))
+    sql("drop table if exists restructure1")
+    sql("drop table if exists restructure")
+  }
 
   override def afterAll {
     sql("DROP TABLE IF EXISTS restructure")


Mime
View raw message