Search in sources :

Example 91 with TeiidComponentException

use of org.teiid.core.TeiidComponentException in project teiid by teiid.

the class GlobalTableStoreImpl method getState.

@Override
public void getState(OutputStream ostream) {
    try {
        ObjectOutputStream oos = new ObjectOutputStream(ostream);
        for (Map.Entry<String, TempTable> entry : tableStore.getTempTables().entrySet()) {
            sendTable(entry.getKey(), oos, true);
        }
        oos.writeObject(null);
        oos.close();
    } catch (IOException e) {
        throw new TeiidRuntimeException(QueryPlugin.Event.TEIID30217, e);
    } catch (TeiidComponentException e) {
        throw new TeiidRuntimeException(QueryPlugin.Event.TEIID30218, e);
    }
}
Also used : TeiidComponentException(org.teiid.core.TeiidComponentException) IOException(java.io.IOException) TeiidRuntimeException(org.teiid.core.TeiidRuntimeException) ObjectOutputStream(java.io.ObjectOutputStream) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) SymbolMap(org.teiid.query.sql.util.SymbolMap)

Example 92 with TeiidComponentException

use of org.teiid.core.TeiidComponentException in project teiid by teiid.

the class TestBufferManagerImpl method testTupleBufferSessionMax.

@Test
public void testTupleBufferSessionMax() throws Exception {
    BufferManagerImpl bufferManager = new BufferManagerImpl();
    bufferManager.setCache(new MemoryStorageManager() {

        @Override
        public long getMaxStorageSpace() {
            return 64000;
        }
    });
    bufferManager.setMaxReserveKB(10);
    bufferManager.setMaxActivePlans(10);
    bufferManager.setOptions(new Options().maxSessionBufferSizeEstimate(100000));
    bufferManager.initialize();
    CommandContext context = new CommandContext();
    context.setSession(new SessionMetadata());
    CommandContext.pushThreadLocalContext(context);
    try {
        List<TupleBuffer> tupleBuffers = new ArrayList<TupleBuffer>();
        for (int i = 0; i < 36; i++) {
            TupleBuffer tb = bufferManager.createTupleBuffer(Arrays.asList(new ElementSymbol("x", null, String.class)), "x", TupleSourceType.PROCESSOR);
            try {
                for (int j = 0; j < 50; j++) {
                    tb.addTuple(Arrays.asList("a"));
                }
                tb.saveBatch();
                if (i % 2 == 0) {
                    tb.remove();
                }
            } catch (TeiidComponentException e) {
                assertEquals(34, i);
                return;
            }
            tupleBuffers.add(tb);
        }
    } finally {
        CommandContext.popThreadLocalContext();
    }
    fail();
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) Options(org.teiid.query.util.Options) CommandContext(org.teiid.query.util.CommandContext) SessionMetadata(org.teiid.adminapi.impl.SessionMetadata) TupleBuffer(org.teiid.common.buffer.TupleBuffer) ArrayList(java.util.ArrayList) TeiidComponentException(org.teiid.core.TeiidComponentException) Test(org.junit.Test)

Example 93 with TeiidComponentException

use of org.teiid.core.TeiidComponentException in project teiid by teiid.

the class ValidationVisitor method visit.

@Override
public void visit(AlterProcedure obj) {
    GroupSymbol gs = obj.getTarget();
    validateAlterTarget(obj);
    try {
        if (!gs.isProcedure() || !getMetadata().isVirtualModel(getMetadata().getModelID(gs.getMetadataID()))) {
            // $NON-NLS-1$
            handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.not_a_procedure", gs), gs);
            return;
        }
        Validator.validate(obj.getDefinition(), getMetadata(), this);
        StoredProcedureInfo info = getMetadata().getStoredProcedureInfoForProcedure(gs.getName());
        for (SPParameter param : info.getParameters()) {
            if (param.getParameterType() == SPParameter.RESULT_SET) {
                QueryResolver.validateProjectedSymbols(gs, param.getResultSetColumns(), obj.getDefinition().getProjectedSymbols());
                break;
            }
        }
    } catch (QueryValidatorException e) {
        handleValidationError(e.getMessage(), obj.getDefinition().getBlock());
    } catch (TeiidComponentException e) {
        handleException(e);
    }
}
Also used : StoredProcedureInfo(org.teiid.query.metadata.StoredProcedureInfo) QueryValidatorException(org.teiid.api.exception.query.QueryValidatorException) TeiidComponentException(org.teiid.core.TeiidComponentException)

Example 94 with TeiidComponentException

use of org.teiid.core.TeiidComponentException in project teiid by teiid.

the class BufferManagerFactory method initBufferManager.

public static BufferManagerImpl initBufferManager(BufferManagerImpl bufferManager) {
    try {
        bufferManager.initialize();
        bufferManager.setUseWeakReferences(false);
        MemoryStorageManager storageManager = new MemoryStorageManager();
        SplittableStorageManager ssm = new SplittableStorageManager(storageManager);
        ssm.setMaxFileSizeDirect(MemoryStorageManager.MAX_FILE_SIZE);
        BufferFrontedFileStoreCache fsc = new BufferFrontedFileStoreCache();
        fsc.setBufferManager(bufferManager);
        // use conservative allocations
        // allow the space to be GCed easily
        fsc.setDirect(false);
        fsc.setMaxStorageObjectSize(1 << 20);
        fsc.setMemoryBufferSpace(1 << 21);
        fsc.setStorageManager(ssm);
        fsc.initialize();
        bufferManager.setCache(fsc);
        return bufferManager;
    } catch (TeiidComponentException e) {
        throw new RuntimeException(e);
    }
}
Also used : BufferFrontedFileStoreCache(org.teiid.common.buffer.impl.BufferFrontedFileStoreCache) SplittableStorageManager(org.teiid.common.buffer.impl.SplittableStorageManager) TeiidComponentException(org.teiid.core.TeiidComponentException) MemoryStorageManager(org.teiid.common.buffer.impl.MemoryStorageManager)

Example 95 with TeiidComponentException

use of org.teiid.core.TeiidComponentException in project teiid by teiid.

the class CorrelatedReferenceCollectorVisitor method visit.

// ############### Visitor methods for language objects ##################
/**
 * Visit a language object and collect symbols.  This method should <b>NOT</b> be
 * called directly.
 * @param obj Language object
 */
public void visit(Reference obj) {
    ElementSymbol e = obj.getExpression();
    if (e == null || !e.isExternalReference()) {
        return;
    }
    GroupSymbol g = e.getGroupSymbol();
    for (int i = this.outerGroups.size() - (queryRoot ? 2 : 1); i >= 0; i--) {
        GroupSymbol outer = this.outerGroups.get(i).get(g);
        if (outer == null) {
            continue;
        }
        try {
            if (ResolverUtil.resolveElementsInGroup(outer, metadata).contains(e)) {
                // add if correlated to the root groups
                if (i == 0) {
                    this.references.add(obj);
                }
                return;
            }
        } catch (TeiidComponentException e1) {
            throw new TeiidRuntimeException(e1);
        }
    }
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) GroupSymbol(org.teiid.query.sql.symbol.GroupSymbol) TeiidComponentException(org.teiid.core.TeiidComponentException) TeiidRuntimeException(org.teiid.core.TeiidRuntimeException)

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