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

Better document limitation on Array support. #442

Open
penghuo opened this issue Feb 21, 2022 · 4 comments
Open

Better document limitation on Array support. #442

penghuo opened this issue Feb 21, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@penghuo
Copy link
Collaborator

penghuo commented Feb 21, 2022

Is your feature request related to a problem? Please describe.
Document current limitation on Array support.
https://github.com/opensearch-project/sql/blob/main/opensearch/src/main/java/org/opensearch/sql/opensearch/data/utils/OpenSearchJsonContent.java#L132

@penghuo penghuo added the enhancement New feature or request label Feb 21, 2022
@penghuo
Copy link
Collaborator Author

penghuo commented Feb 21, 2022

Similar issue. #235

@ps48
Copy link
Member

ps48 commented Apr 19, 2022

@penghuo Adding one example for documentation. SQL plugin doesn't support arrays and array of objects. It returns just the first element for the both types.

Indexed Doc

PUT my-index-000001/_doc/1
{
  "message": "some arrays in this document...",
  "tags":  [ "opensearch", "wow" ], 
  "lists": [ 
    {
      "name": "prog_list",
      "description": "programming list"
    },
    {
      "name": "cool_list",
      "description": "cool stuff list"
    }
  ]
}

SQL Query, Response

select * from my-index-000001

{
  "schema": [
    {
      "name": "message",
      "type": "text"
    },
    {
      "name": "lists",
      "type": "object"
    },
    {
      "name": "tags",
      "type": "text"
    }
  ],
  "datarows": [
    [
      "some arrays in this document...",
      {
        "name": "prog_list",
        "description": "programming list"
      },
      "opensearch"
    ]
  ],
  "total": 1,
  "size": 1,
  "status": 200
}

@dai-chen
Copy link
Collaborator

Just for reference: Presto/Trino supports array type by asking user to specific it in index mapping: https://trino.io/docs/current/connector/elasticsearch.html#array-types

@Yury-Fridlyand
Copy link
Collaborator

Yury-Fridlyand commented Oct 5, 2022

// Fall back to old engine too if type is not supported semantically
if (isTypeNotSupported(ref.type())) {
throw new SyntaxCheckException(String.format(
"Identifier [%s] of type [%s] is not supported yet", ident, ref.type()));
}
return ref;
}
// Array type is not supporte yet.
private boolean isTypeNotSupported(ExprType type) {
return "array".equalsIgnoreCase(type.typeName());
}

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

4 participants