Indhumathi27 commented on a change in pull request #3896:
URL: https://github.com/apache/carbondata/pull/3896#discussion_r476380921
##########
File path: core/src/main/java/org/apache/carbondata/core/util/DataTypeUtil.java
##########
@@ -444,9 +446,38 @@ private static Object parseTimestamp(String
dimensionValue, String dateFormat) {
dateFormatter = timestampFormatter.get();
}
dateToStr = dateFormatter.parse(dimensionValue);
- return dateToStr.getTime();
+ timeValue = dateToStr.getTime();
+ validateTimeStampRange(timeValue);
+ return timeValue;
} catch (ParseException e) {
- throw new NumberFormatException(e.getMessage());
+ // If the parsing fails, try to parse again with setLenient to true if
the property is set
+ if (CarbonProperties.getInstance().isSetLenientEnabled()) {
+ try {
+ dateFormatter.setLenient(true);
+ dateToStr = dateFormatter.parse(dimensionValue);
+ dateFormatter.setLenient(false);
+ timeValue = dateToStr.getTime();
+ validateTimeStampRange(timeValue);
+ LOGGER.info("Parsed data with lenience as true, setting back to
default mode");
+ return timeValue;
+ } catch (ParseException ex) {
+ dateFormatter.setLenient(false);
+ LOGGER.info("Failed to parse data with lenience as true, setting
back to default mode");
Review comment:
This log is not needed i think, since we are throwing exception
----------------------------------------------------------------
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]