Hi,

I'm wondering how to create a cost-optimized plan from the Framework.
I am currently in the following phase and successfully created a
logical plan (, which I think is not optimized based on costs),
but I'm not sure how to create a plan which is optimized based on
costs from the logical plan.

FrameworkConfig calciteFrameworkConfig = Frameworks.newConfigBuilder()
    .parserConfig(SqlParser.configBuilder()
    .setLex(Lex.MYSQL)
    .build())
    .defaultSchema(schema)
    .traitDefs(traitDefs)
    .context(Contexts.EMPTY_CONTEXT)
    .ruleSets(RuleSets.ofList())
    .costFactory(null)
    .typeSystem(RelDataTypeSystem.DEFAULT)
    .build();

planner = Frameworks.getPlanner(calciteFrameworkConfig);
sqlNode = planner.parse(query);
SqlNode validatedSqlNode = planner.validate(sqlNode);
RelRoot root = planner.rel(validatedSqlNode)
// I don't know what to do to optimize the logical plan
// I also don't know how to modify the existing costs for each node


Would any teach me how to do that ?
(If there are some examples or documents somewhere, it would be great
if you point them.)
Also, would anyone give me some idea about how to modify the default costs ?


Best regards,
Hiro

Reply via email to