Improve support for joda datetime to java datetime in Painless#83099
Improve support for joda datetime to java datetime in Painless#83099jdconrad merged 7 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
|
Hi @jdconrad, I've created a changelog YAML for you. |
|
@elasticmachine run elasticsearch-ci/packaging-tests-unix-sample |
| public static DayOfWeek getDayOfWeekEnum(ZonedDateTime receiver) { | ||
| return receiver.getDayOfWeek(); | ||
| } | ||
|
|
There was a problem hiding this comment.
I wonder if we should have a separate file or section these Augmentations that's simply unsupported.
There was a problem hiding this comment.
Seems like a good idea. I would want to do that in as a follow up, though.
| source: "/* avoid stash */ $('date', null).getCenturyOfEra()" | ||
| - match: { error.failed_shards.0.reason.caused_by.type: "unsupported_operation_exception" } | ||
| - match: { error.failed_shards.0.reason.caused_by.reason: | ||
| "joda method [getCenturyOfEra] is no longer available; use [<ZonedDateTime instance>.get(ChronoField.YEAR_OF_ERA) / 100] instead" } |
There was a problem hiding this comment.
For each of these suggestions, can you add a test that uses the suggestion right the test that suggests the alternative?
There was a problem hiding this comment.
Good call. Caught a pair of bugs for the week based suggestions!
|
Can you reference the change that deprecated these files in the commit? |
stu-elastic
left a comment
There was a problem hiding this comment.
These augments return the methods removed in #78417
* upstream/master: (100 commits) Avoid duplicate _type fields in v7 compat layer (elastic#83239) Bump bundled JDK to 17.0.2+8 (elastic#83243) [DOCS] Correct header syntax (elastic#83275) Add unit tests for indices.recovery.max_bytes_per_sec default values (elastic#83261) [DOCS] Add note that write indices are not replicated (elastic#82997) Add notes on indexing to kNN search guide (elastic#83188) Fix get-snapshot-api :docs:integTest (elastic#83273) FilterPathBasedFilter support match fieldname with dot (elastic#83178) Fix compilation issues in example-plugins (elastic#83258) fix ClusterStateListener javadoc (elastic#83246) Speed up Building Indices Lookup in Metadata (elastic#83241) Mute whole suite for elastic#82502 (elastic#83252) Make PeerFinder log messages happier (elastic#83222) [Docs] Add supported _terms_enum field types (elastic#83244) Add an aggregator for IPv4 and IPv6 subnets (elastic#82410) [CI] Fix 70_time_series/default sort yaml test failures (elastic#83217) Update test-failure Issue Template to include "needs:triage" label elastic#83226 Add an index->step cache to the PolicyStepsRegistry (elastic#82316) Improve support for joda datetime to java datetime transition in Painless (elastic#83099) Fix joda migration for week based methods in Painless (elastic#83232) ... # Conflicts: # x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/v2/TransportRollupAction.java
Within Painless, this change augments
TemporalAccessorwith the methodgetMillisto make milliseconds easier to access directly from a datetime within a document.This change also adds several methods from Joda datetimes augmented onto
ZonedDateTimethat throw anUnsupportedOperationExceptionwith a suggestion of how to implement that Joda method usingZonedDateTimeinstead. These methods include the following:getCenturyOfEragetEragetHourOfDaygetMillisOfDaygetMillisOfSecondgetMinuteOfDaygetMinuteOfHourgetMonthOfYeargetSecondOfDaygetSecondOfMinutegetWeekOfWeekyeargetWeekyeargetYearOfCenturygetYearOfEra