for (Schema schema:store.getSchemas().values()) { if (!schema.getProcedures().isEmpty()) { FunctionTree ft = FunctionTree.getFunctionProcedures(schema); for (MetadataStore s:additionalStores) { compositeStore.merge(s); for (Schema schema:s.getSchemas().values()) { if (!schema.getFunctions().isEmpty()) { UDFSource source = new UDFSource(schema.getFunctions().values());
private UDFMetaData getUDF() { UDFMetaData mergedUDF = new UDFMetaData(); if (this.udf != null) { mergedUDF.addFunctions(this.udf); } for (Schema schema:store.getSchemas().values()) { Collection<FunctionMethod> funcs = schema.getFunctions().values(); mergedUDF.addFunctions(schema.getName(), funcs); } if (this.cmr != null) { //system scoped common source functions for (ConnectorManager cm:this.cmr.getConnectorManagers().values()) { List<FunctionMethod> funcs = cm.getPushDownFunctions(); mergedUDF.addFunctions(CoreConstants.SYSTEM_MODEL, funcs); } } if (this.children != null) { //udf model functions - also scoped to the model for (CompositeVDB child:this.children.values()) { UDFMetaData funcs = child.getUDF(); if (funcs != null) { mergedUDF.addFunctions(funcs); } } } return mergedUDF; }
schemas.add(s); } else { mergedStore.getSchemas().remove(model.getName());
for (Schema schema:imf.store.getSchemas().values()) { if (!schema.getFunctions().isEmpty()) { UDFSource source = new UDFSource(schema.getFunctions().values());
@Test public void testNullDependentAgg1() throws Exception { MetadataStore ms = RealMetadataFactory.example1Store(); Schema s = ms.getSchemas().get("PM1"); FunctionMethod fm = addAgg(s, "myagg", CustomSum.class, DataTypeManager.DefaultDataTypes.STRING); fm.setNullOnNull(false);
@Test public void testNullDependentAggParitioned() throws Exception { MetadataStore ms = RealMetadataFactory.example1Store(); Schema s = ms.getSchemas().get("PM1"); FunctionMethod fm = addAgg(s, "myagg", SumAll.class, DataTypeManager.DefaultDataTypes.INTEGER); fm.setNullOnNull(false);
@Test public void testNullDependentAgg() throws Exception { MetadataStore ms = RealMetadataFactory.example1Store(); Schema s = ms.getSchemas().get("PM1"); FunctionMethod fm = addAgg(s, "myagg", SumAll.class, DataTypeManager.DefaultDataTypes.INTEGER); fm.setNullOnNull(false); fm.getAggregateAttributes().setDecomposable(true); TransformationMetadata metadata = RealMetadataFactory.createTransformationMetadata(ms, "test"); final String userSql = "SELECT myagg(e2) FROM (select e2, e1 as source_name from pm1.g1 union all select e2, e1 from pm2.g1) x"; //$NON-NLS-1$ BasicSourceCapabilities caps = TestAggregatePushdown.getAggregateCapabilities(); caps.setFunctionSupport("myagg", true); ProcessorPlan plan = TestOptimizer.helpPlan(userSql, metadata, new String[] {"SELECT myagg(ALL g_0.e2) FROM pm1.g1 AS g_0 HAVING COUNT(*) > 0", "SELECT myagg(ALL g_0.e2) FROM pm2.g1 AS g_0 HAVING COUNT(*) > 0"}, new DefaultCapabilitiesFinder(caps), ComparisonMode.EXACT_COMMAND_STRING); TestOptimizer.checkNodeTypes(plan, new int[] { 2, // Access 0, // DependentAccess 0, // DependentSelect 0, // DependentProject 0, // DupRemove 1, // Grouping 0, // NestedLoopJoinStrategy 0, // MergeJoinStrategy 0, // Null 0, // PlanExecution 1, // Project 0, // Select 0, // Sort 1 // UnionAll }); }
@Test public void testUserDefined() throws Exception { MetadataStore ms = RealMetadataFactory.example1Store(); Schema s = ms.getSchemas().get("PM1"); AggregateAttributes aa = addAgg(s, "myagg", SumAll.class, DataTypeManager.DefaultDataTypes.INTEGER).getAggregateAttributes(); addAgg(s, "myagg2", LongSumAll.class, DataTypeManager.DefaultDataTypes.LONG);