Github user jackylk commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1653#discussion_r157151644
--- Diff:
integration/spark-common/src/main/scala/org/apache/spark/sql/catalyst/CarbonDDLSqlParser.scala
---
@@ -871,6 +871,32 @@ abstract class CarbonDDLSqlParser extends
AbstractCarbonSparkSQLParser {
throw new MalformedCarbonCommandException(errorMessage)
}
+ // Validate QUOTECHAR length
+ if (options.exists(_._1.equalsIgnoreCase("QUOTECHAR"))) {
+ val quoteChar: String = options.get("quotechar").get.head._2
+ if (quoteChar.length > 1 ) {
+ throw new MalformedCarbonCommandException("Quotation cannot be
more than one character.")
+ }
+ }
+
+ // Validate COMMENTCHAR length
+ if (options.exists(_._1.equalsIgnoreCase("COMMENTCHAR"))) {
+ val commentChar: String = options.get("commentchar").get.head._2
+ if (commentChar.length > 1) {
+ throw new MalformedCarbonCommandException(
+ "Comment marker cannot be more than one character.")
+ }
+ }
+
+ // Validate ESCAPECHAR length
+ if (options.exists(_._1.equalsIgnoreCase("ESCAPECHAR"))) {
+ val escapechar: String = options.get("escapechar").get.head._2
+ if (escapechar.length > 1 &&
!CommonUtil.isValidEscapeSequence(escapechar)) {
+ throw new MalformedCarbonCommandException(
+ "Escape character cannot be more than one character.")
--- End diff --
change to `ESCAPECHAR`
---