JackieTien97 opened a new pull request, #16285: URL: https://github.com/apache/iotdb/pull/16285
This pull request refactors how timestamp precision is handled throughout the codebase, moving from static final variables to dynamic configuration and initialization. The main goal is to ensure that changes to timestamp precision in configuration are correctly reflected at runtime, improving flexibility and correctness. The changes also introduce getter methods for timestamp extraction functions and update related usages. **Dynamic timestamp precision handling and initialization:** * Refactored `DateTimeUtils` to replace static final variables (e.g., `TIMESTAMP_PRECISION`, extraction functions) with dynamically-initialized fields and added an `initTimestampPrecision()` method to update precision and related functions at runtime. Getter methods for extraction functions were also introduced. [[1]](diffhunk://#diff-d293044a0e71ea2351513a8ed6e20190e1ed1596c2757c42fe179126d7ee1dfcL62-R66) [[2]](diffhunk://#diff-d293044a0e71ea2351513a8ed6e20190e1ed1596c2757c42fe179126d7ee1dfcL83-R145) [[3]](diffhunk://#diff-d293044a0e71ea2351513a8ed6e20190e1ed1596c2757c42fe179126d7ee1dfcL790-R820) [[4]](diffhunk://#diff-d293044a0e71ea2351513a8ed6e20190e1ed1596c2757c42fe179126d7ee1dfcL927-R952) * Updated all usages of timestamp precision and extraction functions in `PlanGraphPrinter`, `DateBinFunctionColumnTransformer`, and `ExtractTransformer` to use the new dynamic approach and getter methods instead of static constants. [[1]](diffhunk://#diff-2c4ba0e66962931f88ae3e7baeae36cf2f35dc9565a3f0fa4e8fe550deac81dfL840-R843) [[2]](diffhunk://#diff-6305624a6309fe575824478b8010ec68c38ebb22f777661699ef252c89f378b0L65-R64) [[3]](diffhunk://#diff-6305624a6309fe575824478b8010ec68c38ebb22f777661699ef252c89f378b0L80-R81) [[4]](diffhunk://#diff-6305624a6309fe575824478b8010ec68c38ebb22f777661699ef252c89f378b0L92-R93) [[5]](diffhunk://#diff-6305624a6309fe575824478b8010ec68c38ebb22f777661699ef252c89f378b0L101-R119) [[6]](diffhunk://#diff-a0cccdced4aa4317fe4133e48dafd797198e9f004ffc7e81d8a835ca281a18eaL34-R37) [[7]](diffhunk://#diff-a0cccdced4aa4317fe4133e48dafd797198e9f004ffc7e81d8a835ca281a18eaL75-R79) **Initialization and configuration:** * Ensured that `initTimestampPrecision()` is called during system configuration initialization in `DataNode`, guaranteeing that the timestamp precision and related functions are set up correctly at startup. [[1]](diffhunk://#diff-61bde9bbfe133b3e02f980faa06010a7f1dd5ea7f7417bd0bcad6375727878efR140) [[2]](diffhunk://#diff-61bde9bbfe133b3e02f980faa06010a7f1dd5ea7f7417bd0bcad6375727878efR396-R398) **Imports and code cleanup:** * Updated imports in affected files to reflect the new approach, removing unused static imports and adding necessary ones for the new methods. [[1]](diffhunk://#diff-2c4ba0e66962931f88ae3e7baeae36cf2f35dc9565a3f0fa4e8fe550deac81dfR23) [[2]](diffhunk://#diff-2c4ba0e66962931f88ae3e7baeae36cf2f35dc9565a3f0fa4e8fe550deac81dfL102) [[3]](diffhunk://#diff-6305624a6309fe575824478b8010ec68c38ebb22f777661699ef252c89f378b0R22) [[4]](diffhunk://#diff-6305624a6309fe575824478b8010ec68c38ebb22f777661699ef252c89f378b0L35-L36) These changes improve the maintainability and correctness of timestamp handling, making the system more robust to configuration changes. -- 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]
