calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hiroyuki Yamada <mogwa...@gmail.com>
Subject How to create a cost-optimized plan from the Framework
Date Tue, 20 Sep 2016 12:51:13 GMT
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

Mime
View raw message