use of org.apache.drill.exec.store.table.function.TableSignature in project drill by apache.
the class AbstractSchema method getFunctions.
/**
* For the given table names returns list of acceptable table functions
* which are common for all Drill schemas. When overriding this method,
* parent functions must be included first to be evaluated first.
* If not included, parent functions won't be taken into account when creating table instance.
*
* @param name table name
* @return list of table functions
*/
@Override
public Collection<Function> getFunctions(String name) {
List<TableParamDef> parameters = getFunctionParameters();
TableSignature signature = TableSignature.of(name, parameters);
WithOptionsTableMacro function = new WithOptionsTableMacro(signature, arguments -> {
Table table = getTable(name);
if (table instanceof DrillTable) {
return applyFunctionParameters((DrillTable) table, parameters, arguments);
} else if (table == null) {
return null;
}
throw new DrillRuntimeException(String.format("Table [%s] is not of Drill table instance. " + "Given instance is of [%s].", name, table.getClass().getName()));
});
return Collections.singletonList(function);
}
use of org.apache.drill.exec.store.table.function.TableSignature in project drill by apache.
the class FormatPluginOptionExtractor method getTableSignatures.
/**
* Give a table name, returns function signatures to configure the FormatPlugin.
*
* @param tableName the name of the table (or table function in this context)
* @param tableParameters common table parameters to be included
* @return the available signatures
*/
List<TableSignature> getTableSignatures(String tableName, List<TableParamDef> tableParameters) {
List<TableSignature> result = new ArrayList<>();
for (FormatPluginOptionsDescriptor optionsDescriptor : optionsByTypeName.values()) {
TableSignature sig = optionsDescriptor.getTableSignature(tableName, tableParameters);
result.add(sig);
}
return unmodifiableList(result);
}
Aggregations