[FEATURE] Handle epoch field in string format
Is your feature request related to a problem? SQL query field if origin date field in string format (epoch value).
A) Create index
PUT sample-index
B) Put index mapping :
PUT /sample-index/_mapping
{
"properties": {
"message": {
"properties":{
"timestamp_received":{
"type":"date"
}
}
}
}
}
Kindly note we have not provided any format (like "strict_date_optional_time" or "epoch_millis") type in above mapping
C) Inserted the doc :
POST sample-index/_doc/1
{
"message" : {
"timestamp_received" : "1705642934886"
}
}
D) Try running SQL query :
POST _plugins/_sql
{
"query" : "SELECT message.timestamp_received FROM sample-index"
}
{
"error": {
"type": "IllegalStateException",
"reason": "There was internal problem at backend",
"details": "Construct ExprTimestampValue from \"1705642934886\" failed, unsupported date format."
},
"status": 503
}
What solution would you like? Query should works as epoch value in long format.
What alternatives have you considered? n/a
Do you have any additional context? Add any other context or screenshots about the feature request here.
Related to PR, https://github.com/opensearch-project/sql/pull/1664/
Using strict_date_optional_time||epoch_millis as default format instead of ""
https://github.com/opensearch-project/sql/pull/1664/files#diff-81e2e0d0405360026791ecce8e594e933fce50f3dc697217003f1b914dc2cff5R166