jackylk commented on a change in pull request #3546: [CARBONDATA-3642] Add 
column idx in error msg when string length exceed 32000
URL: https://github.com/apache/carbondata/pull/3546#discussion_r361907409
 
 

 ##########
 File path: 
integration/spark-common/src/main/scala/org/apache/carbondata/spark/util/CarbonScalaUtil.scala
 ##########
 @@ -60,17 +60,27 @@ object CarbonScalaUtil {
 
   private val LOGGER: Logger = 
LogServiceFactory.getLogService(this.getClass.getCanonicalName)
 
-  def getString(value: Any,
+  def getString(row: Row,
+      idx: Int,
       serializationNullFormat: String,
       complexDelimiters: util.ArrayList[String],
       timeStampFormat: SimpleDateFormat,
       dateFormat: SimpleDateFormat,
       isVarcharType: Boolean = false,
       isComplexType: Boolean = false,
       level: Int = 0): String = {
-    FieldConverter.objectToString(value, serializationNullFormat, 
complexDelimiters,
-      timeStampFormat, dateFormat, isVarcharType = isVarcharType, 
isComplexType = isComplexType,
-      level)
+    try {
+      FieldConverter.objectToString(row.get(idx), serializationNullFormat, 
complexDelimiters,
+        timeStampFormat, dateFormat, isVarcharType = isVarcharType, 
isComplexType = isComplexType,
+        level)
+    } catch {
+      case e: Exception =>
+        if (e.getMessage.startsWith(FieldConverter.exceedErrorMsg)) {
+          throw new Exception("Column idx " + idx + " too long", e)
 
 Review comment:
   Why change the content and throw again? Why not throw it directly?

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to