File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed
main/java/org/elasticsearch/xpack/sql/type
test/java/org/elasticsearch/xpack/sql/type Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -235,6 +235,9 @@ Engine::
235235Ingest::
236236* Don't allow referencing the pattern bank name in the pattern bank {pull}29295[#29295] (issue: {issue}29257[#29257])
237237
238+ SQL::
239+ * Fix parsing of Dates containing milliseconds ({pull}30419[#30419])
240+
238241[float]
239242=== Regressions
240243Fail snapshot operations early when creating or deleting a snapshot on a repository that has been
@@ -395,6 +398,8 @@ tries to write the status field twice.
395398see
396399{stack-ov}/input-chain.html#_transforming_chained_input_data[Transforming Chained Input Data].
397400
401+ SQL::
402+ * Fix parsing of Dates containing milliseconds ({pull}30419[#30419])
398403
399404Allocation::
400405
@@ -484,6 +489,9 @@ fixes issues with HTTPS requests that tried to access proxies via HTTP.
484489(`xpack.notification.email.html.sanitization.*`), which were broken in 6.2. For
485490more information, see <<notification-settings>>.
486491
492+ SQL::
493+ * Fix parsing of Dates containing milliseconds ({pull}30419[#30419])
494+
487495//[float]
488496//=== Regressions
489497
Original file line number Diff line number Diff line change 3131 */
3232public abstract class DataTypeConversion {
3333
34- private static final DateTimeFormatter UTC_DATE_FORMATTER = ISODateTimeFormat .dateTimeNoMillis ().withZoneUTC ();
34+ private static final DateTimeFormatter UTC_DATE_FORMATTER = ISODateTimeFormat .dateOptionalTimeParser ().withZoneUTC ();
3535
3636 /**
3737 * Returns the type compatible with both left and right types
Original file line number Diff line number Diff line change @@ -82,10 +82,15 @@ public void testConversionToDate() {
8282 Conversion conversion = DataTypeConversion .conversionFor (DataType .KEYWORD , to );
8383 assertNull (conversion .convert (null ));
8484
85- // TODO we'd like to be able to optionally parse millis here I think....
8685 assertEquals (new DateTime (1000L , DateTimeZone .UTC ), conversion .convert ("1970-01-01T00:00:01Z" ));
8786 assertEquals (new DateTime (1483228800000L , DateTimeZone .UTC ), conversion .convert ("2017-01-01T00:00:00Z" ));
8887 assertEquals (new DateTime (18000000L , DateTimeZone .UTC ), conversion .convert ("1970-01-01T00:00:00-05:00" ));
88+
89+ // double check back and forth conversion
90+ DateTime dt = DateTime .now (DateTimeZone .UTC );
91+ Conversion forward = DataTypeConversion .conversionFor (DataType .DATE , DataType .KEYWORD );
92+ Conversion back = DataTypeConversion .conversionFor (DataType .KEYWORD , DataType .DATE );
93+ assertEquals (dt , back .convert (forward .convert (dt )));
8994 Exception e = expectThrows (SqlIllegalArgumentException .class , () -> conversion .convert ("0xff" ));
9095 assertEquals ("cannot cast [0xff] to [Date]:Invalid format: \" 0xff\" is malformed at \" xff\" " , e .getMessage ());
9196 }
You can’t perform that action at this time.
0 commit comments