use of org.teiid.core.types.TransformationException 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();
}
use of org.teiid.core.types.TransformationException in project teiid by teiid.
the class StringToSQLXMLTransform method isXml.
public static Type isXml(Reader reader) throws TransformationException {
Type type = Type.ELEMENT;
XMLInputFactory inputFactory = XMLType.getXmlInputFactory();
try {
XMLStreamReader xmlReader = inputFactory.createXMLStreamReader(reader);
int event = xmlReader.getEventType();
if (event == XMLEvent.START_DOCUMENT && xmlReader.getLocation().getColumnNumber() != 1) {
type = Type.DOCUMENT;
}
while (xmlReader.hasNext()) {
xmlReader.next();
}
} catch (Exception e) {
throw new TransformationException(CorePlugin.Event.TEIID10070, e, CorePlugin.Util.gs(CorePlugin.Event.TEIID10070));
} finally {
try {
reader.close();
} catch (IOException e) {
}
}
return type;
}
Aggregations