[
https://issues.apache.org/jira/browse/CALCITE-6386?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mihai Budiu resolved CALCITE-6386.
----------------------------------
Fix Version/s: 1.41.0
Resolution: Fixed
Fixed in
[https://github.com/apache/calcite/commit/a6973bde8107a7c2a605a82c779a64fe28bdb5d1]
Thank you for the contributions [~xuzifu666] [~guluo]
> Elasticsearch adapter throws NullPointerException when used with with
> model.json and no 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
> Assignee: Yu Xu
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.41.0
>
>
> 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)