You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] SQL query doesn't support different date formats without date casting #2700
changed the title [-][BUG] SQL query doesn't allow different date formats without date casting[/-][+][BUG] SQL query doesn't support different date formats without date casting[/+]on May 30, 2024
We have one more similar issue reported from users when date in timestamp format in the SQL query is erroring out due to mismatch in the timestamp format between field mapping and the request query -
Sample query:
select count(*) from ami where State = 'available' and Public = 'true' and CallerVersion = "2016-11-15 00:00:00";
select count(*) from ami where State = 'available' and Public = 'true' and CallerVersion < "2016-11-15 00:00:00";
Error -
[INFO] 10f0cef3-4159-4c39-84e1-f4ba8b88be97 (Bobcat-29) com.amazonaws.fleetinsightsopensearchcommons.helper.ResponseConvertor: Original SQL response : {
"error": {
"reason": "Error occurred in OpenSearch engine: all shards failed",
"details": "Shard[0]: OpenSearchParseException[failed to parse date field [2016-11-15 00:00:00] with format [strict_date_optional_time||epoch_millis]: [failed to parse date field [2016-11-15 00:00:00] with format [strict_date_optional_time||epoch_millis]]]; nested: IllegalArgumentException[failed to parse date field [2016-11-15 00:00:00] with format [strict_date_optional_time||epoch_millis]]; nested: NotSerializableExceptionWrapper[date_time_parse_exception: Failed to parse with all enclosed parsers];\nShard[1]: OpenSearchParseException[failed to parse date field [2016-11-15 00:00:00] with format [strict_date_optional_time||epoch_millis]: [failed to parse date field [2016-11-15 00:00:00] with format [strict_date_optional_time||epoch_millis]]]; nested: IllegalArgumentException[failed to parse date field [2016-11-15 00:00:00] with format [strict_date_optional_time||epoch_millis]]; nested: NotSerializableExceptionWrapper[date_time_parse_exception: Failed to parse with all enclosed parsers];\nShard[2]: OpenSearchParseException[failed to parse date field [2016-11-15 00:00:00] with format [strict_date_optional_time||epoch_millis]: [failed to parse date field [2016-11-15 00:00:00] with format [strict_date_optional_time||epoch_millis]]]; nested: IllegalArgumentException[failed to parse date field [2016-11-15 00:00:00] with format [strict_date_optional_time||epoch_millis]]; nested: NotSerializableExceptionWrapper[date_time_parse_exception: Failed to parse with all enclosed parsers];\nShard[3]: OpenSearchParseException[failed to parse date field [2016-11-15 00:00:00] with format [strict_date_optional_time||epoch_millis]: [failed to parse date field [2016-11-15 00:00:00] with format [strict_date_optional_time||epoch_millis]]]; nested: IllegalArgumentException[failed to parse date field [2016-11-15 00:00:00] with format [strict_date_optional_time||epoch_millis]]; nested: NotSerializableExceptionWrapper[date_time_parse_exception: Failed to parse with all enclosed parsers];\nShard[4]: OpenSearchParseException[failed to parse date field [2016-11-15 00:00:00] with format [strict_date_optional_time||epoch_millis]: [failed to parse date field [2016-11-15 00:00:00] with format [strict_date_optional_time||epoch_millis]]]; nested: IllegalArgumentException[failed to parse date field [2016-11-15 00:00:00] with format [strict_date_optional_time||epoch_millis]]; nested: NotSerializableExceptionWrapper[date_time_parse_exception: Failed to parse with all enclosed parsers];\n\nFor more details, please send request for Json format to see the raw response from OpenSearch engine.",
"type": "SearchPhaseExecutionException"
},
"status": 400
}
Root cause -
Currently for response JDBC format, when term/range query has timestamp field in the sql query, by default we are converting timestamps to epoch time in milliseconds when building query for Opensearch DSL which is causing the above exceptions. Instead for timestamp query string in epoch, we should send parsed formatted timestamp string as it is as part of the query similar to Date format.
Activity
[-][BUG] SQL query doesn't allow different date formats without date casting[/-][+][BUG] SQL query doesn't support different date formats without date casting[/+]Fix to support different date formats in the sql query without date c…
manasvinibs commentedon Jun 20, 2024
We have one more similar issue reported from users when date in timestamp format in the SQL query is erroring out due to mismatch in the timestamp format between field mapping and the request query -
Sample query:
Error -
Root cause -
Currently for response JDBC format, when term/range query has timestamp field in the sql query, by default we are converting timestamps to epoch time in milliseconds when building query for Opensearch DSL which is causing the above exceptions. Instead for timestamp query string in epoch, we should send parsed formatted timestamp string as it is as part of the query similar to Date format.
Fixing this issue as part of this PR #2765
Fix to support different date formats in the sql query without date c…
Fix to support different date formats in the sql query without date c…
Add support for custom date format and openSearch date format for dat…
Add support for custom date format and openSearch date format for dat…
Add support for custom date format and openSearch date format for dat…
Add support for custom date format and openSearch date format for dat…
Add support for custom date format and openSearch date format for dat…
Add support for custom date format and openSearch date format for dat…
10 remaining items
Add support for custom date format and openSearch date format for dat…
Add support for custom date format and openSearch date format for dat…
Add support for custom date format and openSearch date format for dat…
Add support for custom date format and openSearch date format for dat…
Add support for custom date format and openSearch date format for dat…
Add support for custom date format and openSearch date format for dat…
Add support for custom date format and openSearch date format for dat…
Add support for custom date format and openSearch date format for dat…
Add support for custom date format and openSearch date format for dat…
Add support for custom date format and openSearch date format for dat…
Add support for custom date format and openSearch date format for dat…
aalva500-prog commentedon Sep 12, 2025
Was this issue fixed here: #2762? Is it okay to close it?
Fix temporal coercion issues (opensearch-project#2437, opensearch-pro…
songkant-aws commentedon Apr 10, 2026
Verified the issue is already fixed by #2762 locally, closing the issue.