[ 
https://issues.apache.org/jira/browse/CALCITE-7344?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18047200#comment-18047200
 ] 

xiong duan commented on CALCITE-7344:
-------------------------------------

According to your records, could there be an issue with the Coordinates format? 
Should be
{code:java}
"coordinates": "{'127.0.0.1': 9200}"{code}

> An error is reported when you connect to Elasticsearch according to the 
> tutorial.
> ---------------------------------------------------------------------------------
>
>                 Key: CALCITE-7344
>                 URL: https://issues.apache.org/jira/browse/CALCITE-7344
>             Project: Calcite
>          Issue Type: Bug
>          Components: elasticsearch-adapter
>    Affects Versions: 1.33.0
>         Environment: cat /etc/os-release
> NAME="openEuler"
> VERSION="24.03 (LTS-SP2)"
> ID="openEuler"
> VERSION_ID="24.03"
> PRETTY_NAME="openEuler 24.03 (LTS-SP2)"
> ANSI_COLOR="0;31"
>            Reporter: liwei
>            Priority: Major
>
> 1、spack install --overwrite --keep-stage --no-checksum -y [email protected] 
> [email protected]  [email protected]
> 2、https://calcite.apache.org/docs/elasticsearch_adapter.html
> sqlline version 1.12.0
> sqlline> !connect 
> jdbc:calcite:model=/home/stage/root/spack-stage-calcite-1.33.0-mgls2fo7gqgwwqmdbswbghyi5mpf25df/spack-src/elasticsearch/src/test/resources/test-model.json
>  admin admin
> !connect jdbc:calcite:model=/home/stage/root/spack-stage-calcite-1.33.0       
>  st-model.json admin 
> admini5mpf25df/spack-src/elasticsearch/src/test/resources/tes
> log4j:WARN No appenders could be found for logger 
> (org.apache.calcite.adapter.elasticsearch.ElasticsearchSchemaFactory).
> log4j:WARN Please initialize the log4j system properly.
> log4j:WARN See [http://logging.apache.org/log4j/1.2/faq.html#noconfig] for 
> more info.
> java.lang.RuntimeException: Error instantiating 
> JsonCustomSchema(name=elasticsearch)
>         at org.apache.calcite.model.ModelHandler.visit(ModelHandler.java:277)
>         at 
> org.apache.calcite.model.JsonCustomSchema.accept(JsonCustomSchema.java:66)
>         at org.apache.calcite.model.ModelHandler.visit(ModelHandler.java:200)
>         at org.apache.calcite.model.ModelHandler.<init>(ModelHandler.java:106)
>         at org.apache.calcite.jdbc.Driver$1.onConnectionInit(Driver.java:101)
>         at 
> org.apache.calcite.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:139)
>         at sqlline.DatabaseConnection.connect(DatabaseConnection.java:135)
>         at 
> sqlline.DatabaseConnection.getConnection(DatabaseConnection.java:192)
>         at sqlline.Commands.connect(Commands.java:1487)
>         at sqlline.Commands.connect(Commands.java:1361)
>         at 
> java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
>         at java.base/java.lang.reflect.Method.invoke(Method.java:580)
>         at 
> sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:44)
>         at sqlline.SqlLine.dispatch(SqlLine.java:818)
>         at sqlline.SqlLine.begin(SqlLine.java:596)
>         at sqlline.SqlLine.start(SqlLine.java:269)
>         at sqlline.SqlLine.main(SqlLine.java:208)
> Caused by: java.lang.NullPointerException: at index 1
>         at 
> com.google.common.collect.ObjectArrays.checkElementNotNull(ObjectArrays.java:229)
>         at 
> com.google.common.collect.ObjectArrays.checkElementsNotNull(ObjectArrays.java:219)
>         at 
> com.google.common.collect.ObjectArrays.checkElementsNotNull(ObjectArrays.java:213)
>         at 
> com.google.common.collect.ImmutableList.construct(ImmutableList.java:353)
>         at com.google.common.collect.ImmutableList.of(ImmutableList.java:127)
>         at 
> org.apache.calcite.adapter.elasticsearch.ElasticsearchSchemaFactory.connect(ElasticsearchSchemaFactory.java:160)
>         at 
> org.apache.calcite.adapter.elasticsearch.ElasticsearchSchemaFactory.create(ElasticsearchSchemaFactory.java:136)
>         at org.apache.calcite.model.ModelHandler.visit(ModelHandler.java:272)
>         ... 16 more
>  
>  
> cat 
> /home/stage/root/spack-stage-calcite-1.33.0-mgls2fo7gqgwwqmdbswbghyi5mpf25df/spack-src/elasticsearch/src/test/resources/test-model.json
> {
>   "version": "1.0",
>   "defaultSchema": "elasticsearch",
>   "schemas": [
>     {
>       "type": "custom",
>       "name": "elasticsearch",
>       "factory": 
> "org.apache.calcite.adapter.elasticsearch.ElasticsearchSchemaFactory",
>       "operand":
> {         "coordinates": "\\{'127.0.0.1': 9200}
> "
>       }
>     }
>   ]
> }
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to