calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Enrico Olivelli <eolive...@gmail.com>
Subject Re: Aliases for schemas
Date Tue, 14 Nov 2017 13:57:48 GMT
ok so I can create the rootSchema, populate with all the schemas and then
give to the config builder the "default schema"
I will give it a try
it sounds tricky to me, maybe I will file an issue

Cheers
Enrico

2017-11-14 14:55 GMT+01:00 Luis Fernando Kauer <lfkauer@yahoo.com.br.invalid
>:

>  When you set a defaultSchema in FrameworkConfig, internally Calcite uses
> defaultSchema.getParentSchema() if not null as the root schema.
> So if you set a default schema you don't need to set the root schema
> elsewhere.
> Did you try?    Em terça-feira, 14 de novembro de 2017 11:38:24 BRST,
> Enrico Olivelli <eolivelli@gmail.com> escreveu:
>
>  But actually I am setting the "rootSchema" there.
>
> Unfortunately there is no notion of "root schema" in FrameworkConfig, can
> you point me how to set this different "root schema" ?
>
> Enrico
>
> 2017-11-14 14:32 GMT+01:00 Luis Fernando Kauer
> <lfkauer@yahoo.com.br.invalid
> >:
>
> > 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 <
> > eolivelli@gmail.com> 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
> >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message