default is a reserved keyword in calcite. Perhaps you should try test."default" (ie quote it)
On Wed, Apr 3, 2019 at 2:56 AM Maria <linanmengxia...@126.com> wrote: > Thank you so much ,Andrei ,your perspective inspired me. > There is no test.test in test index. > I changed another table which has multi-type, it works! > > > BUT, also, I hava one another question: why elasticsearch-adapter do not > support querying "default" type(eg. test.default) ? > > At 2019-04-03 10:32:55, "Andrei Sereda" <and...@sereda.cc> wrote: > >You define your default schema as "elasticsearch" but then elastic schema > >is called "test" : > > > >, "schemas": [ { "type": "custom", "name": "test" ..., index:"test" }] > > > >Also if you don't explicitly specify ES type all types for index "test" > >will be imported. So it is possible that there is no test.test type. > > > >On Tue, Apr 2, 2019 at 11:18 PM Maria <linanmengxia...@126.com> wrote: > > > >> > >> > >> And, if the name is not correct, creating ElasticsearchSchema will be > >> failed. The program will not performs "ResultSet result = > >> ss.excuteQuery(sql);" > >> > >> At 2019-04-03 09:47:02, "Andrei Sereda" <and...@sereda.cc> wrote: > >> >Can you check that it's not because of lex ? > >> >What if you quote table name "test" ? Maybe uppercase ? > >> > > >> >On Tue, Apr 2, 2019, 22:42 Maria <linanmengxia...@126.com> wrote: > >> > > >> >> Firstly,thanks for your reply. > >> >> But I'm sure that my local elasticsearch-model.json has been loaded > >> >> correctly,because when getting connect,read the elastic info from > that > >> >> file. > >> >> I will debug the test-demo again...Search for the cause of the > problem. > >> >> > >> >> > >> >> Best wishes. > >> >> > >> >> > >> >> Maria. > >> >> At 2019-04-02 19:54:24, "Yuzhao Chen" <yuzhao....@gmail.com> wrote: > >> >> >For Object 'test' not found it means Calcite does not load your son > >> model > >> >> correctly, so it can not find then validate the table there. Maybe > you > >> >> model file is not load correctly. > >> >> > > >> >> >I saw a demo in Calcite code in [1], the path sep is </> while your > sep > >> >> is <\\>, can you have a try ? > >> >> > > >> >> >[1] > >> >> > >> > https://github.com/apache/calcite/blob/a75a689eff2f1333adc8fb800bdfa077e94da562/core/src/test/java/org/apache/calcite/test/LatticeTest.java#L914 > >> >> > > >> >> >Best, > >> >> >Danny Chan > >> >> >在 2019年4月2日 +0800 PM8:33,Maria <linanmengxia...@126.com>,写道: > >> >> >> Hi, calcite developers. I met a question about es-adapter and > still > >> >> cannot resove it: . > >> >> >> > >> >> >> > >> >> >> 1) calcite version :1.18.0 > >> >> >> 2) ES version : 5.4.1(I know that in calcite-1.18.0 is 6.4.2) > >> >> >> 3) test sql : select count(*) from test > >> >> >> 4) elasticsearch-model.json as follow: > >> >> >> { > >> >> >> "version": "1.0","defaultSchema": "elasticsearch", "schemas": [ { > >> >> "type": "custom", "name": "test", "factory": > >> >> > "org.apache.calcite.adapter.elasticsearch.ElasticsearchSchemaFactory", > >> >> "operand": { > >> >> >> "coordinates": "{'xx.xx.xx.xx': 9205}", > >> >> >> "userConfig": "{'bulk.flush.max.actions': 10, > >> 'bulk.flush.max.size.mb': > >> >> 1}", > >> >> >> "index": "test" } } ] } > >> >> >> 5) test-code: > >> >> >> try { > >> >> >> Class.forName("org.apache.calcite.jdbc.Driver"); > >> >> >> } catch (ClassNotFoundException e) { > >> >> >> Throw new RuntimeException(e); > >> >> >> } > >> >> >> Properties pp = new Properties(); > >> >> >> pp.put("lex", "JAVA"); > >> >> >> Connection conn = null; > >> >> >> try { > >> >> >> conn = > >> >> > >> > DriverManager.getConnection("jdbc:calcite:model=D:\\calcite\\pre-git\\calcite-test\\conf\\elasticsearch-model.json", > >> >> pp); > >> >> >> Statement ss = conn.createStatement(); > >> >> >> String sql = "select count(*) from test"; > >> >> >> ResultSet result = ss.escuteQuery(sql); > >> >> >> output(resultSet, System.out); > >> >> >> } catch() { > >> >> >> Throw new RuntimeException("======get data failed" , e); > >> >> >> } > >> >> >> > >> >> >> > >> >> >> 6) excaptions : > >> >> >> org.apache.calcite.sql.validate.SqlValidatorException:Object > 'test' > >> not > >> >> found > >> >> >> Exception in thread "main" java.lang.RuntimeException: ======get > data > >> >> failed > >> >> >> ......... > >> >> >> caused by:org.apache.calcite.runtime.CalciteContestException: From > >> line > >> >> 1, column 22 to line 1, column 25: Object 'test' not found<4 internal > >> calls> > >> >> >> at > >> >> > >> > org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:463) > >> >> >> at > >> org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:787) > >> >> >> at > >> org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:772) > >> >> >> at > >> >> > >> > org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:4788) > >> >> >> at > >> >> > >> > org.apache.calcite.sql.validate.IdentifierNamespace.resolveImpl(IdentifierNamespace.java:172) > >> >> >> ......... > >> >> >> 7) other confusions: > >> >> >> [1] I know that in elasticsearch apdator, test case is done by > >> >> EmbeddedElasticsearch, why not add one standard JDBC test case? > >> >> >> [2] model.json in > >> >> http://calcite.apache.org/docs/elasticsearch_adapter.html need to be > >> >> update,should add "userConfig", or else will be failed. > >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> any reply will be appreciated > >> >> >> > >> >> >> > >> >> >> Maria. > >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> >> > >> >> > >> >