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] Add support for alias field type #3201

Open
dai-chen opened this issue Dec 12, 2024 · 0 comments
Open

[FEATURE] Add support for alias field type #3201

dai-chen opened this issue Dec 12, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@dai-chen
Copy link
Collaborator

dai-chen commented Dec 12, 2024

Is your feature request related to a problem?

Currently PPL query does not support fields of alias type. When an alias field is used in a PPL query, it results in a "field not found" semantic error as below:

# Index mapping:
{
  "mappings": {
    "properties": {
      "@gender": {
        "type": "alias",
        "path": "gender"
      },
      "gender": {
        "type": "text",
        "fielddata": true
      },

# IT
  @Test
  public void testFieldsWithOneField() throws IOException {
    JSONObject result =
        executeQuery(String.format("source=%s | fields @gender", TEST_INDEX_ACCOUNT));
    verifyColumn(result, columnName("firstname"));
  }

# Error message
method [POST], host [http://127.0.0.1:62157], URI [/_plugins/_ppl], status line [HTTP/1.1 400 Bad Request]
{
  "error": {
    "reason": "Invalid Query",
    "details": "can't resolve Symbol(namespace=FIELD_NAME, name=@gender) in type env",
    "type": "SemanticCheckException"
  },
  "status": 400
}

What solution would you like?

Add alias field name to symbol table when analyzing the query to avoid such semantic error.

What alternatives have you considered?

Keep current behavior and document the limitation.

Do you have any additional context?

N/A

@dai-chen dai-chen added enhancement New feature or request untriaged and removed untriaged labels Dec 12, 2024
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