Exemple #1
0
        public void TestGraphOuterJoins()
        {
            var descList = new OuterJoinDesc[2];

            descList[0] = SupportOuterJoinDescFactory.MakeDesc("IntPrimitive", "s0", "IntBoxed", "s1", OuterJoinType.RIGHT);
            descList[1] = SupportOuterJoinDescFactory.MakeDesc("SimpleProperty", "s2", "TheString", "s1", OuterJoinType.FULL);

            var graph = NStreamOuterQueryPlanBuilder.GraphOuterJoins(3, descList);

            // assert the inner and outer streams for each stream
            AssertInners(new int[][] { null, new int[] { 0, 2 }, new int[] { 1 } }, graph);
            AssertOuters(new int[][] { new int[] { 1 }, new int[] { 2 }, new int[] { 1 } }, graph);

            descList[0] = SupportOuterJoinDescFactory.MakeDesc("IntPrimitive", "s1", "IntBoxed", "s0", OuterJoinType.LEFT);
            descList[1] = SupportOuterJoinDescFactory.MakeDesc("SimpleProperty", "s2", "TheString", "s1", OuterJoinType.RIGHT);

            graph = NStreamOuterQueryPlanBuilder.GraphOuterJoins(3, descList);

            // assert the inner and outer streams for each stream
            AssertInners(new int[][] { new int[] { 1 }, null, new int[] { 1 } }, graph);
            AssertOuters(new int[][] { null, new int[] { 0, 2 }, null }, graph);

            try
            {
                NStreamOuterQueryPlanBuilder.GraphOuterJoins(3, new OuterJoinDesc[0]);
                Assert.Fail();
            }
            catch (ArgumentException)
            {
                // expected
            }
        }
Exemple #2
0
        public void TestAnalyze()
        {
            var descList = new OuterJoinDesc[2];

            descList[0] = SupportOuterJoinDescFactory.MakeDesc(
                container, "IntPrimitive", "s0", "IntBoxed", "s1", OuterJoinType.LEFT);
            descList[1] = SupportOuterJoinDescFactory.MakeDesc(
                container, "SimpleProperty", "s2", "TheString", "s1", OuterJoinType.LEFT);
            // simpleProperty in s2

            var graph = new QueryGraphForge(3, null, false);

            OuterJoinAnalyzer.Analyze(descList, graph);
            Assert.AreEqual(3, graph.NumStreams);

            Assert.IsTrue(graph.IsNavigableAtAll(0, 1));
            Assert.AreEqual(1, SupportQueryGraphTestUtil.GetStrictKeyProperties(graph, 0, 1).Length);
            Assert.AreEqual("IntPrimitive", SupportQueryGraphTestUtil.GetStrictKeyProperties(graph, 0, 1)[0]);
            Assert.AreEqual(1, SupportQueryGraphTestUtil.GetStrictKeyProperties(graph, 1, 0).Length);
            Assert.AreEqual("IntBoxed", SupportQueryGraphTestUtil.GetStrictKeyProperties(graph, 1, 0)[0]);

            Assert.IsTrue(graph.IsNavigableAtAll(1, 2));
            Assert.AreEqual("TheString", SupportQueryGraphTestUtil.GetStrictKeyProperties(graph, 1, 2)[0]);
            Assert.AreEqual("SimpleProperty", SupportQueryGraphTestUtil.GetStrictKeyProperties(graph, 2, 1)[0]);
        }
Exemple #3
0
        public void TestGetPlan()
        {
            var descList = new OuterJoinDesc[] {
                SupportOuterJoinDescFactory.MakeDesc("IntPrimitive", "s0", "IntBoxed", "s1", OuterJoinType.LEFT)
            };

            var queryGraph = new QueryGraph(2, null, false);
            var plan       = QueryPlanBuilder.GetPlan(_typesPerStream, new OuterJoinDesc[0], queryGraph, null, new HistoricalViewableDesc(5), _dependencyGraph, null, new StreamJoinAnalysisResult(2), true, null, null);

            AssertPlan(plan);

            plan = QueryPlanBuilder.GetPlan(_typesPerStream, descList, queryGraph, null, new HistoricalViewableDesc(5), _dependencyGraph, null, new StreamJoinAnalysisResult(2), true, null, null);
            AssertPlan(plan);

            FilterExprAnalyzer.Analyze(SupportExprNodeFactory.MakeEqualsNode(), queryGraph, false);
            plan = QueryPlanBuilder.GetPlan(_typesPerStream, descList, queryGraph, null, new HistoricalViewableDesc(5), _dependencyGraph, null, new StreamJoinAnalysisResult(2), true, null, null);
            AssertPlan(plan);

            plan = QueryPlanBuilder.GetPlan(_typesPerStream, new OuterJoinDesc[0], queryGraph, null, new HistoricalViewableDesc(5), _dependencyGraph, null, new StreamJoinAnalysisResult(2), true, null, null);
            AssertPlan(plan);
        }
Exemple #4
0
        public void TestGetPlan()
        {
            OuterJoinDesc[] descList =
            {
                SupportOuterJoinDescFactory.MakeDesc(
                    container, "IntPrimitive", "s0", "IntBoxed", "s1", OuterJoinType.LEFT)
            };

            var queryGraph = new QueryGraphForge(2, null, false);
            var plan       = QueryPlanBuilder.GetPlan(
                typesPerStream,
                new OuterJoinDesc[0],
                queryGraph,
                null,
                new HistoricalViewableDesc(5),
                dependencyGraph,
                null,
                new StreamJoinAnalysisResultCompileTime(2),
                true,
                null,
                null);

            AssertPlan(plan.Forge);

            plan = QueryPlanBuilder.GetPlan(
                typesPerStream,
                descList,
                queryGraph,
                null,
                new HistoricalViewableDesc(5),
                dependencyGraph,
                null,
                new StreamJoinAnalysisResultCompileTime(2),
                true,
                null,
                null);
            AssertPlan(plan.Forge);

            FilterExprAnalyzer.Analyze(SupportExprNodeFactory.GetInstance(container).MakeEqualsNode(), queryGraph, false);
            plan = QueryPlanBuilder.GetPlan(
                typesPerStream,
                descList,
                queryGraph,
                null,
                new HistoricalViewableDesc(5),
                dependencyGraph,
                null,
                new StreamJoinAnalysisResultCompileTime(2),
                true,
                null,
                null);
            AssertPlan(plan.Forge);

            plan = QueryPlanBuilder.GetPlan(
                typesPerStream,
                new OuterJoinDesc[0],
                queryGraph,
                null,
                new HistoricalViewableDesc(5),
                dependencyGraph,
                null,
                new StreamJoinAnalysisResultCompileTime(2),
                true,
                null,
                null);
            AssertPlan(plan.Forge);
        }