Omega359 commented on PR #8886: URL: https://github.com/apache/arrow-datafusion/pull/8886#issuecomment-1899745153
It's possible to directly map most of the pg patterns to chrono patterns but not all. It's a pretty deep rabbit hole - pg supports Julian Day which chrono doesn't. PG also supports Era (AD/BC) whereas chrono only supports +- on year. Then there are escape characters of which backslash is allowed (but now discouraged <https://www.postgresql.org/docs/16/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS> = S4.1.2.2), you can define your own in unicode strings, and we would possibly have to handle all of the c-style escape sequences in the format. And heaven forbid if you have to parse or display any day/month text in anything but English. Want day 1 in a week to be Sunday in Chrono (numerous Muslim countries, Israel) ? Nope, you get day 0 - 6 instead (PG does 1-7 correctly). Or we just keep it simple for now :) On Thu, Jan 18, 2024 at 4:58 PM comphead ***@***.***> wrote: > Thanks @alamb <https://github.com/alamb> I would probably stick to PG > standard as we declared. The PR implementation is really cool, and we may > want to have a separate function for it? like from_chrono or something > > I had a thought for the future to allow for setting the format based on > either config or based on dialect. I was thinking that might be best left > to after the function refactor (#8045 > <https://github.com/apache/arrow-datafusion/issues/8045>) is done then > have separate implementations if desired. I just didn't want to write a > parser for the PG syntax as it's pretty detailed and just wanted to get > something out there. Someone else noted > <https://github.com/apache/arrow-datafusion/issues/5398#issuecomment-1820970911> > the complexity of implementing the PG syntax > > Do you have happen to have such a parser available? > > I'm not sure if its available, but we prob use your approach to create an > adapter to PG formatting? 🤔 > So you map PG formatting rules into chrono formatting rules > > — > Reply to this email directly, view it on GitHub > <https://github.com/apache/arrow-datafusion/pull/8886#issuecomment-1899288250>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AABXHUU5XOZ6ME4SMDBNXJDYPGLI5AVCNFSM6AAAAABB5MLLU6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJZGI4DQMRVGA> > . > You are receiving this because you were mentioned.Message ID: > ***@***.***> > -- Bruce Ritchie Principal Software Engineer Veeva Systems ***@***.*** <https://profiles.google.com/?hl=en&tab=mX> *Customer Master Simplified. Data, Software, and Services All-in-one with Veeva Network <http://www.veeva.com/customer-master/?utm_source=google&utm_medium=email%20signature&utm_campaign=Network%20Email%20Signature%20Link>* -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
