ccaominh commented on a change in pull request #6974: sql support for dynamic parameters URL: https://github.com/apache/incubator-druid/pull/6974#discussion_r309808680
########## File path: sql/src/main/java/org/apache/druid/sql/calcite/planner/DruidPlanner.java ########## @@ -57,22 +69,49 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Properties; import java.util.Set; public class DruidPlanner implements Closeable { + private final FrameworkConfig frameworkConfig; private final Planner planner; private final PlannerContext plannerContext; public DruidPlanner( - final Planner planner, + final FrameworkConfig frameworkConfig, final PlannerContext plannerContext ) { - this.planner = planner; + this.frameworkConfig = frameworkConfig; + this.planner = Frameworks.getPlanner(frameworkConfig); this.plannerContext = plannerContext; } + public PrepareResult prepare(final String sql) throws SqlParseException, ValidationException, RelConversionException + { + SqlNode parsed = planner.parse(sql); + SqlExplain explain = null; + if (parsed.getKind() == SqlKind.EXPLAIN) { + explain = (SqlExplain) parsed; + parsed = explain.getExplicandum(); + } + final SqlNode validated = planner.validate(parsed); + RelRoot root = planner.rel(validated); + RelDataType rowType = root.validatedRowType; + + // this is sort of lame, planner won't cough up it's validator, it's private and has no accessors, so make another Review comment: Typo: it's validator -> its validator ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org