Пример #1
0
 public RelOptTableImpl getTable(final String[] names) {
   List<Pair<String, Object>> pairs = new ArrayList<Pair<String, Object>>();
   Schema schema2 = schema;
   for (int i = 0; i < names.length; i++) {
     final String name = names[i];
     Schema subSchema = schema2.getSubSchema(name);
     if (subSchema != null) {
       pairs.add(Pair.<String, Object>of(name, subSchema));
       schema2 = subSchema;
       continue;
     }
     final Table table = schema2.getTable(name);
     if (table != null) {
       pairs.add(Pair.<String, Object>of(name, table));
       if (i != names.length - 1) {
         // not enough objects to match all names
         return null;
       }
       return new RelOptTableImpl(
           this, typeFactory.createType(table.getElementType()), names, table);
     }
     return null;
   }
   return null;
 }
Пример #2
0
 public final Table getTable(String tableName, boolean caseSensitive) {
   if (caseSensitive) {
     return compositeTableMap.get(tableName);
   } else {
     final TableEntry tableEntry = tableMapInsensitive.get(tableName);
     if (tableEntry != null) {
       return tableEntry.getTable();
     }
     final FunctionEntry entry = nullaryFunctionMapInsensitive.get(tableName);
     if (entry != null) {
       return ((TableMacro) entry.getFunction()).apply(ImmutableList.of());
     }
     for (String name : schema.getTableNames()) {
       if (name.equalsIgnoreCase(tableName)) {
         return schema.getTable(name);
       }
     }
     return null;
   }
 }
 public Table getTable(String name) {
   return schema.getTable(name);
 }