Hi,
FrameworkConfig has getDefaultSchema(), from javadoc "Returns the default 
schema that should be checked before looking at the root schema.  Returns null 
to only consult the root schema".
So, if you are using Frameworks.newConfigBuilder(), you can set it using 
".defaultSchema( rootSchema.getSubSchema( "one" ))", for example.   Em 
terça-feira, 14 de novembro de 2017 10:59:33 BRST, Enrico Olivelli 
<[email protected]> escreveu:  
 
 Hi,
(I am playing with the planner, you know)
I have several "schema" in my system, like "one", "two"
So my root schema is built this way:
final SchemaPlus rootSchema = Frameworks.createRootSchema(true);
        for (String tableSpace : listTableSpaces()) {
            SchemaPlus schema = rootSchema.add(tableSpace, new
AbstractSchema());
}

Queries like
SELECT * from one.mytable
SELECT * from two.mytable

get parsed and validated.

But I would like to set a "default" schema to be used when the query does
not explicitly refer to a schema, like
default-schema='one'
SELECT * from mytable

which I would expect to be parsed as
SELECT * from one.mytable

Is it possible ?


Bonus question, separate from the former, it seems that the parser
complaints if I try to use a schema with name "default", using MYSQL5_5
compatinility for instance. Is there any tweak to make it work ?

Calcite is really great!
Enrico
  

Reply via email to