Repository: carbondata
Updated Branches:
  refs/heads/master c5b21ff67 -> f16fd5423


[CARBONDATA-2194] Exception is improper when use incorrect bad record action 
type

This closes #1989


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

Branch: refs/heads/master
Commit: f16fd54239da760c17d1e629fed86a7fc5786875
Parents: c5b21ff
Author: xubo245 <601450...@qq.com>
Authored: Thu Feb 22 16:31:12 2018 +0800
Committer: Jacky Li <jacky.li...@qq.com>
Committed: Wed Mar 14 01:32:46 2018 +0800

----------------------------------------------------------------------
 .../apache/carbondata/core/util/SessionParams.java |  2 +-
 .../badrecordloger/BadRecordLoggerTest.scala       |  2 +-
 .../StandardPartitionBadRecordLoggerTest.scala     | 17 +++++++++++++++++
 .../spark/sql/catalyst/CarbonDDLSqlParser.scala    |  2 +-
 4 files changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/f16fd542/core/src/main/java/org/apache/carbondata/core/util/SessionParams.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/carbondata/core/util/SessionParams.java 
b/core/src/main/java/org/apache/carbondata/core/util/SessionParams.java
index c232b1e..68d0daa 100644
--- a/core/src/main/java/org/apache/carbondata/core/util/SessionParams.java
+++ b/core/src/main/java/org/apache/carbondata/core/util/SessionParams.java
@@ -157,7 +157,7 @@ public class SessionParams implements Serializable {
           isValid = true;
         } catch (IllegalArgumentException iae) {
           throw new InvalidConfigurationException(
-              "The key " + key + " can have only either FORCE or IGNORE or 
REDIRECT.");
+              "The key " + key + " can have only either FORCE or IGNORE or 
REDIRECT or FAIL.");
         }
         break;
       case CARBON_OPTIONS_SORT_SCOPE:

http://git-wip-us.apache.org/repos/asf/carbondata/blob/f16fd542/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/badrecordloger/BadRecordLoggerTest.scala
----------------------------------------------------------------------
diff --git 
a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/badrecordloger/BadRecordLoggerTest.scala
 
b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/badrecordloger/BadRecordLoggerTest.scala
index 694d25b..b6ba0e0 100644
--- 
a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/badrecordloger/BadRecordLoggerTest.scala
+++ 
b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/badrecordloger/BadRecordLoggerTest.scala
@@ -242,7 +242,7 @@ class BadRecordLoggerTest extends QueryTest with 
BeforeAndAfterAll {
           + "('bad_records_action'='FORCA', 'DELIMITER'= ',', 'QUOTECHAR'= 
'\"')");
     } catch {
       case ex: Exception =>
-        assert("option BAD_RECORDS_ACTION can have only either FORCE or IGNORE 
or REDIRECT"
+        assert("option BAD_RECORDS_ACTION can have only either FORCE or IGNORE 
or REDIRECT or FAIL"
           .equals(ex.getMessage))
     }
   }

http://git-wip-us.apache.org/repos/asf/carbondata/blob/f16fd542/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/standardpartition/StandardPartitionBadRecordLoggerTest.scala
----------------------------------------------------------------------
diff --git 
a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/standardpartition/StandardPartitionBadRecordLoggerTest.scala
 
b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/standardpartition/StandardPartitionBadRecordLoggerTest.scala
index 7b93766..8e1f13b 100644
--- 
a/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/standardpartition/StandardPartitionBadRecordLoggerTest.scala
+++ 
b/integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/standardpartition/StandardPartitionBadRecordLoggerTest.scala
@@ -204,6 +204,23 @@ class StandardPartitionBadRecordLoggerTest extends 
QueryTest with BeforeAndAfter
     )
   }
 
+  test("test load ddl command") {
+    sql(
+      """CREATE TABLE IF NOT EXISTS dataloadOptionTests(ID BigInt, date 
Timestamp, country
+           String,
+          actual_price Double, Quantity int, sold_price Decimal(19,2)) STORED 
BY 'carbondata'
+      """)
+    val csvFilePath = s"$resourcesPath/badrecords/emptyTimeStampValue.csv"
+    try {
+      sql("LOAD DATA local inpath '" + csvFilePath + "' INTO TABLE 
dataloadOptionTests OPTIONS"
+        + "('bad_records_action'='FORCA', 'DELIMITER'= ',', 'QUOTECHAR'= 
'\"')");
+    } catch {
+      case ex: Exception =>
+        assert("option BAD_RECORDS_ACTION can have only either FORCE or IGNORE 
or REDIRECT or FAIL"
+          .equals(ex.getMessage))
+    }
+  }
+
   def drop(): Unit = {
     sql("drop table IF EXISTS sales")
     sql("drop table IF EXISTS serializable_values")

http://git-wip-us.apache.org/repos/asf/carbondata/blob/f16fd542/integration/spark-common/src/main/scala/org/apache/spark/sql/catalyst/CarbonDDLSqlParser.scala
----------------------------------------------------------------------
diff --git 
a/integration/spark-common/src/main/scala/org/apache/spark/sql/catalyst/CarbonDDLSqlParser.scala
 
b/integration/spark-common/src/main/scala/org/apache/spark/sql/catalyst/CarbonDDLSqlParser.scala
index 54ac7dc..a377790 100644
--- 
a/integration/spark-common/src/main/scala/org/apache/spark/sql/catalyst/CarbonDDLSqlParser.scala
+++ 
b/integration/spark-common/src/main/scala/org/apache/spark/sql/catalyst/CarbonDDLSqlParser.scala
@@ -950,7 +950,7 @@ abstract class CarbonDDLSqlParser extends 
AbstractCarbonSparkSQLParser {
       catch {
         case _: IllegalArgumentException =>
           throw new MalformedCarbonCommandException(
-            "option BAD_RECORDS_ACTION can have only either FORCE or IGNORE or 
REDIRECT")
+            "option BAD_RECORDS_ACTION can have only either FORCE or IGNORE or 
REDIRECT or FAIL")
       }
     }
     if (options.exists(_._1.equalsIgnoreCase("IS_EMPTY_DATA_BAD_RECORD"))) {

Reply via email to