Github user manishgupta88 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1126#discussion_r157700973
--- Diff:
core/src/main/java/org/apache/carbondata/core/keygenerator/directdictionary/timestamp/DateDirectDictionaryGenerator.java
---
@@ -42,12 +42,37 @@
private String dateFormat;
+ /**
+ * min value supported for date type column
+ */
+ private static final long MIN_VALUE;
+ /**
+ * MAx value supported for date type column
+ */
+ private static final long MAX_VALUE;
/**
* Logger instance
*/
private static final LogService LOGGER =
LogServiceFactory.getLogService(DateDirectDictionaryGenerator.class.getName());
+ static {
+ SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
+ df.setTimeZone(TimeZone.getTimeZone("GMT"));
+ long minValue = 0;
+ long maxValue = 0;
+ try {
+ minValue = df.parse("0001-01-01").getTime();
+ maxValue = df.parse("9999-12-31").getTime();
+ } catch (ParseException e) {
--- End diff --
As you are defining the date format yourself and parsing it, ParseException
will not be thrown. But as we need to handle this exception, you can just put a
warning logger in catch block and take out the remaining logic. If we dont get
any findbug for empty catch block then better to just put a comment in catch
block and not do anything
---