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

Istvan Toth commented on PHOENIX-6902:
--------------------------------------

I was looking at this more closely.
Seems like maintaining full backwards compatibility while dropping joda time 
and fastdatetime would be very hard.
- java.time makes using non-ISO chronologies intentionally difficult
- java.time doesn't support halfEven rounding, which Phoenix does use.

Phoenix using half even rounding is a bad idea anyway (and is buggy in many 
ways until 5.1.3 )
However, we know at least some users have pre-cutover dates stored in their 
databases.

Looking at this mess, I think that the easiest way forward is:

Factor out all chronology specific operations into a pluggalble class (probably 
DateUtil)
Keep the current implementation with GJChronology,  joda, java.sql, halfeven 
rounding, and all its other warts as an option for backwards compatibility.
Create a new implementation based purely on ISO chronology and java.time based 
on truncation.

This unfortunately doesn't let us remove the joda and fastdatetime 
dependencies, but solves the other problems and leaves a way out for 
applications depending on the old Phoenix  behaviour.

Unfortunately, this has both server and client side implications, so this will 
have to be a cluster-wide parameter.

> Switch to ISOChronology or make it configurable
> -----------------------------------------------
>
>                 Key: PHOENIX-6902
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6902
>             Project: Phoenix
>          Issue Type: Bug
>          Components: core
>            Reporter: Istvan Toth
>            Assignee: Istvan Toth
>            Priority: Major
>
> Phoenix has historically used the default java.util.GregorianCalendar , and 
> its Joda implementation, org.joda.time.chrono.GJChronology.
> However, both the SQL standard, and the modern java.time library uses 
> ISOChronology.
> Either switch to ISOChronology, or preferably add an option to switch between 
> GregorianCalendar and ISOChronology.
> AFAIU this would have to be a system-wide config.
> This is closely related to switching to the java.time API internally.



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

Reply via email to