We should not be using Preconditions.checkState to check for these conditions
IllegalArgumentException is preferred ? On Tue, Feb 5, 2019 at 12:50 PM Julian Hyde <[email protected]> wrote: > Looks good. > > One remark about your change: a missing property, e.g. "'coordinates' is > missing in configuration”, is a user error. We should not be using > Preconditions.checkState to check for these conditions, because that is for > internal (coding) errors. > > > https://github.com/apache/calcite/pull/1028/files#diff-b75b1ca5d0ef9f9b6b1aa37ffafcf2d0R58 > < > https://github.com/apache/calcite/pull/1028/files#diff-b75b1ca5d0ef9f9b6b1aa37ffafcf2d0R58> > > > > > On Feb 5, 2019, at 8:26 AM, Andrei Sereda <[email protected]> wrote: > > > > I have removed userConfig from ElasticsearchSchemaFactory. It is not used > > anymore. > > > > https://github.com/apache/calcite/pull/1028 > > > > On Mon, Feb 4, 2019 at 2:34 PM Michael Mior <[email protected]> wrote: > > > >> This looks like a bug. Could you try adding another key "userConfig": > >> "{}" under "operand" in your model file and see if that runs? > >> -- > >> Michael Mior > >> [email protected] > >> > >> > >> Le lun. 4 févr. 2019 à 14:29, Allan Keers <[email protected]> a > >> écrit : > >>> > >>> Hi there, > >>> I can connect my Calcite installation to the sample csv and query the > >> tables. > >>> When I try to connect to Elasticsearch I get the following error. > >>> Any help would be appreciated. > >>> Thanks, > >>> Allan Keers > >>> > >>> > >>> sqlline version 1.6.0 > >>> > >>> sqlline> !connect > >> > jdbc:calcite:model=/Users/Administrator/dev/calcite/elasticsearch/elasticsearch.json > >> admin admin > >>> > >>> java.lang.RuntimeException: Error instantiating > >> JsonCustomSchema(name=elasticsearch) > >>> > >>> at org.apache.calcite.model.ModelHandler.visit(ModelHandler.java:287) > >>> > >>> at > >> > org.apache.calcite.model.JsonCustomSchema.accept(JsonCustomSchema.java:45) > >>> > >>> at org.apache.calcite.model.ModelHandler.visit(ModelHandler.java:208) > >>> > >>> at org.apache.calcite.model.ModelHandler.<init>(ModelHandler.java:100) > >>> > >>> at org.apache.calcite.jdbc.Driver$1.onConnectionInit(Driver.java:104) > >>> > >>> at > >> > org.apache.calcite.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:139) > >>> > >>> at sqlline.DatabaseConnection.connect(DatabaseConnection.java:130) > >>> > >>> at > sqlline.DatabaseConnection.getConnection(DatabaseConnection.java:179) > >>> > >>> at sqlline.Commands.connect(Commands.java:1247) > >>> > >>> at sqlline.Commands.connect(Commands.java:1139) > >>> > >>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > >>> > >>> at > >> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > >>> > >>> at > >> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > >>> > >>> at java.lang.reflect.Method.invoke(Method.java:498) > >>> > >>> at > >> > sqlline.ReflectiveCommandHandler.execute(ReflectiveCommandHandler.java:38) > >>> > >>> at sqlline.SqlLine.dispatch(SqlLine.java:722) > >>> > >>> at sqlline.SqlLine.begin(SqlLine.java:540) > >>> > >>> at sqlline.SqlLine.start(SqlLine.java:264) > >>> > >>> at sqlline.SqlLine.main(SqlLine.java:195) > >>> > >>> Caused by: java.lang.NullPointerException > >>> > >>> at > >> > com.fasterxml.jackson.core.JsonFactory.createParser(JsonFactory.java:889) > >>> > >>> at > >> > com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3023) > >>> > >>> at > >> > org.apache.calcite.adapter.elasticsearch.ElasticsearchSchemaFactory.create(ElasticsearchSchemaFactory.java:65) > >>> > >>> at org.apache.calcite.model.ModelHandler.visit(ModelHandler.java:282) > >>> > >>> ... 18 more > >>> > >>> > >>> I'm running on Macbook Pro Mac OS Mojave 10.14.1 > >>> Elasticsearch version: > >>> { > >>> "name": "i-xxxxxxxxxxxx", > >>> "cluster_name": "prod-xxxxx", > >>> "cluster_uuid": "r2G1fHbtQO6a3ft_JLbLcg", > >>> "version": { > >>> "number": "5.6.8", > >>> "build_hash": "688ecce", > >>> "build_date": "2018-02-16T16:46:30.010Z", > >>> "build_snapshot": false, > >>> "lucene_version": "6.6.1" > >>> }, > >>> "tagline": "You Know, for Search" > >>> } > >>> > >>> elasticsearch.json: > >>> { > >>> "version": "1.0", > >>> "defaultSchema": "elasticsearch", > >>> "schemas": [ > >>> { > >>> "type": "custom", > >>> "name": "elasticsearch", > >>> "factory": > >> "org.apache.calcite.adapter.elasticsearch.ElasticsearchSchemaFactory", > >>> "operand": { > >>> "coordinates": "{'99.99.99.99': 80}", > >>> "index": "mp_mediaitems_v220190116" > >>> } > >>> } > >>> ] > >>> } > >>> > >> > >
