guluo created CALCITE-6386:
------------------------------
Summary: NPE when using ES adapter with model.json and no
specified username, password or pathPrefix
Key: CALCITE-6386
URL: https://issues.apache.org/jira/browse/CALCITE-6386
Project: Calcite
Issue Type: Bug
Components: elasticsearch-adapter
Affects Versions: 1.36.0
Reporter: guluo
Reproduction steps:
1 Creating model.json, according to the calcite doc about [Elasticsearch
adapter (apache.org)|https://calcite.apache.org/docs/elasticsearch_adapter.html]
{
"version": "1.0",
"defaultSchema": "elasticsearch",
"schemas": [
{
"type": "custom",
"name": "elasticsearch",
"factory":
"org.apache.calcite.adapter.elasticsearch.ElasticsearchSchemaFactory",
"operand": {
"coordinates": "\{'127.0.0.1': 9200}"
}
}
]
}
2 Connecting es by sqlline
sqlline> !connect jdbc:calcite:model=/root/build/calcite//model.json
3 We would get NPE,as follow.
Caused by: java.lang.NullPointerException: at index 1
at
com.google.common.collect.ObjectArrays.checkElementNotNull(ObjectArrays.java:232)
at
com.google.common.collect.ObjectArrays.checkElementsNotNull(ObjectArrays.java:222)
at
com.google.common.collect.ObjectArrays.checkElementsNotNull(ObjectArrays.java:216)
at com.google.common.collect.ImmutableList.construct(ImmutableList.java:354)
at com.google.common.collect.ImmutableList.of(ImmutableList.java:128)
at
org.apache.calcite.adapter.elasticsearch.ElasticsearchSchemaFactory.connect(ElasticsearchSchemaFactory.java:202)
at
org.apache.calcite.adapter.elasticsearch.ElasticsearchSchemaFactory.create(ElasticsearchSchemaFactory.java:176)
at org.apache.calcite.model.ModelHandler.visit(ModelHandler.java:275)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)