public String getQuery() { return p.getQueryPlan(); } }
public String getQuery() { return p.getQueryPlan(); } }
public String getQuery() { return p.getQueryPlan(); } }
static FunctionMethod replaceProcedureWithFunction(MetadataFactory factory, Procedure proc) throws MetadataException { if (proc.isFunction() && proc.getQueryPlan() != null) { return null; } FunctionMethod method = createFunctionMethod(proc); //remove the old proc factory.getSchema().getResolvingOrder().remove(factory.getSchema().getResolvingOrder().size() - 1); factory.getSchema().getProcedures().remove(proc.getName()); factory.getSchema().addFunction(method); return method; }
static FunctionMethod replaceProcedureWithFunction(MetadataFactory factory, Procedure proc) throws MetadataException { if (proc.isFunction() && proc.getQueryPlan() != null) { return null; } FunctionMethod method = createFunctionMethod(proc); //remove the old proc factory.getSchema().getResolvingOrder().remove(factory.getSchema().getResolvingOrder().size() - 1); factory.getSchema().getProcedures().remove(proc.getName()); factory.getSchema().addFunction(method); return method; }
static FunctionMethod replaceProcedureWithFunction(MetadataFactory factory, Procedure proc) throws MetadataException { if (proc.isFunction() && proc.getQueryPlan() != null) { return null; } FunctionMethod method = createFunctionMethod(proc); //remove the old proc factory.getSchema().getResolvingOrder().remove(factory.getSchema().getResolvingOrder().size() - 1); factory.getSchema().getProcedures().remove(proc.getName()); factory.getSchema().addFunction(method); return method; }
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 FunctionTree getFunctionProcedures(Schema schema) { UDFSource dummySource = new UDFSource(Collections.EMPTY_LIST); FunctionTree ft = null; for (Procedure p : schema.getProcedures().values()) { if (p.isFunction() && p.getQueryPlan() != null) { if (ft == null) { ft = new FunctionTree(schema.getName(), dummySource, false); } FunctionMethod fm = SQLParserUtil.createFunctionMethod(p); FunctionDescriptor fd = ft.addFunction(schema.getName(), dummySource, fm, false); fd.setProcedure(p); } } return ft; }
public static FunctionTree getFunctionProcedures(Schema schema) { UDFSource dummySource = new UDFSource(Collections.EMPTY_LIST); FunctionTree ft = null; for (Procedure p : schema.getProcedures().values()) { if (p.isFunction() && p.getQueryPlan() != null) { if (ft == null) { ft = new FunctionTree(schema.getName(), dummySource, false); } FunctionMethod fm = SQLParserUtil.createFunctionMethod(p); FunctionDescriptor fd = ft.addFunction(schema.getName(), dummySource, fm, false); fd.setProcedure(p); } } return ft; }
public static FunctionTree getFunctionProcedures(Schema schema) { UDFSource dummySource = new UDFSource(Collections.EMPTY_LIST); FunctionTree ft = null; for (Procedure p : schema.getProcedures().values()) { if (p.isFunction() && p.getQueryPlan() != null) { if (ft == null) { ft = new FunctionTree(schema.getName(), dummySource, false); } FunctionMethod fm = SQLParserUtil.createFunctionMethod(p); FunctionDescriptor fd = ft.addFunction(schema.getName(), dummySource, fm, false); fd.setProcedure(p); } } return ft; }
@Test public void testMultipleCommands() throws Exception { String ddl = "CREATE VIEW V1 AS SELECT * FROM PM1.G1; " + "CREATE PROCEDURE FOO(P1 integer) RETURNS (e1 integer, e2 varchar) AS SELECT * FROM PM1.G1;"; Schema s = helpParse(ddl, "model").getSchema(); Map<String, Table> tableMap = s.getTables(); Table table = tableMap.get("V1"); assertNotNull(table); assertEquals("SELECT * FROM PM1.G1", table.getSelectTransformation()); Map<String, Procedure> procedureMap = s.getProcedures(); Procedure p = procedureMap.get("FOO"); assertNotNull(p); assertEquals("SELECT * FROM PM1.G1;", p.getQueryPlan()); }
metadataValidator.log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31166, p.getFullName())); if (p.isVirtual() && p.getQueryPlan() == null) { metadataValidator.log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31167, p.getFullName()));
assertEquals("any", proc.getProperties().get("RANDOM")); assertEquals("/*+ cache */ BEGIN\nSELECT * FROM foo;\nEND", proc.getQueryPlan());
String plan = procedure.getQueryPlan(); append(plan);
Procedure p = (Procedure)record; if (p.isVirtual()) { if (p.getQueryPlan() == null) { metadataValidator.log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31081, p.getFullName(), model.getName()));
Procedure p = (Procedure)record; if (p.isVirtual()) { if (p.getQueryPlan() == null) { metadataValidator.log(report, model, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31081, p.getFullName(), model.getName()));
String plan = procedure.getQueryPlan(); append(plan);
String plan = procedure.getQueryPlan(); append(plan);