You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "mihaibudiu (via GitHub)" <gi...@apache.org> on 2024/03/08 21:38:17 UTC
Re: [PR] [CALCITE-6226] Wrong ISOWEEK and no ISOYEAR on BigQuery FORMAT_DATE [calcite]
mihaibudiu commented on code in PR #3653:
URL: https://github.com/apache/calcite/pull/3653#discussion_r1518326248
##########
core/src/test/java/org/apache/calcite/util/format/FormatElementEnumTest.java:
##########
@@ -77,8 +77,32 @@ class FormatElementEnumTest {
assertFormatElement(FormatElementEnum.FF6, "2014-09-30T10:00:00.123456Z", "000123");
}
- @Test void testIW() {
+ @Test void testID() {
+ assertFormatElement(FormatElementEnum.ID, "2014-09-30T10:00:00Z", "2");
+ }
+
+ @Test
+ void testIW() {
assertFormatElement(FormatElementEnum.IW, "2014-09-30T10:00:00Z", "40");
+ // edge case where ISO WEEK != WEEK
Review Comment:
I have discovered that the Java Calendar class doesn't handle correctly some operations with dates before the Gregorian calendar introduction. Can you please add some tests for dates in that range?
https://issues.apache.org/jira/projects/CALCITE/issues/CALCITE-6252
Can you also confirm that the values have been validated against BigQuery?
##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -12472,6 +12472,21 @@ void testTimestampDiff(boolean coercionEnabled) {
f.checkScalar("FORMAT_DATE('The date is: %x', DATE '2008-12-25')",
"The date is: 12/25/08",
"VARCHAR(2000) NOT NULL");
+ f.checkScalar("FORMAT_DATE('%G-%V', DATE '2023-01-01')",
Review Comment:
same comment about dates before the Gregorian calendar
--
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.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org