I believe that if you create a RelBuilder without a schema then the
only method you cannot use is `RelBuilder.scan(String...)`. Because
that's the only time you need to go from a name to a table.

In other words, schema is a classic 'directory service'.

I don't know whether this limitation / mode of operation is
documented, but it's fairly well established.

This mode of operation makes perfect sense for a lot of clients --
e.g. someone who has implemented a new language, the program/query has
already passed validation and by the time they use RelBuilder they
already have all Table objects in hand.

I don't know whether there's a way to improve the API to make this
behavior less surprising. Maybe we *require* a schema but allow people
to supply one that always throws (or is empty).

Julian


On Thu, Jul 7, 2022 at 10:19 AM Aryeh Hillman <[email protected]> wrote:
>
> Is there a way to use `RelBuilder.create` without a schema?
>
> example:
>
> ```
>     RelBuilder relBuilder =
> RelBuilder.create(Frameworks.newConfigBuilder().build());
>     RelNode relNode = relBuilder.scan("s1", "t1")
>         .filter(relBuilder.equals(relBuilder.field("f1"),
> relBuilder.literal("1")))
>         .project(relBuilder.field("a"), relBuilder.field("b"))
>         .build();
> ```
>
> (understandably) blows up with `Exception in thread "main"
> org.apache.calcite.runtime.CalciteException: Table 's1.t1' not found`
>
> warmly,
> aryeh

Reply via email to