Skip to content

[FEATURE] Support wildcard in column names in V2 #1487

@Yury-Fridlyand

Description

@Yury-Fridlyand

Is your feature request related to a problem?

$ curl -s -XPOST http://localhost:9200/_plugins/_sql -H 'Content-Type: application/json' -d '{"query": "SELECT date* from calcs"}'  | jq
{
  "error": {
    "reason": "Invalid SQL query",
    "details": "can't resolve Symbol(namespace=FIELD_NAME, name=date*) in type env",
    "type": "SemanticCheckException"
  },
  "status": 400
}

What solution would you like?

$ curl -s -XPOST http://localhost:9200/_plugins/_sql -H 'Content-Type: application/json' -d '{"query": "SELECT date* from calcs limit 1", "legacy": 1}'  | jq
{
  "schema": [
    {
      "name": "datetime0",
      "type": "date"
    },
    {
      "name": "date3",
      "type": "date"
    },
    {
      "name": "datetime1",
      "type": "date"
    },
    {
      "name": "date2",
      "type": "date"
    },
    {
      "name": "date1",
      "type": "date"
    },
    {
      "name": "date0",
      "type": "date"
    }
  ],
  "total": 17,
  "datarows": [
    [
      "2004-07-09 10:17:35.000",
      "1986-03-20",
      null,
      "1977-04-20",
      "2004-04-01",
      "2004-04-15"
    ]
  ],
  "size": 1,
  "status": 200
}

What alternatives have you considered?
N/A

Do you have any additional context?
Don't resolve * (e.g. in SELECT *) to a list of column names, keep it as *.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions