Package org.apache.calcite.tools
Class Frameworks
- java.lang.Object
-
- org.apache.calcite.tools.Frameworks
-
public class Frameworks extends java.lang.Object
Tools for invoking Calcite functionality without initializing a container / server first.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Frameworks.ConfigBuilder
A builder to help you build aFrameworkConfig
using defaults where values aren't required.static interface
Frameworks.PlannerAction<R>
Piece of code to be run in a context where a planner is available.static class
Frameworks.PrepareAction<R>
Piece of code to be run in a context where a planner and statement are available.(package private) static class
Frameworks.StdFrameworkConfig
An implementation ofFrameworkConfig
that uses standard Calcite classes to provide basic planner functionality.
-
Constructor Summary
Constructors Modifier Constructor Description private
Frameworks()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SchemaPlus
createRootSchema(boolean addMetadataSchema)
Creates a root schema.static Planner
getPlanner(FrameworkConfig config)
Creates a planner.static Frameworks.ConfigBuilder
newConfigBuilder()
Creates a config builder with each setting initialized to its default value.static Frameworks.ConfigBuilder
newConfigBuilder(FrameworkConfig config)
Creates a config builder initializing each setting from an existing config.static <R> R
withPlanner(Frameworks.PlannerAction<R> action)
Initializes a container then calls user-specified code with a planner.static <R> R
withPlanner(Frameworks.PlannerAction<R> action, FrameworkConfig config)
Initializes a container then calls user-specified code with a planner.static <R> R
withPrepare(Frameworks.PrepareAction<R> action)
Initializes a container then calls user-specified code with a planner and statement.
-
-
-
Method Detail
-
getPlanner
public static Planner getPlanner(FrameworkConfig config)
Creates a planner.- Parameters:
config
- Planner configuration- Returns:
- Planner
-
withPlanner
public static <R> R withPlanner(Frameworks.PlannerAction<R> action, FrameworkConfig config)
Initializes a container then calls user-specified code with a planner.- Parameters:
action
- Callback containing user-specified codeconfig
- FrameworkConfig to use for planner action.- Returns:
- Return value from action
-
withPlanner
public static <R> R withPlanner(Frameworks.PlannerAction<R> action)
Initializes a container then calls user-specified code with a planner.- Parameters:
action
- Callback containing user-specified code- Returns:
- Return value from action
-
withPrepare
public static <R> R withPrepare(Frameworks.PrepareAction<R> action)
Initializes a container then calls user-specified code with a planner and statement.- Parameters:
action
- Callback containing user-specified code- Returns:
- Return value from action
-
createRootSchema
public static SchemaPlus createRootSchema(boolean addMetadataSchema)
Creates a root schema.- Parameters:
addMetadataSchema
- Whether to add "metadata" schema containing definitions of tables, columns etc.
-
newConfigBuilder
public static Frameworks.ConfigBuilder newConfigBuilder()
Creates a config builder with each setting initialized to its default value.
-
newConfigBuilder
public static Frameworks.ConfigBuilder newConfigBuilder(FrameworkConfig config)
Creates a config builder initializing each setting from an existing config.So,
newConfigBuilder(config).build()
will return a value equal toconfig
.
-
-