コード例 #1
0
 @Override
 protected void doEvaluate(
     TExecutionContext context, LazyList<? extends ValueSource> inputs, ValueTarget output) {
   String[] parts = {"", "", ""};
   if (covering.length == 1) {
     ColumnName columnName = ColumnName.parse("", inputs.get(0).getString());
     parts[0] = columnName.getTableName().getSchemaName();
     parts[1] = columnName.getTableName().getTableName();
     parts[2] = columnName.getName();
   } else {
     for (int i = covering.length - 1, j = 2; i >= 0; --i, --j) {
       parts[j] = inputs.get(i).getString();
     }
   }
   if (parts[0].isEmpty()) {
     parts[0] = context.getCurrentSchema();
   }
   AkibanInformationSchema ais = context.getQueryContext().getStore().schema().ais();
   Columnar columnar = ais.getTable(parts[0], parts[1]);
   if (columnar == null) {
     columnar = ais.getView(parts[0], parts[1]);
     if (columnar == null) {
       throw new NoSuchTableException(parts[0], parts[1]);
     }
   }
   Column column = columnar.getColumn(parts[2]);
   if (column == null) {
     throw new NoSuchColumnException(String.format("%s.%s.%s", parts[0], parts[1], parts[2]));
   }
   output.putString(column.getType().toStringConcise(false), null);
 }
コード例 #2
0
 @Override
 public boolean isSelected(Columnar columnar) {
   return columnar.isTable()
       && ((((Table) columnar).getGroup() == table.getGroup()) || fkTables.contains(columnar));
 }