~akiban-technologies/akiban-server/trunk

« back to all changes in this revision

Viewing changes to src/test/java/com/akiban/server/test/it/qp/AncestorLookup_NestedIT.java

merge mmcm: Add lookahead option to AncestorLookup_Nested.

https://code.launchpad.net/~mmcm/akiban-server/ancestor-lookup-nested/+merge/176826

Show diffs side-by-side

added added

removed removed

Lines of Context:
100
100
        use(db);
101
101
    }
102
102
 
 
103
    protected int lookaheadQuantum() {
 
104
        return 1;
 
105
    }
 
106
 
103
107
    // Test argument validation
104
108
 
105
109
    @Test(expected = IllegalArgumentException.class)
106
110
    public void testALNGroupTableNull()
107
111
    {
108
 
        ancestorLookup_Nested(null, aValueIndexRowType, Collections.singleton(aRowType), 0);
 
112
        ancestorLookup_Nested(null, aValueIndexRowType, Collections.singleton(aRowType), 0, 1);
109
113
    }
110
114
 
111
115
    @Test(expected = IllegalArgumentException.class)
112
116
    public void testALNRowTypeNull()
113
117
    {
114
 
        ancestorLookup_Nested(rabc, null, Collections.singleton(aRowType), 0);
 
118
        ancestorLookup_Nested(rabc, null, Collections.singleton(aRowType), 0, 1);
115
119
    }
116
120
 
117
121
    @Test(expected = IllegalArgumentException.class)
118
122
    public void testALNAncestorTypesNull()
119
123
    {
120
 
        ancestorLookup_Nested(rabc, aValueIndexRowType, null, 0);
 
124
        ancestorLookup_Nested(rabc, aValueIndexRowType, null, 0, 1);
121
125
    }
122
126
 
123
127
    @Test(expected = IllegalArgumentException.class)
124
128
    public void testALNAncestorTypesEmpty()
125
129
    {
126
 
        ancestorLookup_Nested(rabc, aValueIndexRowType, Collections.<UserTableRowType>emptyList(), 0);
 
130
        ancestorLookup_Nested(rabc, aValueIndexRowType, Collections.<UserTableRowType>emptyList(), 0, 1);
127
131
    }
128
132
 
129
133
    @Test(expected = IllegalArgumentException.class)
130
134
    public void testALNBadBindingPosition()
131
135
    {
132
 
        ancestorLookup_Nested(rabc, aValueIndexRowType, Collections.singleton(aRowType), -1);
 
136
        ancestorLookup_Nested(rabc, aValueIndexRowType, Collections.singleton(aRowType), -1, 1);
133
137
    }
134
138
 
135
139
    // Test operator execution
140
144
        Operator plan =
141
145
            map_NestedLoops(
142
146
                indexScan_Default(aValueIndexRowType),
143
 
                ancestorLookup_Nested(rabc, aValueIndexRowType, Collections.singleton(aRowType), 0),
 
147
                ancestorLookup_Nested(rabc, aValueIndexRowType, Collections.singleton(aRowType), 0, lookaheadQuantum()),
144
148
                0, pipelineMap(), 1);
145
149
        Cursor cursor = cursor(plan, queryContext, queryBindings);
146
150
        RowBase[] expected = new RowBase[]{
158
162
        Operator plan =
159
163
            map_NestedLoops(
160
164
                indexScan_Default(aValueIndexRowType),
161
 
                ancestorLookup_Nested(rabc, aValueIndexRowType, Arrays.asList(aRowType, rRowType), 0),
 
165
                ancestorLookup_Nested(rabc, aValueIndexRowType, Arrays.asList(aRowType, rRowType), 0, lookaheadQuantum()),
162
166
                0, pipelineMap(), 1);
163
167
        Cursor cursor = cursor(plan, queryContext, queryBindings);
164
168
        RowBase[] expected = new RowBase[]{
180
184
        Operator plan =
181
185
            map_NestedLoops(
182
186
                indexScan_Default(aValueIndexRowType),
183
 
                ancestorLookup_Nested(rabc, aValueIndexRowType, Arrays.asList(rRowType, aRowType), 0),
 
187
                ancestorLookup_Nested(rabc, aValueIndexRowType, Arrays.asList(rRowType, aRowType), 0, lookaheadQuantum()),
184
188
                0, pipelineMap(), 1);
185
189
        Cursor cursor = cursor(plan, queryContext, queryBindings);
186
190
        RowBase[] expected = new RowBase[]{
203
207
            map_NestedLoops(
204
208
                map_NestedLoops(
205
209
                    indexScan_Default(aValueIndexRowType),
206
 
                    ancestorLookup_Nested(rabc, aValueIndexRowType, Arrays.asList(aRowType), 0),
 
210
                    ancestorLookup_Nested(rabc, aValueIndexRowType, Arrays.asList(aRowType), 0, lookaheadQuantum()),
207
211
                    0, pipelineMap(), 1),
208
 
                ancestorLookup_Nested(rabc, aRowType, Arrays.asList(rRowType), 1),
 
212
                ancestorLookup_Nested(rabc, aRowType, Arrays.asList(rRowType), 1, lookaheadQuantum()),
209
213
                1, pipelineMap(), 1);
210
214
        Cursor cursor = cursor(plan, queryContext, queryBindings);
211
215
        RowBase[] expected = new RowBase[]{
235
239
        Operator plan =
236
240
            map_NestedLoops(
237
241
                abIndexScan,
238
 
                ancestorLookup_Nested(rabc, abIndexScan.rowType(), Collections.singleton(rRowType), 0),
 
242
                ancestorLookup_Nested(rabc, abIndexScan.rowType(), Collections.singleton(rRowType), 0, lookaheadQuantum()),
239
243
                0, pipelineMap(), 1);
240
244
        Cursor cursor = cursor(plan, queryContext, queryBindings);
241
245
        RowBase[] expected = new RowBase[]{
271
275
        Operator plan =
272
276
            map_NestedLoops(
273
277
                abcIndexScan,
274
 
                ancestorLookup_Nested(rabc, abcIndexScan.rowType(), Collections.singleton(rRowType), 0),
 
278
                ancestorLookup_Nested(rabc, abcIndexScan.rowType(), Collections.singleton(rRowType), 0, lookaheadQuantum()),
275
279
                0, pipelineMap(), 1);
276
280
        Cursor cursor = cursor(plan, queryContext, queryBindings);
277
281
        RowBase[] expected = new RowBase[]{
286
290
        Operator plan =
287
291
            map_NestedLoops(
288
292
                indexScan_Default(aValueIndexRowType),
289
 
                ancestorLookup_Nested(rabc, aValueIndexRowType, Collections.singleton(aRowType), 0),
 
293
                ancestorLookup_Nested(rabc, aValueIndexRowType, Collections.singleton(aRowType), 0, lookaheadQuantum()),
290
294
                0, pipelineMap(), 1);
291
295
        CursorLifecycleTestCase testCase = new CursorLifecycleTestCase()
292
296
        {