示例#1
0
 private List<RelDataType> toSql(List<RelDataType> types) {
   return Lists.transform(
       types,
       new com.google.common.base.Function<RelDataType, RelDataType>() {
         public RelDataType apply(RelDataType input) {
           if (input instanceof RelDataTypeFactoryImpl.JavaType
               && ((RelDataTypeFactoryImpl.JavaType) input).getJavaClass() == Object.class) {
             return typeFactory.createSqlType(SqlTypeName.ANY);
           }
           return typeFactory.toSql(input);
         }
       });
 }
示例#2
0
 /** Returns the path of an object in this schema. */
 public List<String> path(String name) {
   final List<String> list = new ArrayList<String>();
   if (name != null) {
     list.add(name);
   }
   for (OptiqSchema s = this; s != null; s = s.parent) {
     if (s.parent != null || !s.name.equals("")) {
       // Omit the root schema's name from the path if it's the empty string,
       // which it usually is.
       list.add(s.name);
     }
   }
   return ImmutableList.copyOf(Lists.reverse(list));
 }
示例#3
0
 private Collection<Function> getFunctionsFrom(List<String> names) {
   final List<Function> functions2 = Lists.newArrayList();
   final List<? extends List<String>> schemaNameList;
   if (names.size() > 1) {
     // If name is qualified, ignore path.
     schemaNameList = ImmutableList.of(ImmutableList.<String>of());
   } else {
     OptiqSchema schema = getSchema(defaultSchema);
     if (schema == null) {
       schemaNameList = ImmutableList.of();
     } else {
       schemaNameList = schema.getPath();
     }
   }
   for (List<String> schemaNames : schemaNameList) {
     OptiqSchema schema = getSchema(Iterables.concat(schemaNames, Util.skipLast(names)));
     if (schema != null) {
       final String name = Util.last(names);
       functions2.addAll(schema.getFunctions(name, true));
     }
   }
   return functions2;
 }