Description
ModelHandler won't accept a file name without a directory component. A model referencing file with no directory component throws an NPE. In the example below replacing
foo.json
with
./foo.json
resolves the problem.
sqlline> !connect jdbc:calcite:model=foo.json druid druid java.lang.RuntimeException: Error instantiating JsonCustomSchema(name=foo) at org.apache.calcite.model.ModelHandler.visit(ModelHandler.java:219) at org.apache.calcite.model.JsonCustomSchema.accept(JsonCustomSchema.java:45) at org.apache.calcite.model.ModelHandler.visit(ModelHandler.java:142) at org.apache.calcite.model.ModelHandler.<init>(ModelHandler.java:84) at org.apache.calcite.jdbc.Driver$1.onConnectionInit(Driver.java:104) at org.apache.calcite.avatica.UnregisteredDriver.connect(UnregisteredDriver.java:145) at sqlline.DatabaseConnection.connect(DatabaseConnection.java:157) at sqlline.DatabaseConnection.getConnection(DatabaseConnection.java:203) at sqlline.Commands.connect(Commands.java:1064) at sqlline.Commands.connect(Commands.java:996) 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:36) at sqlline.SqlLine.dispatch(SqlLine.java:803) at sqlline.SqlLine.begin(SqlLine.java:681) at sqlline.SqlLine.start(SqlLine.java:398) at sqlline.SqlLine.main(SqlLine.java:292) Caused by: java.lang.NullPointerException: null value in entry: baseDirectory=null at com.google.common.collect.CollectPreconditions.checkEntryNotNull(CollectPreconditions.java:33) at com.google.common.collect.ImmutableMap.entryOf(ImmutableMap.java:135) at com.google.common.collect.ImmutableMap$Builder.put(ImmutableMap.java:206) at org.apache.calcite.model.ModelHandler.operandMap(ModelHandler.java:240) at org.apache.calcite.model.ModelHandler.visit(ModelHandler.java:215) ... 18 more