Search in sources :

Example 71 with TeiidComponentException

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");
}
Also used : RequestID(org.teiid.dqp.message.RequestID) TeiidComponentException(org.teiid.core.TeiidComponentException)

Example 72 with TeiidComponentException

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;
}
Also used : LanguageObject(org.teiid.query.sql.LanguageObject) TeiidComponentException(org.teiid.core.TeiidComponentException) ComponentNotFoundException(org.teiid.core.ComponentNotFoundException) TeiidProcessingException(org.teiid.core.TeiidProcessingException) TeiidSQLException(org.teiid.jdbc.TeiidSQLException) BlockedException(org.teiid.common.buffer.BlockedException) SQLException(java.sql.SQLException) QueryValidatorException(org.teiid.api.exception.query.QueryValidatorException) ExpressionEvaluationException(org.teiid.api.exception.query.ExpressionEvaluationException) NoSuchElementException(java.util.NoSuchElementException) IOException(java.io.IOException) FunctionExecutionException(org.teiid.api.exception.query.FunctionExecutionException)

Example 73 with TeiidComponentException

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;
}
Also used : TeiidSQLException(org.teiid.jdbc.TeiidSQLException) TeiidComponentException(org.teiid.core.TeiidComponentException) ComponentNotFoundException(org.teiid.core.ComponentNotFoundException) TeiidProcessingException(org.teiid.core.TeiidProcessingException) TeiidSQLException(org.teiid.jdbc.TeiidSQLException) BlockedException(org.teiid.common.buffer.BlockedException) SQLException(java.sql.SQLException) QueryValidatorException(org.teiid.api.exception.query.QueryValidatorException) ExpressionEvaluationException(org.teiid.api.exception.query.ExpressionEvaluationException) NoSuchElementException(java.util.NoSuchElementException) IOException(java.io.IOException) FunctionExecutionException(org.teiid.api.exception.query.FunctionExecutionException)

Example 74 with TeiidComponentException

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;
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) Constant(org.teiid.query.sql.symbol.Constant) TeiidComponentException(org.teiid.core.TeiidComponentException) QueryMetadataException(org.teiid.api.exception.query.QueryMetadataException)

Example 75 with TeiidComponentException

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;
}
Also used : TempMetadataAdapter(org.teiid.query.metadata.TempMetadataAdapter) TeiidComponentException(org.teiid.core.TeiidComponentException) TempMetadataStore(org.teiid.query.metadata.TempMetadataStore) QueryResolverException(org.teiid.api.exception.query.QueryResolverException)

Aggregations

TeiidComponentException (org.teiid.core.TeiidComponentException)109 TeiidProcessingException (org.teiid.core.TeiidProcessingException)33 QueryMetadataException (org.teiid.api.exception.query.QueryMetadataException)23 TeiidRuntimeException (org.teiid.core.TeiidRuntimeException)23 ArrayList (java.util.ArrayList)18 ElementSymbol (org.teiid.query.sql.symbol.ElementSymbol)17 BlockedException (org.teiid.common.buffer.BlockedException)16 IOException (java.io.IOException)15 List (java.util.List)14 GroupSymbol (org.teiid.query.sql.symbol.GroupSymbol)13 Test (org.junit.Test)12 LanguageObject (org.teiid.query.sql.LanguageObject)12 QueryResolverException (org.teiid.api.exception.query.QueryResolverException)11 CommandContext (org.teiid.query.util.CommandContext)11 QueryValidatorException (org.teiid.api.exception.query.QueryValidatorException)10 ExpressionEvaluationException (org.teiid.api.exception.query.ExpressionEvaluationException)9 QueryMetadataInterface (org.teiid.query.metadata.QueryMetadataInterface)9 HashMap (java.util.HashMap)7 TeiidException (org.teiid.core.TeiidException)7 LogonException (org.teiid.client.security.LogonException)6