Conversation
core/src/main/java/org/apache/calcite/util/format/FormatElementEnum.java
Outdated
Show resolved
Hide resolved
tanclary
left a comment
There was a problem hiding this comment.
If you rebase on main it might be easier to tell what exactly is being added in this PR (at least for someone like me who reviews based on "Files changed").
2c6d68d to
b042e5c
Compare
|
I initially wanted to support timezone, but according to my tests, there seems to be no unified standard for timezone. |
deec335 to
96b7123
Compare
|
|
Please merge after this pr #3609. |
| import static org.apache.calcite.util.format.FormatElementEnum.YY; | ||
| import static org.apache.calcite.util.format.FormatElementEnum.YYYY; | ||
| import static org.apache.calcite.util.format.FormatElementEnum.day; | ||
| import static org.apache.calcite.util.format.FormatElementEnum.dy; |
There was a problem hiding this comment.
The imports here should be in alphabetical order.
There was a problem hiding this comment.
I tried it, but it will report an error. It seems that there is a restriction on the upper and lower case order.
import static org.apache.calcite.util.format.FormatElementEnum.*; ?
There was a problem hiding this comment.
Wouldn't checkstyle complain if the imports are in the wrong order?
There was a problem hiding this comment.
Possibly checkstyle is using a different collation (e.g. different treatment of upper/lower case, spaces, underscores). Do whatever makes checkstyle happy.
There was a problem hiding this comment.
Easiest thing is to make the enum constants upper-case.
core/src/main/java/org/apache/calcite/util/format/FormatElementEnum.java
Show resolved
Hide resolved
core/src/test/java/org/apache/calcite/util/format/FormatElementEnumTest.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/apache/calcite/util/format/FormatElementEnumTest.java
Show resolved
Hide resolved
| * @see FormatModels#DEFAULT | ||
| */ | ||
| public enum FormatElementEnum implements FormatElement { | ||
| CC("cc", "century (2 digits) (the twenty-first century starts on 2001-01-01)") { |
There was a problem hiding this comment.
I think the commit message should probably be more descriptive, I wasn't sure what Support date format meant until I reviewed the PR.
There was a problem hiding this comment.
+1
I won't even review a PR until the jira case has a good description of its goals. Sounds pedantic but it's very pragmatic.
This jira case also needs to say which functions these date formats are supported in. Changes to FormatElementEnum are not useful unless they are surfaced in functions.
| sb.append(work.eeeeFormat.format(date)); | ||
| } | ||
| }, | ||
| day("eeee", "The full lower case day name") { |
There was a problem hiding this comment.
Enum constants should be all uppercase I believe.
https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html
| assertThat(ts, hasToString("Tuesday")); | ||
| } | ||
|
|
||
| @Test void testday() { |
There was a problem hiding this comment.
Test name should be camelcase
| assertThat(ts, hasToString("Tue")); | ||
| } | ||
|
|
||
| @Test void testdy() { |
| } | ||
|
|
||
| @Test void testCC() { | ||
| final String date = "2014-09-30T10:00:00Z"; |
There was a problem hiding this comment.
Instead of adding to the end of the file why don't we make these alphabetical
|
Thanks everyone. |
|
I will open this pr after clarifying the overall architecture and code structure of calcite. If I feel that this pr has a pr at that time, |

https://issues.apache.org/jira/browse/CALCITE-6185