Re: Trying to call "PreparedStatement.run()" throws "Cannot invoke "calcite.schema.Schema.getTable(String)" because the return value of "calcite.schema.SchemaPlus.getSubSchema(String)" is null"

2022-02-05 Thread Gavin Ray
For posterity's sake and future-searchers, I just hit this error again under different circumstances and wanted to share why here. The value of the second parameter ("name") to "JdbcSchema.create()" is apparently very important. Somehow I was passing something that was causing it to look for

Re: Trying to call "PreparedStatement.run()" throws "Cannot invoke "calcite.schema.Schema.getTable(String)" because the return value of "calcite.schema.SchemaPlus.getSubSchema(String)" is null"

2022-01-03 Thread Gavin Ray
Ahhh -- thanks for the code sample Gunnar and the clarification that you can do it two ways Julian. Data-source metadata updates should be infrequent I can try to use a mutex/arc for the global SchemaPlus Think it would be really beneficial to have a single schema tree that can see every data

Re: Trying to call "PreparedStatement.run()" throws "Cannot invoke "calcite.schema.Schema.getTable(String)" because the return value of "calcite.schema.SchemaPlus.getSubSchema(String)" is null"

2022-01-03 Thread Julian Hyde
Gunnar’s point is a good one. To make it a little more explicit: if the value of the the “model” parameter starts with “inline:”, the model is just the rest of the string. As to whether you use models or deal with the SchemaPlus API directly. It’s your decision based on how much concurrency

Re: Trying to call "PreparedStatement.run()" throws "Cannot invoke "calcite.schema.Schema.getTable(String)" because the return value of "calcite.schema.SchemaPlus.getSubSchema(String)" is null"

2022-01-03 Thread Gunnar Morling
Am Mo., 3. Jan. 2022 um 20:44 Uhr schrieb Gavin Ray : > @Stamatis > > Thank you, I actually did not know that! That's useful information to > have =) > > @Julian > > Is it possible to programmatically generate the JSON model? Why I ask is > because part of the functionality I'm trying to mirror

Re: Trying to call "PreparedStatement.run()" throws "Cannot invoke "calcite.schema.Schema.getTable(String)" because the return value of "calcite.schema.SchemaPlus.getSubSchema(String)" is null"

2022-01-03 Thread Gavin Ray
@Stamatis Thank you, I actually did not know that! That's useful information to have =) @Julian Is it possible to programmatically generate the JSON model? Why I ask is because part of the functionality I'm trying to mirror is the ability to add data sources dynamically while the app server is

Re: Trying to call "PreparedStatement.run()" throws "Cannot invoke "calcite.schema.Schema.getTable(String)" because the return value of "calcite.schema.SchemaPlus.getSubSchema(String)" is null"

2022-01-03 Thread Julian Hyde
> Will try to figure out how to manually perform the process of creating a > proper "Connection" object and adding the schemas to it. Generally the best way is to write a JSON model, and then create a connection using ‘jdbc:calcite:…model=...'. For that to work, your component needs to

Re: Trying to call "PreparedStatement.run()" throws "Cannot invoke "calcite.schema.Schema.getTable(String)" because the return value of "calcite.schema.SchemaPlus.getSubSchema(String)" is null"

2022-01-02 Thread Stamatis Zampetakis
Hi Gavin, Although the problem was not related to generated code in the end it is useful to know that you can debug into generated classes by setting some system properties [1]. You can also use -Dcalcite.debug property which prints generated code among other things to stdout. You may have

Re: Trying to call "PreparedStatement.run()" throws "Cannot invoke "calcite.schema.Schema.getTable(String)" because the return value of "calcite.schema.SchemaPlus.getSubSchema(String)" is null"

2022-01-02 Thread Gavin Ray
Ahh, thank you Julian, appreciate that you're always answering my questions. That all makes sense. I suppose the downside of using these incredibly handy test helpers/utils is that I haven't a clue what's actually going on, haha. Will try to figure out how to manually perform the process of

Re: Trying to call "PreparedStatement.run()" throws "Cannot invoke "calcite.schema.Schema.getTable(String)" because the return value of "calcite.schema.SchemaPlus.getSubSchema(String)" is null"

2022-01-01 Thread Julian Hyde
Gavin, The reason is that you need two “ingredients” to execute a query. You need the expression, and you need a connection. The expression is written in terms of relations, which have a fully-qualified path, “schema.subSchema.tableName”. But only the connection (to be precise, its root

Re: Trying to call "PreparedStatement.run()" throws "Cannot invoke "calcite.schema.Schema.getTable(String)" because the return value of "calcite.schema.SchemaPlus.getSubSchema(String)" is null"

2022-01-01 Thread Gavin Ray
After two days of banging my head against the wall, I figured it out! It only works if I run the query in the context of a "CalciteConnection", and I use "connection.unwrap()" to create the "RelRunner". WRONG: == val run = RelRunners.run(bestExp) val resultSet =

Re: Trying to call "PreparedStatement.run()" throws "Cannot invoke "calcite.schema.Schema.getTable(String)" because the return value of "calcite.schema.SchemaPlus.getSubSchema(String)" is null"

2021-12-31 Thread Gavin Ray
It appears to be because "getSubSchema" in "calcite.jdbc.CalciteSchema.SchemaPlusImpl" has a "subSchemaMap" that loses the "hr" schema and only contains "metadata" [0] But if I call the same function the map shows "hr" is present [1] which doesn't make sense to me [0]: https://imgur.com/djlkBVf

Trying to call "PreparedStatement.run()" throws "Cannot invoke "calcite.schema.Schema.getTable(String)" because the return value of "calcite.schema.SchemaPlus.getSubSchema(String)" is null"

2021-12-31 Thread Gavin Ray
Unsure of where this is coming from/how to debug it. (The code I am using is below, taken from Calcite examples) If I print out the sub-schema names of "rootSchema", and their tables, I get: subSchemaNames: [hr, metadata] "hr" subSchema table names: [depts, emps] "metadata" subSchema