示例#1
0
 private static void addFunction(String name, int numMinArgs, int numMaxArgs, CallableFunc func) {
   FunctionEntry fe = new FunctionEntry();
   fe.name = name;
   fe.function = func;
   fe.numMinArgs = numMinArgs;
   fe.numMaxArgs = numMaxArgs;
   functions.add(fe);
 }
示例#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;
   }
 }