use of org.teiid.query.sql.lang.TableFunctionReference.ProjectedColumn in project teiid by teiid.
the class SQLStringVisitor method visit.
@Override
public void visit(ArrayTable obj) {
addHintComment(obj);
// $NON-NLS-1$
append("ARRAYTABLE(");
visitNode(obj.getArrayValue());
append(SPACE);
append(NonReserved.COLUMNS);
for (Iterator<ProjectedColumn> cols = obj.getColumns().iterator(); cols.hasNext(); ) {
ProjectedColumn col = cols.next();
append(SPACE);
outputDisplayName(col.getName());
append(SPACE);
append(col.getType());
if (cols.hasNext()) {
// $NON-NLS-1$
append(",");
}
}
// $NON-NLS-1$
append(")");
append(SPACE);
append(AS);
append(SPACE);
outputDisplayName(obj.getName());
}
use of org.teiid.query.sql.lang.TableFunctionReference.ProjectedColumn in project teiid by teiid.
the class ArrayTableNode method nextBatchDirect.
@Override
protected TupleBatch nextBatchDirect() throws BlockedException, TeiidComponentException, TeiidProcessingException {
Object array = getEvaluator(Collections.emptyMap()).evaluate(table.getArrayValue(), null);
if (array != null) {
ArrayList<Object> tuple = new ArrayList<Object>(projectionIndexes.length);
for (int output : projectionIndexes) {
ProjectedColumn col = table.getColumns().get(output);
try {
Object val = FunctionMethods.array_get(array, output + 1);
tuple.add(DataTypeManager.transformValue(val, table.getColumns().get(output).getSymbol().getType()));
} catch (TransformationException e) {
throw new TeiidProcessingException(QueryPlugin.Event.TEIID30190, e, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30190, col.getName()));
} catch (SQLException e) {
throw new TeiidProcessingException(QueryPlugin.Event.TEIID30188, e);
}
}
addBatchRow(tuple);
}
terminateBatches();
return pullBatch();
}
Aggregations