opensearch-project / sql

Query your data using familiar SQL or intuitive Piped Processing Language (PPL)
https://opensearch.org/docs/latest/search-plugins/sql/index/
Apache License 2.0
120 stars 139 forks source link

[BUG] PPL does not support querying Alias fields #3069

Open ashwin-pc opened 1 month ago

ashwin-pc commented 1 month ago

What is the bug? When querying using PPL but there is an alias field in the filter clause. The query fails.

How can one reproduce the bug? Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

What is the expected behavior? A clear and concise description of what you expected to happen.

What is your host/environment?

Do you have any screenshots? If applicable, add screenshots to help explain your problem.

Do you have any additional context? Add any other context about the problem.

penghuo commented 1 month ago

could u add more context? sample query and sample data to reporduce the issue.

xinyual commented 1 month ago

I can provide a sample

PUT /try
{
    "mappings":{
        "properties": {
            "time1": {
                "type": "date"
            },
            "time2": {
                "type": "alias",
                "path": "time1"
            }
        }
    }
}
POST /_plugins/_ppl/
{
    "query": "source=try | fields `time2`"
}

It shows

{
  "error": {
    "reason": "Invalid Query",
    "details": "can't resolve Symbol(namespace=FIELD_NAME, name=time2) in type env",
    "type": "SemanticCheckException"
  },
  "status": 400
}