Skip to content

[BUG] Field of Alias type in PPL does not work as expected #3646

Closed

Description

@qianheng-aws

What is the bug?
For field of alias type maps to a nested field, it cannot work as expected.

How can one reproduce the bug?

  1. Create index with mapping:
PUT /test
{
  "mappings": {
      "properties": {
        "log": {
          "properties": {
            "url": {
              "properties": {
                "message": {
                  "type": "text",
                  "fields": {
                    "keyword": {
                      "type": "keyword",
                      "ignore_above": 256
                    }
                  }
                },
                "time": {
                  "type": "long"
                }
              }
            }
          }
        },
        "message_alias": {
            "type": "alias",
            "path": "log.url.message"
          
        },
        "time_alias": {
           "type": "alias",
            "path": "log.url.time"
        }
      }
    }
}
  1. Add doc:
POST /test/_doc
{"log": {"url": {"message": "/e2e/h/zap", "time": 1} } }
  1. query source=test | where message_alias = "/e2e/h/zap" failed with exception:
Caused by: java.lang.IllegalStateException: Cannot find the path [log.url.message] for alias type field [message_alias]
        at org.opensearch.sql.opensearch.data.type.OpenSearchDataType.lambda$parseMapping$4(OpenSearchDataType.java:142) ~[?:?]
        at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:986) ~[?:?]
        at org.opensearch.sql.opensearch.data.type.OpenSearchDataType.parseMapping(OpenSearchDataType.java:136) ~[?:?]
        at org.opensearch.sql.opensearch.mapping.IndexMapping.<init>(IndexMapping.java:32) ~[?:?]
        at org.opensearch.sql.opensearch.client.OpenSearchNodeClient.lambda$getIndexMappings$2(OpenSearchNodeClient.java:92) ~[?:?]
        at java.base/java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:180) ~[?:?]
        at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) ~[?:?]
        at java.base/java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet.lambda$entryConsumer$0(Collections.java:1778) ~[?:?]
        at java.base/java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1858) ~[?:?]
        at java.base/java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$UnmodifiableEntrySetSpliterator.forEachRemaining(Collections.java:1803) ~[?:?]
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[?:?]
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[?:?]

Activity

  1. added
    bug
    PPL
    on May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    PPLbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions