[GitHub] [carbondata] VenuReddy2103 commented on a change in pull request #3865: [CARBONDATA-3928] Handled the Strings which length is greater than 32000 as a bad record.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] [carbondata] VenuReddy2103 commented on a change in pull request #3865: [CARBONDATA-3928] Handled the Strings which length is greater than 32000 as a bad record.

GitBox

VenuReddy2103 commented on a change in pull request #3865:
URL: https://github.com/apache/carbondata/pull/3865#discussion_r474466612



##########
File path: streaming/src/main/scala/org/apache/carbondata/streaming/parser/FieldConverter.scala
##########
@@ -54,11 +54,12 @@ object FieldConverter {
       value match {
         case s: String => if (!isVarcharType && !isComplexType &&
                               s.length > CarbonCommonConstants.MAX_CHARS_PER_COLUMN_DEFAULT) {
-          throw new IllegalArgumentException(stringLengthExceedErrorMsg +
-            CarbonCommonConstants.MAX_CHARS_PER_COLUMN_DEFAULT + " characters")
-        } else {
-          s
+          if (!CarbonProperties.getInstance.getProperty(CarbonCommonConstants
+            .CARBON_ENABLE_BAD_RECORD_HANDLING_FOR_INSERT).toBoolean) {
+            throw new IllegalArgumentException(CarbonCommonConstants.STRING_LENGTH_EXCEEDED_MESSAGE)

Review comment:
       `STRING_LENGTH_EXCEEDED_MESSAGE` has format specifiers("%s") in it. Instead of throwing with format specifiers here and then catching it in `carbonScalaUtil.getString()` and formatting it, suggest to throw the formatted string itself from here. Can cause security vulnerability issue if we for forget to catch such exception and modify it. Also suggest to add FMT prefix to string `STRING_LENGTH_EXCEEDED_MESSAGE`




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