PFUN-29359 - Fix for DateOnly fields stored as DateTime
QueryApi aims at providing a data access layer abstraction that output the right data type for each field of exposed domain entities.
We have identified a data type bug for some fields that are stored in the database as DateTime objects (timestamps) but are actually representing date only values. In other words, in the database those timestamps have always time values set to 00:00:00.000 while the CE should only get and handle date only values.
This incorrect output type should be corrected as soon as possible
in order to keep a consistent, predictable and easy to use QueryApi
to avoid any unexpected bug that may happen if the actual value stored in the database contains non zero time values while the CE is making the contrary assumption.
This is a data type bug impacting v14 that is planned to be fixed on v14.3.5 and v15 (https://pricefx.atlassian.net/browse/PFUN-29359).
Bug fix description
Impacted Tables and Fields
RebateLineItems:
startDate,endDate,payoutDateContractLineItems:
startDate,endDateCompensationLineItems:
startDate,endDate,payoutDateRebateRecords:
startDate,endDate,payoutDateCompensationRecords:
startDate,endDateConditionRecords:
validFrom,validToPriceLists:
expiryDate,targetDatePriceGrids:
targetDateCalculationGrids:
targetDate
Bug fix impact
Before the bug fix, impacted fields
Would be treated during query execution as
datetimevaluesWould result as
org.joda.time.DateTimeobjects.
After the bug fix, impacted fields
Would be treated during query execution as
datevaluesWould result as
java.time.LocalDateobjects
Feature flag to disable this fix
As this fix could be impactful on already existing logics and queries, a new feature flag has been introduced to keep the original QueryApi behavior.
To disable this fix, add a new entry, in the advanced configuration options, having
nameset toqueryApiDisableDateOnlyFieldsStoredAsDateTimeConversionand
valueset totrue
Before setting this feature flag, ensure that all the potentially impacted fields do not have attribute meta configured with fieldType = DATE (only). See troubleshooting section if that’s the case.
Troubleshooting
Some partitions that where already using those fields have already been configured with this Feature Flag.
If in those partitions, if such a field has been configured with attribute meta field type set to DATE (only) then Query API should throw the following exception:
Invalid metadata configuration for PrimitiveColumn in table XXXX and column XXX. Conversion from DATE_TIME to DATE_ONLY not supported
In that case, that’s meaning that this field was actually configured to be used and displayed as a Date Only and so there is no need to keep the initial behavior that was providing this field as a DateTime. Two solution:
Either disable the
queryApiDisableDateOnlyFieldsStoredAsDateTimeConversionfeature flag (prefered option).or Set DATE_TIME type in the attribute meta configuration.
Found an issue in documentation? Write to us.