Пример #1
0
 /**
  * Creates a JavaRelImplementor
  *
  * @param rexBuilder Builder for {@link RexNode}s
  * @param implementorTable Table of implementations of operators. Must not be null
  */
 public JavaRelImplementor(RexBuilder rexBuilder, OJRexImplementorTable implementorTable) {
   super(rexBuilder);
   Util.pre(rexBuilder != null, "rexBuilder != null");
   Util.pre(implementorTable != null, "implementorTable != null");
   this.implementorTable = implementorTable;
   nextVariableId = 0;
 }
Пример #2
0
 public RelNode convertSqlToRel(String sql) {
   Util.pre(sql != null, "sql != null");
   final SqlNode sqlQuery;
   try {
     sqlQuery = parseQuery(sql);
   } catch (Exception e) {
     throw Util.newInternal(e); // todo: better handling
   }
   final RelDataTypeFactory typeFactory = getTypeFactory();
   final Prepare.CatalogReader catalogReader = createCatalogReader(typeFactory);
   final SqlValidator validator = createValidator(catalogReader, typeFactory);
   final SqlToRelConverter converter =
       createSqlToRelConverter(validator, catalogReader, typeFactory);
   converter.setTrimUnusedFields(true);
   final SqlNode validatedQuery = validator.validate(sqlQuery);
   final RelNode rel = converter.convertQuery(validatedQuery, false, true);
   Util.post(rel != null, "return != null");
   return rel;
 }