use of org.teiid.core.TeiidComponentException in project teiid by teiid.
the class DQPCore method stop.
/**
* perform a full shutdown and wait for 10 seconds for all threads to finish
*/
public void stop() {
shutdown = true;
for (RequestID request : requests.keySet()) {
try {
// $NON-NLS-1$
cancelRequest(request, "server shutdown");
} catch (TeiidComponentException e) {
}
}
processWorkerPool.shutdownNow();
try {
processWorkerPool.awaitTermination(10, TimeUnit.SECONDS);
} catch (InterruptedException e) {
}
this.timeoutExecutor.shutdownNow();
try {
timeoutExecutor.awaitTermination(10, TimeUnit.SECONDS);
} catch (InterruptedException e) {
}
// TODO: Should we be doing more cleanup here??
// $NON-NLS-1$
LogManager.logDetail(LogConstants.CTX_DQP, "Stopping the DQP");
}
use of org.teiid.core.TeiidComponentException in project teiid by teiid.
the class Evaluator method evaluateIsDistinct.
private Boolean evaluateIsDistinct(IsDistinctCriteria idc, List<?> tuple) throws AssertionError, ExpressionEvaluationException, BlockedException, TeiidComponentException {
RowValue left = getRowValue(tuple, idc.getLeftRowValue());
RowValue right = getRowValue(tuple, idc.getRightRowValue());
if (left.length() != right.length()) {
return !idc.isNegated();
}
boolean result = false;
for (int i = 0; i < left.length(); i++) {
Object l = left.get(i);
Object r = right.get(i);
if (l == null) {
if (r != null) {
result = true;
break;
}
continue;
} else if (r == null) {
result = true;
break;
}
try {
Boolean b = compare(CompareCriteria.EQ, l, r);
if (b == null) {
// shouldn't happen
continue;
}
if (!b) {
result = true;
break;
}
} catch (Exception e) {
// we'll consider this a difference
// more than likely they are different types
result = true;
break;
}
}
if (idc.isNegated()) {
return !result;
}
return result;
}
use of org.teiid.core.TeiidComponentException in project teiid by teiid.
the class Evaluator method evaluate.
private Object evaluate(List<?> tuple, ExceptionExpression ee) throws ExpressionEvaluationException, BlockedException, TeiidComponentException {
String msg = (String) internalEvaluate(ee.getMessage(), tuple);
String sqlState = ee.getDefaultSQLState();
if (ee.getSqlState() != null) {
sqlState = (String) internalEvaluate(ee.getSqlState(), tuple);
}
Integer errorCode = null;
if (ee.getErrorCode() != null) {
errorCode = (Integer) internalEvaluate(ee.getErrorCode(), tuple);
}
Exception parent = null;
if (ee.getParent() != null) {
parent = (Exception) internalEvaluate(ee.getParent(), tuple);
}
Exception result = new TeiidSQLException(parent, msg, sqlState, errorCode != null ? errorCode : 0);
result.setStackTrace(SourceWarning.EMPTY_STACK_TRACE);
return result;
}
use of org.teiid.core.TeiidComponentException in project teiid by teiid.
the class MultiSourceElementReplacementVisitor method replaceExpression.
public Expression replaceExpression(Expression expr) {
if (expr instanceof ElementSymbol) {
ElementSymbol elem = (ElementSymbol) expr;
Object metadataID = elem.getMetadataID();
try {
if (metadata.isMultiSourceElement(metadataID)) {
Constant bindingConst = new Constant(this.bindingName, DataTypeManager.DefaultDataClasses.STRING);
return bindingConst;
}
} catch (QueryMetadataException e) {
} catch (TeiidComponentException e) {
}
}
return expr;
}
use of org.teiid.core.TeiidComponentException in project teiid by teiid.
the class RulePushAggregates method defineNewGroup.
static List<ElementSymbol> defineNewGroup(GroupSymbol group, List<? extends Expression> virtualElements, QueryMetadataInterface metadata) throws TeiidComponentException, QueryMetadataException {
TempMetadataStore store = new TempMetadataStore();
TempMetadataAdapter tma = new TempMetadataAdapter(metadata, store);
try {
group.setMetadataID(ResolverUtil.addTempGroup(tma, group, virtualElements, false));
} catch (QueryResolverException e) {
throw new TeiidComponentException(QueryPlugin.Event.TEIID30265, e);
}
List<ElementSymbol> projectedSymbols = ResolverUtil.resolveElementsInGroup(group, metadata);
return projectedSymbols;
}
Aggregations