private void registerSourceSchemas(SchemaPlus rootSchema) {
    RelSchemaConverter relSchemaConverter = new RelSchemaConverter();

    for (SqlIOConfig ssc : systemStreamConfigBySource.values()) {
      SchemaPlus previousLevelSchema = rootSchema;
      List<String> sourceParts = ssc.getSourceParts();
      RelSchemaProvider relSchemaProvider = relSchemaProviders.get(ssc.getSource());

      for (int sourcePartIndex = 0; sourcePartIndex < sourceParts.size(); sourcePartIndex++) {
        String sourcePart = sourceParts.get(sourcePartIndex);
        if (sourcePartIndex < sourceParts.size() - 1) {
          SchemaPlus sourcePartSchema = previousLevelSchema.getSubSchema(sourcePart);
          if (sourcePartSchema == null) {
            sourcePartSchema = previousLevelSchema.add(sourcePart, new AbstractSchema());
          }
          previousLevelSchema = sourcePartSchema;
        } else {
          // If the source part is the last one, then fetch the schema corresponding to the stream and register.
          RelDataType relationalSchema = getSourceRelSchema(relSchemaProvider, relSchemaConverter);
          previousLevelSchema.add(sourcePart, createTableFromRelSchema(relationalSchema));
          break;
        }
      }
    }
  }
QueryPlanner that uses calcite engine to convert the sql query to relational graph.
samza-sql/src/main/java/org/apache/samza/sql/planner/QueryPlanner.java