private static Planner createPlanner() {
    Connection connection;
    SchemaPlus rootSchema;
    try {
      JavaTypeFactory typeFactory = new SamzaSqlJavaTypeFactoryImpl();
      SamzaSqlDriver driver = new SamzaSqlDriver(typeFactory);
      DriverManager.deregisterDriver(DriverManager.getDriver("jdbc:calcite:"));
      DriverManager.registerDriver(driver);
      connection = driver.connect("jdbc:calcite:", new Properties());
      CalciteConnection calciteConnection = connection.unwrap(CalciteConnection.class);
      rootSchema = calciteConnection.getRootSchema();
    } catch (SQLException e) {
      throw new SamzaException(e);
    }

    final List<RelTraitDef> traitDefs = new ArrayList<>();

    traitDefs.add(ConventionTraitDef.INSTANCE);
    traitDefs.add(RelCollationTraitDef.INSTANCE);

    FrameworkConfig frameworkConfig = Frameworks.newConfigBuilder()
        .parserConfig(SqlParser.configBuilder().setLex(Lex.JAVA).build())
        .defaultSchema(rootSchema)
        .operatorTable(SqlStdOperatorTable.instance())
        .traitDefs(traitDefs)
        .context(Contexts.EMPTY_CONTEXT)
        .costFactory(null)
        //.programs(Programs.CALC_PROGRAM)
        .build();
    return Frameworks.getPlanner(frameworkConfig);
  }
Utility class that is used to parse the Samza sql query to figure out the sources, sink etc..
samza-sql/src/main/java/org/apache/samza/sql/util/SamzaSqlQueryParser.java