sql icon indicating copy to clipboard operation
sql copied to clipboard

[BUG] PPL does not support querying Alias fields

Open ashwin-pc opened this issue 1 year ago • 2 comments

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?

  • OS: [e.g. iOS]
  • Version [e.g. 22]
  • Plugins

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.

ashwin-pc avatar Oct 11 '24 17:10 ashwin-pc

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

penghuo avatar Oct 12 '24 03:10 penghuo

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
}

xinyual avatar Oct 14 '24 01:10 xinyual