private static void determineDependencies(Command command, Column c, int index, LinkedHashSet<AbstractMetadataRecord> columnValues) { if (command instanceof Query || command instanceof StoredProcedure) { Expression ex = command.getProjectedSymbols().get(index); collectDependencies(ex, columnValues); } else if (command instanceof SetQuery) { determineDependencies(((SetQuery)command).getLeftQuery(), c, index, columnValues); determineDependencies(((SetQuery)command).getRightQuery(), c, index, columnValues); } }
private static void determineDependencies(Command command, Column c, int index, LinkedHashSet<AbstractMetadataRecord> columnValues) { if (command instanceof Query) { Expression ex = command.getProjectedSymbols().get(index); collectDependencies(ex, columnValues); } else if (command instanceof SetQuery) { determineDependencies(((SetQuery)command).getLeftQuery(), c, index, columnValues); determineDependencies(((SetQuery)command).getRightQuery(), c, index, columnValues); } }
private static void determineDependencies(Command command, Column c, int index, LinkedHashSet<AbstractMetadataRecord> columnValues) { if (command instanceof Query || command instanceof StoredProcedure) { Expression ex = command.getProjectedSymbols().get(index); collectDependencies(ex, columnValues); } else if (command instanceof SetQuery) { determineDependencies(((SetQuery)command).getLeftQuery(), c, index, columnValues); determineDependencies(((SetQuery)command).getRightQuery(), c, index, columnValues); } }
public static void determineDependencies(AbstractMetadataRecord p, Command command) { LinkedHashSet<AbstractMetadataRecord> values = new LinkedHashSet<AbstractMetadataRecord>(); collectDependencies(command, values); p.setIncomingObjects(new ArrayList<AbstractMetadataRecord>(values)); if (p instanceof Table) { Table t = (Table)p; for (int i = 0; i < t.getColumns().size(); i++) { LinkedHashSet<AbstractMetadataRecord> columnValues = new LinkedHashSet<AbstractMetadataRecord>(); Column c = t.getColumns().get(i); c.setIncomingObjects(columnValues); determineDependencies(command, c, i, columnValues); } } }
Column c = t.getColumns().get(i); c.setIncomingObjects(columnValues); determineDependencies(command, c, i, columnValues);
Column c = t.getColumns().get(i); c.setIncomingObjects(columnValues); determineDependencies(command, c, i, columnValues);
public static void alterProcedureDefinition(final VDBMetaData vdb, final Procedure p, final String sql, boolean updateStore) { TransformationMetadata metadata = vdb.getAttachment(TransformationMetadata.class); DatabaseStore store = vdb.getAttachment(DatabaseStore.class); try { Command command = QueryParser.getQueryParser().parseProcedure(p.getQueryPlan(), false); QueryResolver.resolveCommand(command, new GroupSymbol(p.getFullName()), Command.TYPE_STORED_PROCEDURE, metadata, false); MetadataValidator.determineDependencies(p, command); } catch (TeiidException e) { //should have been caught in validation, but this logic //is also not mature so since there is no lock on the vdb //it is possible that the plan is no longer valid at this point due //to a concurrent execution } p.setQueryPlan(sql); p.setLastModified(System.currentTimeMillis()); metadata.addToMetadataCache(p, "transformation/"+StoredProcedure.class.getSimpleName().toUpperCase(), null); //$NON-NLS-1$ }
public static void alterProcedureDefinition(final VDBMetaData vdb, final Procedure p, final String sql, boolean updateStore) { TransformationMetadata metadata = vdb.getAttachment(TransformationMetadata.class); DatabaseStore store = vdb.getAttachment(DatabaseStore.class); try { Command command = QueryParser.getQueryParser().parseProcedure(p.getQueryPlan(), false); QueryResolver.resolveCommand(command, new GroupSymbol(p.getFullName()), Command.TYPE_STORED_PROCEDURE, metadata, false); MetadataValidator.determineDependencies(p, command); } catch (TeiidException e) { //should have been caught in validation, but this logic //is also not mature so since there is no lock on the vdb //it is possible that the plan is no longer valid at this point due //to a concurrent execution } p.setQueryPlan(sql); p.setLastModified(System.currentTimeMillis()); metadata.addToMetadataCache(p, "transformation/"+StoredProcedure.class.getSimpleName().toUpperCase(), null); //$NON-NLS-1$ }
public static void alterProcedureDefinition(final VDBMetaData vdb, final Procedure p, final String sql, boolean updateStore) { TransformationMetadata metadata = vdb.getAttachment(TransformationMetadata.class); DatabaseStore store = vdb.getAttachment(DatabaseStore.class); try { Command command = QueryParser.getQueryParser().parseProcedure(p.getQueryPlan(), false); QueryResolver.resolveCommand(command, new GroupSymbol(p.getFullName()), Command.TYPE_STORED_PROCEDURE, metadata, false); MetadataValidator.determineDependencies(p, command); } catch (TeiidException e) { //should have been caught in validation, but this logic //is also not mature so since there is no lock on the vdb //it is possible that the plan is no longer valid at this point due //to a concurrent execution } p.setQueryPlan(sql); p.setLastModified(System.currentTimeMillis()); metadata.addToMetadataCache(p, "transformation/"+StoredProcedure.class.getSimpleName().toUpperCase(), null); //$NON-NLS-1$ }
public static void alterView(final VDBMetaData vdb, final Table t, final String sql, boolean updateStore) { TransformationMetadata metadata = vdb.getAttachment(TransformationMetadata.class); DatabaseStore store = vdb.getAttachment(DatabaseStore.class); try { Command command = QueryParser.getQueryParser().parseCommand(t.getSelectTransformation()); QueryResolver.resolveCommand(command, metadata); MetadataValidator.determineDependencies(t, command); } catch (TeiidException e) { //should have been caught in validation, but this logic //is also not mature so since there is no lock on the vdb //it is possible that the plan is no longer valid at this point due //to a concurrent execution } t.setSelectTransformation(sql); t.setLastModified(System.currentTimeMillis()); metadata.addToMetadataCache(t, "transformation/"+SQLConstants.Reserved.SELECT, null); //$NON-NLS-1$ }
public static void alterView(final VDBMetaData vdb, final Table t, final String sql, boolean updateStore) { TransformationMetadata metadata = vdb.getAttachment(TransformationMetadata.class); DatabaseStore store = vdb.getAttachment(DatabaseStore.class); try { Command command = QueryParser.getQueryParser().parseCommand(t.getSelectTransformation()); QueryResolver.resolveCommand(command, metadata); MetadataValidator.determineDependencies(t, command); } catch (TeiidException e) { //should have been caught in validation, but this logic //is also not mature so since there is no lock on the vdb //it is possible that the plan is no longer valid at this point due //to a concurrent execution } t.setSelectTransformation(sql); t.setLastModified(System.currentTimeMillis()); metadata.addToMetadataCache(t, "transformation/"+SQLConstants.Reserved.SELECT, null); //$NON-NLS-1$ }
public static void alterView(final VDBMetaData vdb, final Table t, final String sql, boolean updateStore) { TransformationMetadata metadata = vdb.getAttachment(TransformationMetadata.class); DatabaseStore store = vdb.getAttachment(DatabaseStore.class); try { Command command = QueryParser.getQueryParser().parseCommand(t.getSelectTransformation()); QueryResolver.resolveCommand(command, metadata); MetadataValidator.determineDependencies(t, command); } catch (TeiidException e) { //should have been caught in validation, but this logic //is also not mature so since there is no lock on the vdb //it is possible that the plan is no longer valid at this point due //to a concurrent execution } t.setSelectTransformation(sql); t.setLastModified(System.currentTimeMillis()); metadata.addToMetadataCache(t, "transformation/"+SQLConstants.Reserved.SELECT, null); //$NON-NLS-1$ }
QueryResolver.resolveCommand(command, new GroupSymbol(p.getFullName()), Command.TYPE_STORED_PROCEDURE, metadata, false); resolverReport = Validator.validate(command, metadata); determineDependencies(p, command); } else if (record instanceof Table) { Table t = (Table)record; determineDependencies(t, command); if (t.getInsertPlan() != null && t.isInsertPlanEnabled()) { validateUpdatePlan(model, report, metadata, t, t.getInsertPlan(), Command.TYPE_INSERT);
QueryResolver.resolveCommand(command, new GroupSymbol(p.getFullName()), Command.TYPE_STORED_PROCEDURE, metadata, false); resolverReport = Validator.validate(command, metadata); determineDependencies(p, command); } else if (record instanceof Table) { Table t = (Table)record; determineDependencies(t, command); if (t.getInsertPlan() != null && t.isInsertPlanEnabled()) { validateUpdatePlan(model, report, metadata, t, t.getInsertPlan(), Command.TYPE_INSERT);
QueryResolver.resolveCommand(command, new GroupSymbol(p.getFullName()), Command.TYPE_STORED_PROCEDURE, metadata, false); resolverReport = Validator.validate(command, metadata); determineDependencies(p, command); } else if (record instanceof Table) { Table t = (Table)record; determineDependencies(t, command); if (t.getInsertPlan() != null && t.isInsertPlanEnabled()) { validateUpdatePlan(model, report, metadata, t, t.getInsertPlan(), Command.TYPE_INSERT);