[jira] [Commented] (CALCITE-6315) Support PostgreSQL TO_CHAR, TO_DATE, TO_TIMESTAMP

2024-04-08 Thread Norman Jordan (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17835045#comment-17835045
 ] 

Norman Jordan commented on CALCITE-6315:


I have added some tests here.

[https://github.com/Bit-Quill/calcite/blob/calcite-6315-format-tests/babel/src/test/resources/sql/postgresql.iq#L66]

This tests all of the template formats for PostgreSQL 14. As expected, many 
fail at the moment.

> Support PostgreSQL TO_CHAR, TO_DATE, TO_TIMESTAMP
> -
>
> Key: CALCITE-6315
> URL: https://issues.apache.org/jira/browse/CALCITE-6315
> Project: Calcite
>  Issue Type: Sub-task
>Reporter: James Duong
>Priority: Minor
>  Labels: pull-request-available
>
> PostgreSQL supports different format strings than the version we have 
> implemented.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CALCITE-6315) Support PostgreSQL TO_CHAR, TO_DATE, TO_TIMESTAMP

2024-04-08 Thread Norman Jordan (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17835042#comment-17835042
 ] 

Norman Jordan commented on CALCITE-6315:


[~jerin_john] Thanks for letting me know about your work. It looks like some of 
these will difficult to support with {*}SimpleDateFormat{*}. There is already 
support for {*}FF1{*}, {*}FF2{*}, {*}FF4{*}, {*}FF5{*}, and {*}FF6{*}. Calcite 
will produce different results for these than PostgreSQL.

Consider this timestamp *2022-06-03 12:15:48.678*

 
|| ||FF1||FF2||FF4||FF5||FF6||
|Calcite|678|678|0678|00678|000678|
|PostgreSQL|6|67|6780|67800|678000|

The Calcite result for *FF3* matches PostgreSQL.

There are some other formats such as *IYYY* that cannot be supported using 
{*}SimpleDateFormat{*}. 

> Support PostgreSQL TO_CHAR, TO_DATE, TO_TIMESTAMP
> -
>
> Key: CALCITE-6315
> URL: https://issues.apache.org/jira/browse/CALCITE-6315
> Project: Calcite
>  Issue Type: Sub-task
>Reporter: James Duong
>Priority: Minor
>  Labels: pull-request-available
>
> PostgreSQL supports different format strings than the version we have 
> implemented.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CALCITE-6315) Support PostgreSQL TO_CHAR, TO_DATE, TO_TIMESTAMP

2024-03-22 Thread Jerin John (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17829994#comment-17829994
 ] 

Jerin John commented on CALCITE-6315:
-

Hi [~njordan], I am also currently working on a ticket 
[CALCITE-6269|https://issues.apache.org/jira/browse/CALCITE-6269] to fix some 
of these FormatElements from BigQuery which are broken or missing in the 
current implementation. Looking at this list you commented I see many overlaps 
which can be enabled for Postgres as well, I'll share that PR here once its 
ready so you can verify and add the remaining missing ones.

> Support PostgreSQL TO_CHAR, TO_DATE, TO_TIMESTAMP
> -
>
> Key: CALCITE-6315
> URL: https://issues.apache.org/jira/browse/CALCITE-6315
> Project: Calcite
>  Issue Type: Sub-task
>Reporter: James Duong
>Priority: Minor
>
> PostgreSQL supports different format strings than the version we have 
> implemented.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CALCITE-6315) Support PostgreSQL TO_CHAR, TO_DATE, TO_TIMESTAMP

2024-03-22 Thread Julian Hyde (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17829930#comment-17829930
 ] 

Julian Hyde commented on CALCITE-6315:
--

OK, great, make sure that it tests all format elements.

> Support PostgreSQL TO_CHAR, TO_DATE, TO_TIMESTAMP
> -
>
> Key: CALCITE-6315
> URL: https://issues.apache.org/jira/browse/CALCITE-6315
> Project: Calcite
>  Issue Type: Sub-task
>Reporter: James Duong
>Priority: Minor
>
> PostgreSQL supports different format strings than the version we have 
> implemented.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CALCITE-6315) Support PostgreSQL TO_CHAR, TO_DATE, TO_TIMESTAMP

2024-03-22 Thread Norman Jordan (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17829925#comment-17829925
 ] 

Norman Jordan commented on CALCITE-6315:


There is already a test for `to_char` with PostgreSQL.

[https://github.com/apache/calcite/blob/main/babel/src/test/resources/sql/postgresql.iq#L66]

> Support PostgreSQL TO_CHAR, TO_DATE, TO_TIMESTAMP
> -
>
> Key: CALCITE-6315
> URL: https://issues.apache.org/jira/browse/CALCITE-6315
> Project: Calcite
>  Issue Type: Sub-task
>Reporter: James Duong
>Priority: Minor
>
> PostgreSQL supports different format strings than the version we have 
> implemented.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CALCITE-6315) Support PostgreSQL TO_CHAR, TO_DATE, TO_TIMESTAMP

2024-03-19 Thread Norman Jordan (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17828529#comment-17828529
 ] 

Norman Jordan commented on CALCITE-6315:


[~julianhyde] Thanks, I'll start with adding tests.

> Support PostgreSQL TO_CHAR, TO_DATE, TO_TIMESTAMP
> -
>
> Key: CALCITE-6315
> URL: https://issues.apache.org/jira/browse/CALCITE-6315
> Project: Calcite
>  Issue Type: Sub-task
>Reporter: James Duong
>Priority: Minor
>
> PostgreSQL supports different format strings than the version we have 
> implemented.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CALCITE-6315) Support PostgreSQL TO_CHAR, TO_DATE, TO_TIMESTAMP

2024-03-19 Thread Julian Hyde (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17828522#comment-17828522
 ] 

Julian Hyde commented on CALCITE-6315:
--

If you want to help, add some tests. For CALCITE-2980 I added 
{{cast-with-format.iq}} based on Impala's tests. If you added a Quidem test for 
the above format strings, with output as generated by Postgres, then it's easy 
to check whether Calcite's implementation is compliant for each format string.

> Support PostgreSQL TO_CHAR, TO_DATE, TO_TIMESTAMP
> -
>
> Key: CALCITE-6315
> URL: https://issues.apache.org/jira/browse/CALCITE-6315
> Project: Calcite
>  Issue Type: Sub-task
>Reporter: James Duong
>Priority: Minor
>
> PostgreSQL supports different format strings than the version we have 
> implemented.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CALCITE-6315) Support PostgreSQL TO_CHAR, TO_DATE, TO_TIMESTAMP

2024-03-19 Thread Tanner Clary (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17828505#comment-17828505
 ] 

Tanner Clary commented on CALCITE-6315:
---

Yes of course it'd be great to add elements that aren't supported, but I'm not 
sure it's covered under the scope of this JIRA as is. (maybe create another 
ticket or rewrite this one). Also tagging [~jerin_john] since he has relevant 
format experience.

> Support PostgreSQL TO_CHAR, TO_DATE, TO_TIMESTAMP
> -
>
> Key: CALCITE-6315
> URL: https://issues.apache.org/jira/browse/CALCITE-6315
> Project: Calcite
>  Issue Type: Sub-task
>Reporter: James Duong
>Priority: Minor
>
> PostgreSQL supports different format strings than the version we have 
> implemented.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CALCITE-6315) Support PostgreSQL TO_CHAR, TO_DATE, TO_TIMESTAMP

2024-03-19 Thread Norman Jordan (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17828504#comment-17828504
 ] 

Norman Jordan commented on CALCITE-6315:


[~tanclary] [~julianhyde] How can this issue be resolved? Should the missing 
template patterns be added to the `FormatModel` for PostgreSQL? Are there any 
patterns that should not be added?

> Support PostgreSQL TO_CHAR, TO_DATE, TO_TIMESTAMP
> -
>
> Key: CALCITE-6315
> URL: https://issues.apache.org/jira/browse/CALCITE-6315
> Project: Calcite
>  Issue Type: Sub-task
>Reporter: James Duong
>Priority: Minor
>
> PostgreSQL supports different format strings than the version we have 
> implemented.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CALCITE-6315) Support PostgreSQL TO_CHAR, TO_DATE, TO_TIMESTAMP

2024-03-19 Thread Norman Jordan (Jira)


[ 
https://issues.apache.org/jira/browse/CALCITE-6315?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17828503#comment-17828503
 ] 

Norman Jordan commented on CALCITE-6315:


These template patterns are supported by PostgreSQL 14 and are missing from 
Calcite. PostgreSQL 14 supports all of the template patterns in Calcite.
 * HH
 * US
 * 
 * S
 * AM
 * A.M.
 * am
 * a.m.
 * PM
 * P.M.
 * pm
 * p.m.
 * Y,YYY
 * YYY
 * Y
 * IYYY
 * IYY
 * IY
 * I
 * BC
 * B.C.
 * bc
 * b.c.
 * AD
 * A.D.
 * ad
 * a.d.
 * MONTH
 * month
 * MON
 * mon
 * DAY
 * day
 * Dy
 * dy
 * IDDD
 * ID
 * TZH
 * TZM
 * OF

[Calcite PostgreSQL template 
patterns|https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/util/format/FormatModels.java#L148]

[PostgreSQL 14 template 
patterns|https://www.postgresql.org/docs/14/functions-formatting.html#FUNCTIONS-FORMATTING-DATETIME-TABLE]

> Support PostgreSQL TO_CHAR, TO_DATE, TO_TIMESTAMP
> -
>
> Key: CALCITE-6315
> URL: https://issues.apache.org/jira/browse/CALCITE-6315
> Project: Calcite
>  Issue Type: Sub-task
>Reporter: James Duong
>Priority: Minor
>
> PostgreSQL supports different format strings than the version we have 
> implemented.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)