Esempio n. 1
0
  public static void getSchemaObjectMonikers(
      SqlValidatorCatalogReader catalogReader, List<String> names, List<SqlMoniker> hints) {
    // Assume that the last name is 'dummy' or similar.
    List<String> subNames = Util.skipLast(names);
    hints.addAll(catalogReader.getAllSchemaObjectNames(subNames));

    // If the name has length 0, try prepending the name of the default
    // schema. So, the empty name would yield a list of tables in the
    // default schema, as well as a list of schemas from the above code.
    if (subNames.size() == 0) {
      hints.addAll(
          catalogReader.getAllSchemaObjectNames(
              Collections.singletonList(catalogReader.getSchemaName())));
    }
  }
Esempio n. 2
0
 public RelOptTable getTableForMember(List<String> names) {
   final SqlValidatorTable table = catalogReader.getTable(names);
   final RelDataType rowType = table.getRowType();
   final List<RelCollation> collationList = deduceMonotonicity(table);
   if (names.size() < 3) {
     String[] newNames2 = {"CATALOG", "SALES", ""};
     List<String> newNames = new ArrayList<String>();
     int i = 0;
     while (newNames.size() < newNames2.length) {
       newNames.add(i, newNames2[i]);
       ++i;
     }
     names = newNames;
   }
   return createColumnSet(table, names, rowType, collationList);
 }