carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gvram...@apache.org
Subject [1/2] incubator-carbondata git commit: Throwing exception in case of improper MAXCOULUMN value
Date Sat, 17 Sep 2016 16:38:32 GMT
Repository: incubator-carbondata
Updated Branches:
  refs/heads/master 74358b05a -> fec8a9186


Throwing exception in case of improper MAXCOULUMN value


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

Branch: refs/heads/master
Commit: ecab660ed622ac2060f9a401d6987c21ec1719d5
Parents: 74358b0
Author: Manohar <manohar.crazy09@gmail.com>
Authored: Sat Sep 17 19:17:58 2016 +0530
Committer: Venkata Ramana G <ramana.gollamudi@huawei.com>
Committed: Sat Sep 17 22:05:11 2016 +0530

----------------------------------------------------------------------
 .../TestDataLoadWithColumnsMoreThanSchema.scala | 20 ++++++++++++++++++++
 .../processing/csvload/DataGraphExecuter.java   |  2 +-
 .../processing/csvreaderstep/CsvInput.java      |  1 +
 3 files changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ecab660e/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/dataload/TestDataLoadWithColumnsMoreThanSchema.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/dataload/TestDataLoadWithColumnsMoreThanSchema.scala
b/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/dataload/TestDataLoadWithColumnsMoreThanSchema.scala
index 4755a01..7bd29d5 100644
--- a/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/dataload/TestDataLoadWithColumnsMoreThanSchema.scala
+++ b/integration/spark/src/test/scala/org/apache/carbondata/spark/testsuite/dataload/TestDataLoadWithColumnsMoreThanSchema.scala
@@ -25,6 +25,8 @@ import org.apache.spark.sql.common.util.CarbonHiveContext._
 import org.apache.spark.sql.common.util.QueryTest
 import org.scalatest.BeforeAndAfterAll
 
+import org.apache.carbondata.spark.exception.MalformedCarbonCommandException
+
 /**
  * This class will test data load in which number of columns in data are more than
  * the number of columns in schema
@@ -68,8 +70,26 @@ class TestDataLoadWithColumnsMoreThanSchema extends QueryTest with BeforeAndAfte
     }
   }
 
+  test("test with invalid maxColumns value") {
+    sql(
+      "CREATE TABLE max_columns_value_test (imei string,age int,task bigint,num double,level
" +
+      "decimal(10,3),productdate timestamp,mark int,name string) STORED BY 'org.apache.carbondata"
+
+      ".format'")
+    try {
+      sql(
+        "LOAD DATA LOCAL INPATH './src/test/resources/character_carbon.csv' into table "
+
+        "max_columns_value_test options('FILEHEADER='imei,age','MAXCOLUMNS'='2')")
+      throw new MalformedCarbonCommandException("Invalid")
+    } catch {
+      case me: MalformedCarbonCommandException =>
+        assert(false)
+      case _ => assert(true)
+    }
+  }
+
   override def afterAll {
     sql("DROP TABLE IF EXISTS char_test")
     sql("DROP TABLE IF EXISTS hive_char_test")
+    sql("DROP TABLE IF EXISTS max_columns_value_test")
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ecab660e/processing/src/main/java/org/apache/carbondata/processing/csvload/DataGraphExecuter.java
----------------------------------------------------------------------
diff --git a/processing/src/main/java/org/apache/carbondata/processing/csvload/DataGraphExecuter.java
b/processing/src/main/java/org/apache/carbondata/processing/csvload/DataGraphExecuter.java
index 67d77a3..680cb37 100644
--- a/processing/src/main/java/org/apache/carbondata/processing/csvload/DataGraphExecuter.java
+++ b/processing/src/main/java/org/apache/carbondata/processing/csvload/DataGraphExecuter.java
@@ -209,7 +209,7 @@ public class DataGraphExecuter {
 
     if (trans.getErrors() > 0) {
       LOGGER.error("Graph Execution had errors");
-      throw new DataLoadingException("Internal Errors");
+      throw new DataLoadingException("Due to internal errors, please check logs for more
details.");
     } else if (null != BadRecordslogger.hasBadRecord(key)) {
       LOGGER.error("Graph Execution is partcially success");
       throw new DataLoadingException(DataProcessorConstants.BAD_REC_FOUND,

http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/ecab660e/processing/src/main/java/org/apache/carbondata/processing/csvreaderstep/CsvInput.java
----------------------------------------------------------------------
diff --git a/processing/src/main/java/org/apache/carbondata/processing/csvreaderstep/CsvInput.java
b/processing/src/main/java/org/apache/carbondata/processing/csvreaderstep/CsvInput.java
index 86ec915..8db8ed4 100644
--- a/processing/src/main/java/org/apache/carbondata/processing/csvreaderstep/CsvInput.java
+++ b/processing/src/main/java/org/apache/carbondata/processing/csvreaderstep/CsvInput.java
@@ -390,6 +390,7 @@ public class CsvInput extends BaseStep implements StepInterface {
           LOGGER.info("*****************Completed csv reading by thread***********");
         } catch (Throwable e) {
           LOGGER.error(e, "Thread is terminated due to error");
+          throw new RuntimeException("Thread is terminated due to error : " + e.getMessage());
         }
         return null;
       }


Mime
View raw message