Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Handle epoch field in string format #2489

Open
penghuo opened this issue Jan 29, 2024 · 1 comment
Open

[FEATURE] Handle epoch field in string format #2489

penghuo opened this issue Jan 29, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@penghuo
Copy link
Collaborator

penghuo commented Jan 29, 2024

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.

@penghuo penghuo added enhancement New feature or request untriaged and removed untriaged labels Jan 29, 2024
@penghuo
Copy link
Collaborator Author

penghuo commented Jan 29, 2024

Related to PR, #1664

Using strict_date_optional_time||epoch_millis as default format instead of ""
https://github.com/opensearch-project/sql/pull/1664/files#diff-81e2e0d0405360026791ecce8e594e933fce50f3dc697217003f1b914dc2cff5R166

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant