Merge lp:~mmcm/akiban-server/pipeline-spatial-index-scan into lp:~akiban-technologies/akiban-server/trunk
- pipeline-spatial-index-scan
- Merge into trunk
Proposed by
Mike McMahon
Status: | Merged |
---|---|
Approved by: | Thomas Jones-Low |
Approved revision: | 2710 |
Merged at revision: | 2705 |
Proposed branch: | lp:~mmcm/akiban-server/pipeline-spatial-index-scan |
Merge into: | lp:~akiban-technologies/akiban-server/trunk |
Diff against target: |
518 lines (+154/-40) 17 files modified
src/main/java/com/akiban/qp/memoryadapter/MemoryAdapter.java (+1/-1) src/main/java/com/akiban/qp/operator/API.java (+14/-0) src/main/java/com/akiban/qp/operator/IndexScan_Default.java (+2/-2) src/main/java/com/akiban/qp/operator/StoreAdapter.java (+2/-1) src/main/java/com/akiban/qp/persistitadapter/PersistitAdapter.java (+3/-2) src/main/java/com/akiban/qp/persistitadapter/PersistitIndexCursor.java (+3/-2) src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursor.java (+3/-2) src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorSpatial_InBox.java (+5/-4) src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorSpatial_NearPoint.java (+4/-8) src/main/java/com/akiban/qp/persistitadapter/indexcursor/PersistitSorter.java (+1/-1) src/main/java/com/akiban/qp/util/MultiCursor.java (+18/-4) src/test/java/com/akiban/qp/operator/OperatorTestHelper.java (+2/-1) src/test/java/com/akiban/server/test/it/qp/MultiCursorIT.java (+26/-2) src/test/java/com/akiban/server/test/it/qp/SpatialLatLonGroupIndexScanIT.java (+7/-3) src/test/java/com/akiban/server/test/it/qp/SpatialLatLonGroupIndexScanLookaheadIT.java (+26/-0) src/test/java/com/akiban/server/test/it/qp/SpatialLatLonTableIndexScanIT.java (+11/-7) src/test/java/com/akiban/server/test/it/qp/SpatialLatLonTableIndexScanLookaheadIT.java (+26/-0) |
To merge this branch: | bzr merge lp:~mmcm/akiban-server/pipeline-spatial-index-scan |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Thomas Jones-Low | Approve | ||
Review via email: mp+175656@code.launchpad.net |
Commit message
Description of the change
Pipelining for spatial index scans.
For near point, all subcursors are already being opened at the same time. But the code needs to be adjusted a little to not try to read from any of them then.
For box, add an option to MultiCursor to open all cursors at once. And plumb it around from the IndexScan Cursors, which decide based on whether they are in lookahead mode or not.
To post a comment you must log in.
- 2710. By Mike McMahon
-
Forgot the @Override.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/main/java/com/akiban/qp/memoryadapter/MemoryAdapter.java' | |||
2 | --- src/main/java/com/akiban/qp/memoryadapter/MemoryAdapter.java 2013-07-09 20:37:04 +0000 | |||
3 | +++ src/main/java/com/akiban/qp/memoryadapter/MemoryAdapter.java 2013-07-18 20:08:26 +0000 | |||
4 | @@ -75,7 +75,7 @@ | |||
5 | 75 | @Override | 75 | @Override |
6 | 76 | public RowCursor newIndexCursor(QueryContext context, Index index, | 76 | public RowCursor newIndexCursor(QueryContext context, Index index, |
7 | 77 | IndexKeyRange keyRange, Ordering ordering, | 77 | IndexKeyRange keyRange, Ordering ordering, |
9 | 78 | IndexScanSelector scanSelector, boolean usePValues) { | 78 | IndexScanSelector scanSelector, boolean usePValues, boolean openAllSubCursors) { |
10 | 79 | 79 | ||
11 | 80 | Table table = index.rootMostTable(); | 80 | Table table = index.rootMostTable(); |
12 | 81 | if (table.isUserTable()) { | 81 | if (table.isUserTable()) { |
13 | 82 | 82 | ||
14 | === modified file 'src/main/java/com/akiban/qp/operator/API.java' | |||
15 | --- src/main/java/com/akiban/qp/operator/API.java 2013-07-17 20:34:35 +0000 | |||
16 | +++ src/main/java/com/akiban/qp/operator/API.java 2013-07-18 20:08:26 +0000 | |||
17 | @@ -419,6 +419,20 @@ | |||
18 | 419 | 419 | ||
19 | 420 | public static Operator indexScan_Default(IndexRowType indexType, | 420 | public static Operator indexScan_Default(IndexRowType indexType, |
20 | 421 | IndexKeyRange indexKeyRange, | 421 | IndexKeyRange indexKeyRange, |
21 | 422 | int lookaheadQuantum) | ||
22 | 423 | { | ||
23 | 424 | Ordering ordering = new Ordering(); | ||
24 | 425 | int fields = indexType.nFields(); | ||
25 | 426 | for (int f = 0; f < fields; f++) { | ||
26 | 427 | ordering.append(new TPreparedField(indexType.typeInstanceAt(f), f), true); | ||
27 | 428 | } | ||
28 | 429 | IndexScanSelector indexScanSelector = IndexScanSelector.leftJoinAfter(indexType.index(), | ||
29 | 430 | indexType.tableType().userTable()); | ||
30 | 431 | return indexScan_Default(indexType, indexKeyRange, ordering, indexScanSelector, lookaheadQuantum); | ||
31 | 432 | } | ||
32 | 433 | |||
33 | 434 | public static Operator indexScan_Default(IndexRowType indexType, | ||
34 | 435 | IndexKeyRange indexKeyRange, | ||
35 | 422 | Ordering ordering, | 436 | Ordering ordering, |
36 | 423 | IndexScanSelector indexScanSelector, | 437 | IndexScanSelector indexScanSelector, |
37 | 424 | int lookaheadQuantum) | 438 | int lookaheadQuantum) |
38 | 425 | 439 | ||
39 | === modified file 'src/main/java/com/akiban/qp/operator/IndexScan_Default.java' | |||
40 | --- src/main/java/com/akiban/qp/operator/IndexScan_Default.java 2013-07-15 21:16:57 +0000 | |||
41 | +++ src/main/java/com/akiban/qp/operator/IndexScan_Default.java 2013-07-18 20:08:26 +0000 | |||
42 | @@ -374,7 +374,7 @@ | |||
43 | 374 | { | 374 | { |
44 | 375 | super(context, bindingsCursor); | 375 | super(context, bindingsCursor); |
45 | 376 | UserTable table = (UserTable)index.rootMostTable(); | 376 | UserTable table = (UserTable)index.rootMostTable(); |
47 | 377 | this.cursor = adapter(table).newIndexCursor(context, index, indexKeyRange, ordering, scanSelector, usePValues); | 377 | this.cursor = adapter(table).newIndexCursor(context, index, indexKeyRange, ordering, scanSelector, usePValues, false); |
48 | 378 | } | 378 | } |
49 | 379 | 379 | ||
50 | 380 | // Object state | 380 | // Object state |
51 | @@ -576,7 +576,7 @@ | |||
52 | 576 | UserTable table = (UserTable)index.rootMostTable(); | 576 | UserTable table = (UserTable)index.rootMostTable(); |
53 | 577 | StoreAdapter adapter = adapter(table); | 577 | StoreAdapter adapter = adapter(table); |
54 | 578 | for (int i = 0; i < quantum; i++) { | 578 | for (int i = 0; i < quantum; i++) { |
56 | 579 | RowCursor cursor = adapter.newIndexCursor(context, index, indexKeyRange, ordering, scanSelector, usePValues); | 579 | RowCursor cursor = adapter.newIndexCursor(context, index, indexKeyRange, ordering, scanSelector, usePValues, true); |
57 | 580 | cursorPool.add(cursor); | 580 | cursorPool.add(cursor); |
58 | 581 | } | 581 | } |
59 | 582 | } | 582 | } |
60 | 583 | 583 | ||
61 | === modified file 'src/main/java/com/akiban/qp/operator/StoreAdapter.java' | |||
62 | --- src/main/java/com/akiban/qp/operator/StoreAdapter.java 2013-07-09 20:37:04 +0000 | |||
63 | +++ src/main/java/com/akiban/qp/operator/StoreAdapter.java 2013-07-18 20:08:26 +0000 | |||
64 | @@ -57,7 +57,8 @@ | |||
65 | 57 | IndexKeyRange keyRange, | 57 | IndexKeyRange keyRange, |
66 | 58 | API.Ordering ordering, | 58 | API.Ordering ordering, |
67 | 59 | IndexScanSelector scanSelector, | 59 | IndexScanSelector scanSelector, |
69 | 60 | boolean usePValues); | 60 | boolean usePValues, |
70 | 61 | boolean openAllSubCursors); | ||
71 | 61 | 62 | ||
72 | 62 | public abstract <HKEY extends com.akiban.qp.row.HKey> HKEY newHKey(HKey hKeyMetadata); | 63 | public abstract <HKEY extends com.akiban.qp.row.HKey> HKEY newHKey(HKey hKeyMetadata); |
73 | 63 | 64 | ||
74 | 64 | 65 | ||
75 | === modified file 'src/main/java/com/akiban/qp/persistitadapter/PersistitAdapter.java' | |||
76 | --- src/main/java/com/akiban/qp/persistitadapter/PersistitAdapter.java 2013-07-13 17:12:00 +0000 | |||
77 | +++ src/main/java/com/akiban/qp/persistitadapter/PersistitAdapter.java 2013-07-18 20:08:26 +0000 | |||
78 | @@ -72,14 +72,15 @@ | |||
79 | 72 | 72 | ||
80 | 73 | @Override | 73 | @Override |
81 | 74 | public RowCursor newIndexCursor(QueryContext context, Index index, IndexKeyRange keyRange, API.Ordering ordering, | 74 | public RowCursor newIndexCursor(QueryContext context, Index index, IndexKeyRange keyRange, API.Ordering ordering, |
83 | 75 | IndexScanSelector selector, boolean usePValues) | 75 | IndexScanSelector selector, boolean usePValues, boolean openAllSubCursors) |
84 | 76 | { | 76 | { |
85 | 77 | return new PersistitIndexCursor(context, | 77 | return new PersistitIndexCursor(context, |
86 | 78 | schema.indexRowType(index), | 78 | schema.indexRowType(index), |
87 | 79 | keyRange, | 79 | keyRange, |
88 | 80 | ordering, | 80 | ordering, |
89 | 81 | selector, | 81 | selector, |
91 | 82 | usePValues); | 82 | usePValues, |
92 | 83 | openAllSubCursors); | ||
93 | 83 | } | 84 | } |
94 | 84 | 85 | ||
95 | 85 | @Override | 86 | @Override |
96 | 86 | 87 | ||
97 | === modified file 'src/main/java/com/akiban/qp/persistitadapter/PersistitIndexCursor.java' | |||
98 | --- src/main/java/com/akiban/qp/persistitadapter/PersistitIndexCursor.java 2013-07-09 17:26:33 +0000 | |||
99 | +++ src/main/java/com/akiban/qp/persistitadapter/PersistitIndexCursor.java 2013-07-18 20:08:26 +0000 | |||
100 | @@ -116,7 +116,8 @@ | |||
101 | 116 | IndexKeyRange keyRange, | 116 | IndexKeyRange keyRange, |
102 | 117 | API.Ordering ordering, | 117 | API.Ordering ordering, |
103 | 118 | IndexScanSelector selector, | 118 | IndexScanSelector selector, |
105 | 119 | boolean usePValues) | 119 | boolean usePValues, |
106 | 120 | boolean openAllSubCursors) | ||
107 | 120 | { | 121 | { |
108 | 121 | this.keyRange = keyRange; | 122 | this.keyRange = keyRange; |
109 | 122 | this.ordering = ordering; | 123 | this.ordering = ordering; |
110 | @@ -127,7 +128,7 @@ | |||
111 | 127 | this.selector = selector; | 128 | this.selector = selector; |
112 | 128 | this.idle = true; | 129 | this.idle = true; |
113 | 129 | this.rowState = context.getStore().createIterationHelper(indexRowType); | 130 | this.rowState = context.getStore().createIterationHelper(indexRowType); |
115 | 130 | this.indexCursor = IndexCursor.create(context, keyRange, ordering, rowState, usePValues); | 131 | this.indexCursor = IndexCursor.create(context, keyRange, ordering, rowState, usePValues, openAllSubCursors); |
116 | 131 | } | 132 | } |
117 | 132 | 133 | ||
118 | 133 | // For use by this class | 134 | // For use by this class |
119 | 134 | 135 | ||
120 | === modified file 'src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursor.java' | |||
121 | --- src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursor.java 2013-07-09 00:42:04 +0000 | |||
122 | +++ src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursor.java 2013-07-18 20:08:26 +0000 | |||
123 | @@ -128,7 +128,8 @@ | |||
124 | 128 | IndexKeyRange keyRange, | 128 | IndexKeyRange keyRange, |
125 | 129 | API.Ordering ordering, | 129 | API.Ordering ordering, |
126 | 130 | IterationHelper iterationHelper, | 130 | IterationHelper iterationHelper, |
128 | 131 | boolean usePValues) | 131 | boolean usePValues, |
129 | 132 | boolean openAllSubCursors) | ||
130 | 132 | { | 133 | { |
131 | 133 | SortKeyAdapter<?, ?> adapter = | 134 | SortKeyAdapter<?, ?> adapter = |
132 | 134 | usePValues | 135 | usePValues |
133 | @@ -138,7 +139,7 @@ | |||
134 | 138 | keyRange != null && keyRange.spatial() | 139 | keyRange != null && keyRange.spatial() |
135 | 139 | ? keyRange.hi() == null | 140 | ? keyRange.hi() == null |
136 | 140 | ? IndexCursorSpatial_NearPoint.create(context, iterationHelper, keyRange) | 141 | ? IndexCursorSpatial_NearPoint.create(context, iterationHelper, keyRange) |
138 | 141 | : IndexCursorSpatial_InBox.create(context, iterationHelper, keyRange) | 142 | : IndexCursorSpatial_InBox.create(context, iterationHelper, keyRange, openAllSubCursors) |
139 | 142 | : ordering.allAscending() || ordering.allDescending() | 143 | : ordering.allAscending() || ordering.allDescending() |
140 | 143 | ? (keyRange != null && keyRange.lexicographic() | 144 | ? (keyRange != null && keyRange.lexicographic() |
141 | 144 | ? IndexCursorUnidirectionalLexicographic.create(context, iterationHelper, keyRange, ordering, adapter) | 145 | ? IndexCursorUnidirectionalLexicographic.create(context, iterationHelper, keyRange, ordering, adapter) |
142 | 145 | 146 | ||
143 | === modified file 'src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorSpatial_InBox.java' | |||
144 | --- src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorSpatial_InBox.java 2013-07-09 17:26:33 +0000 | |||
145 | +++ src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorSpatial_InBox.java 2013-07-18 20:08:26 +0000 | |||
146 | @@ -93,18 +93,19 @@ | |||
147 | 93 | 93 | ||
148 | 94 | public static IndexCursorSpatial_InBox create(QueryContext context, | 94 | public static IndexCursorSpatial_InBox create(QueryContext context, |
149 | 95 | IterationHelper iterationHelper, | 95 | IterationHelper iterationHelper, |
151 | 96 | IndexKeyRange keyRange) | 96 | IndexKeyRange keyRange, |
152 | 97 | boolean openAll) | ||
153 | 97 | { | 98 | { |
155 | 98 | return new IndexCursorSpatial_InBox(context, iterationHelper, keyRange); | 99 | return new IndexCursorSpatial_InBox(context, iterationHelper, keyRange, openAll); |
156 | 99 | } | 100 | } |
157 | 100 | 101 | ||
158 | 101 | // For use by this class | 102 | // For use by this class |
159 | 102 | 103 | ||
161 | 103 | private IndexCursorSpatial_InBox(QueryContext context, IterationHelper iterationHelper, IndexKeyRange keyRange) | 104 | private IndexCursorSpatial_InBox(QueryContext context, IterationHelper iterationHelper, IndexKeyRange keyRange, boolean openAll) |
162 | 104 | { | 105 | { |
163 | 105 | super(context, iterationHelper); | 106 | super(context, iterationHelper); |
164 | 106 | assert keyRange.spatial(); | 107 | assert keyRange.spatial(); |
166 | 107 | this.multiCursor = new MultiCursor(); | 108 | this.multiCursor = new MultiCursor(openAll); |
167 | 108 | this.iterationHelper = iterationHelper; | 109 | this.iterationHelper = iterationHelper; |
168 | 109 | Index spatialIndex = keyRange.indexRowType().index(); | 110 | Index spatialIndex = keyRange.indexRowType().index(); |
169 | 110 | assert spatialIndex.isSpatial() : spatialIndex; | 111 | assert spatialIndex.isSpatial() : spatialIndex; |
170 | 111 | 112 | ||
171 | === modified file 'src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorSpatial_NearPoint.java' | |||
172 | --- src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorSpatial_NearPoint.java 2013-07-09 17:26:33 +0000 | |||
173 | +++ src/main/java/com/akiban/qp/persistitadapter/indexcursor/IndexCursorSpatial_NearPoint.java 2013-07-18 20:08:26 +0000 | |||
174 | @@ -51,16 +51,11 @@ | |||
175 | 51 | { | 51 | { |
176 | 52 | super.open(); | 52 | super.open(); |
177 | 53 | // iterationHelper.closeIteration() closes the PersistitIndexCursor, releasing its Exchange. | 53 | // iterationHelper.closeIteration() closes the PersistitIndexCursor, releasing its Exchange. |
178 | 54 | // This iteration uses the Exchanges in the IndexScanRowStates owned by each cursor of the MultiCursor. | ||
179 | 55 | iterationHelper.closeIteration(); | 54 | iterationHelper.closeIteration(); |
180 | 56 | geCursor.open(); | 55 | geCursor.open(); |
184 | 57 | geRow = geCursor.next(); | 56 | geNeedToAdvance = true; |
182 | 58 | geDistance = distanceFromStart(geRow); | ||
183 | 59 | geNeedToAdvance = false; | ||
185 | 60 | ltCursor.open(); | 57 | ltCursor.open(); |
189 | 61 | ltRow = ltCursor.next(); | 58 | ltNeedToAdvance = true; |
187 | 62 | ltDistance = distanceFromStart(ltRow); | ||
188 | 63 | ltNeedToAdvance = false; | ||
190 | 64 | } | 59 | } |
191 | 65 | 60 | ||
192 | 66 | @Override | 61 | @Override |
193 | @@ -72,7 +67,8 @@ | |||
194 | 72 | geRow = geCursor.next(); | 67 | geRow = geCursor.next(); |
195 | 73 | geDistance = distanceFromStart(geRow); | 68 | geDistance = distanceFromStart(geRow); |
196 | 74 | geNeedToAdvance = false; | 69 | geNeedToAdvance = false; |
198 | 75 | } else if (ltNeedToAdvance) { | 70 | } |
199 | 71 | if (ltNeedToAdvance) { | ||
200 | 76 | ltRow = ltCursor.next(); | 72 | ltRow = ltCursor.next(); |
201 | 77 | ltDistance = distanceFromStart(ltRow); | 73 | ltDistance = distanceFromStart(ltRow); |
202 | 78 | ltNeedToAdvance = false; | 74 | ltNeedToAdvance = false; |
203 | 79 | 75 | ||
204 | === modified file 'src/main/java/com/akiban/qp/persistitadapter/indexcursor/PersistitSorter.java' | |||
205 | --- src/main/java/com/akiban/qp/persistitadapter/indexcursor/PersistitSorter.java 2013-07-16 18:27:15 +0000 | |||
206 | +++ src/main/java/com/akiban/qp/persistitadapter/indexcursor/PersistitSorter.java 2013-07-18 20:08:26 +0000 | |||
207 | @@ -147,7 +147,7 @@ | |||
208 | 147 | private RowCursor cursor() | 147 | private RowCursor cursor() |
209 | 148 | { | 148 | { |
210 | 149 | exchange.clear(); | 149 | exchange.clear(); |
212 | 150 | IndexCursor indexCursor = IndexCursor.create(context, null, ordering, iterationHelper, usePValues); | 150 | IndexCursor indexCursor = IndexCursor.create(context, null, ordering, iterationHelper, usePValues, false); |
213 | 151 | indexCursor.rebind(bindings); | 151 | indexCursor.rebind(bindings); |
214 | 152 | return indexCursor; | 152 | return indexCursor; |
215 | 153 | } | 153 | } |
216 | 154 | 154 | ||
217 | === modified file 'src/main/java/com/akiban/qp/util/MultiCursor.java' | |||
218 | --- src/main/java/com/akiban/qp/util/MultiCursor.java 2013-07-09 19:53:07 +0000 | |||
219 | +++ src/main/java/com/akiban/qp/util/MultiCursor.java 2013-07-18 20:08:26 +0000 | |||
220 | @@ -34,9 +34,12 @@ | |||
221 | 34 | @Override | 34 | @Override |
222 | 35 | public void open() | 35 | public void open() |
223 | 36 | { | 36 | { |
227 | 37 | sealed = false; | 37 | sealed = true; |
228 | 38 | // TODO: Have a mode where all the cursors get opened so that | 38 | if (openAll) { |
229 | 39 | // they can start in parallel. | 39 | for (RowCursor cursor : cursors) { |
230 | 40 | cursor.open(); | ||
231 | 41 | } | ||
232 | 42 | } | ||
233 | 40 | cursorIterator = cursors.iterator(); | 43 | cursorIterator = cursors.iterator(); |
234 | 41 | startNextCursor(); | 44 | startNextCursor(); |
235 | 42 | } | 45 | } |
236 | @@ -109,6 +112,14 @@ | |||
237 | 109 | 112 | ||
238 | 110 | // MultiCursor interface | 113 | // MultiCursor interface |
239 | 111 | 114 | ||
240 | 115 | public MultiCursor() { | ||
241 | 116 | this(false); | ||
242 | 117 | } | ||
243 | 118 | |||
244 | 119 | public MultiCursor(boolean openAll) { | ||
245 | 120 | this.openAll = openAll; | ||
246 | 121 | } | ||
247 | 122 | |||
248 | 112 | public void addCursor(RowCursor cursor) | 123 | public void addCursor(RowCursor cursor) |
249 | 113 | { | 124 | { |
250 | 114 | if (sealed) { | 125 | if (sealed) { |
251 | @@ -126,7 +137,9 @@ | |||
252 | 126 | current.close(); | 137 | current.close(); |
253 | 127 | } | 138 | } |
254 | 128 | current = cursorIterator.next(); | 139 | current = cursorIterator.next(); |
256 | 129 | current.open(); | 140 | if (!openAll) { |
257 | 141 | current.open(); | ||
258 | 142 | } | ||
259 | 130 | } else { | 143 | } else { |
260 | 131 | current = null; | 144 | current = null; |
261 | 132 | } | 145 | } |
262 | @@ -135,6 +148,7 @@ | |||
263 | 135 | // Object state | 148 | // Object state |
264 | 136 | 149 | ||
265 | 137 | private final List<RowCursor> cursors = new ArrayList<>(); | 150 | private final List<RowCursor> cursors = new ArrayList<>(); |
266 | 151 | private final boolean openAll; | ||
267 | 138 | private boolean sealed = false; | 152 | private boolean sealed = false; |
268 | 139 | private Iterator<RowCursor> cursorIterator; | 153 | private Iterator<RowCursor> cursorIterator; |
269 | 140 | private RowCursor current; | 154 | private RowCursor current; |
270 | 141 | 155 | ||
271 | === modified file 'src/test/java/com/akiban/qp/operator/OperatorTestHelper.java' | |||
272 | --- src/test/java/com/akiban/qp/operator/OperatorTestHelper.java 2013-07-09 20:37:04 +0000 | |||
273 | +++ src/test/java/com/akiban/qp/operator/OperatorTestHelper.java 2013-07-18 20:08:26 +0000 | |||
274 | @@ -193,7 +193,8 @@ | |||
275 | 193 | IndexKeyRange keyRange, | 193 | IndexKeyRange keyRange, |
276 | 194 | API.Ordering ordering, | 194 | API.Ordering ordering, |
277 | 195 | IndexScanSelector selector, | 195 | IndexScanSelector selector, |
279 | 196 | boolean usePValues) | 196 | boolean usePValues, |
280 | 197 | boolean openAllSubCursors) | ||
281 | 197 | { | 198 | { |
282 | 198 | throw new UnsupportedOperationException(); | 199 | throw new UnsupportedOperationException(); |
283 | 199 | } | 200 | } |
284 | 200 | 201 | ||
285 | === modified file 'src/test/java/com/akiban/server/test/it/qp/MultiCursorIT.java' | |||
286 | --- src/test/java/com/akiban/server/test/it/qp/MultiCursorIT.java 2013-07-09 20:37:04 +0000 | |||
287 | +++ src/test/java/com/akiban/server/test/it/qp/MultiCursorIT.java 2013-07-18 20:08:26 +0000 | |||
288 | @@ -50,6 +50,14 @@ | |||
289 | 50 | queryBindings = queryContext.createBindings(); | 50 | queryBindings = queryContext.createBindings(); |
290 | 51 | } | 51 | } |
291 | 52 | 52 | ||
292 | 53 | @Test(expected=IllegalStateException.class) | ||
293 | 54 | public void testSealed() | ||
294 | 55 | { | ||
295 | 56 | MultiCursor multiCursor = multiCursor(); | ||
296 | 57 | multiCursor.open(); | ||
297 | 58 | multiCursor.addCursor(new TestCursor(new int[]{})); | ||
298 | 59 | } | ||
299 | 60 | |||
300 | 53 | @Test | 61 | @Test |
301 | 54 | public void testNoCursors() | 62 | public void testNoCursors() |
302 | 55 | { | 63 | { |
303 | @@ -84,7 +92,18 @@ | |||
304 | 84 | @Test | 92 | @Test |
305 | 85 | public void testMultipleCursors() | 93 | public void testMultipleCursors() |
306 | 86 | { | 94 | { |
308 | 87 | RowCursor multiCursor = multiCursor(new TestCursor(new int[]{}), | 95 | testMultipleCursors(false); |
309 | 96 | } | ||
310 | 97 | |||
311 | 98 | @Test | ||
312 | 99 | public void testOpenAll() | ||
313 | 100 | { | ||
314 | 101 | testMultipleCursors(true); | ||
315 | 102 | } | ||
316 | 103 | |||
317 | 104 | private void testMultipleCursors(boolean openAll) { | ||
318 | 105 | RowCursor multiCursor = multiCursor(openAll, | ||
319 | 106 | new TestCursor(new int[]{}), | ||
320 | 88 | new TestCursor(new int[]{0, 1, 2}), | 107 | new TestCursor(new int[]{0, 1, 2}), |
321 | 89 | new TestCursor(new int[]{}), | 108 | new TestCursor(new int[]{}), |
322 | 90 | new TestCursor(new int[]{}), | 109 | new TestCursor(new int[]{}), |
323 | @@ -104,7 +123,12 @@ | |||
324 | 104 | 123 | ||
325 | 105 | private MultiCursor multiCursor(TestCursor ... cursors) | 124 | private MultiCursor multiCursor(TestCursor ... cursors) |
326 | 106 | { | 125 | { |
328 | 107 | MultiCursor multiCursor = new MultiCursor(); | 126 | return multiCursor(false, cursors); |
329 | 127 | } | ||
330 | 128 | |||
331 | 129 | private MultiCursor multiCursor(boolean openAll, TestCursor ... cursors) | ||
332 | 130 | { | ||
333 | 131 | MultiCursor multiCursor = new MultiCursor(openAll); | ||
334 | 108 | for (TestCursor cursor : cursors) { | 132 | for (TestCursor cursor : cursors) { |
335 | 109 | multiCursor.addCursor(cursor); | 133 | multiCursor.addCursor(cursor); |
336 | 110 | } | 134 | } |
337 | 111 | 135 | ||
338 | === modified file 'src/test/java/com/akiban/server/test/it/qp/SpatialLatLonGroupIndexScanIT.java' | |||
339 | --- src/test/java/com/akiban/server/test/it/qp/SpatialLatLonGroupIndexScanIT.java 2013-07-09 21:10:22 +0000 | |||
340 | +++ src/test/java/com/akiban/server/test/it/qp/SpatialLatLonGroupIndexScanIT.java 2013-07-18 20:08:26 +0000 | |||
341 | @@ -93,6 +93,10 @@ | |||
342 | 93 | queryBindings = queryContext.createBindings(); | 93 | queryBindings = queryContext.createBindings(); |
343 | 94 | } | 94 | } |
344 | 95 | 95 | ||
345 | 96 | protected int lookaheadQuantum() { | ||
346 | 97 | return 1; | ||
347 | 98 | } | ||
348 | 99 | |||
349 | 96 | @Test | 100 | @Test |
350 | 97 | public void testLoad() | 101 | public void testLoad() |
351 | 98 | { | 102 | { |
352 | @@ -290,7 +294,7 @@ | |||
353 | 290 | IndexBound upperRight = new IndexBound(row(pSpatialIndexRowType, beforeEQ, latHi, lonHi), | 294 | IndexBound upperRight = new IndexBound(row(pSpatialIndexRowType, beforeEQ, latHi, lonHi), |
354 | 291 | new SetColumnSelector(0, 1, 2)); | 295 | new SetColumnSelector(0, 1, 2)); |
355 | 292 | IndexKeyRange box = IndexKeyRange.spatial(pSpatialIndexRowType, lowerLeft, upperRight); | 296 | IndexKeyRange box = IndexKeyRange.spatial(pSpatialIndexRowType, lowerLeft, upperRight); |
357 | 293 | Operator plan = indexScan_Default(pSpatialIndexRowType, false, box); | 297 | Operator plan = indexScan_Default(pSpatialIndexRowType, box, lookaheadQuantum()); |
358 | 294 | Cursor cursor = API.cursor(plan, queryContext, queryBindings); | 298 | Cursor cursor = API.cursor(plan, queryContext, queryBindings); |
359 | 295 | cursor.openTopLevel(); | 299 | cursor.openTopLevel(); |
360 | 296 | Row row; | 300 | Row row; |
361 | @@ -369,7 +373,7 @@ | |||
362 | 369 | IndexBound upperRight = new IndexBound(row(cSpatialIndexRowType, beforeEQ, latHi, lonHi), | 373 | IndexBound upperRight = new IndexBound(row(cSpatialIndexRowType, beforeEQ, latHi, lonHi), |
363 | 370 | new SetColumnSelector(0, 1, 2)); | 374 | new SetColumnSelector(0, 1, 2)); |
364 | 371 | IndexKeyRange box = IndexKeyRange.spatial(cSpatialIndexRowType, lowerLeft, upperRight); | 375 | IndexKeyRange box = IndexKeyRange.spatial(cSpatialIndexRowType, lowerLeft, upperRight); |
366 | 372 | Operator plan = indexScan_Default(cSpatialIndexRowType, false, box); | 376 | Operator plan = indexScan_Default(cSpatialIndexRowType, box, lookaheadQuantum()); |
367 | 373 | Cursor cursor = API.cursor(plan, queryContext, queryBindings); | 377 | Cursor cursor = API.cursor(plan, queryContext, queryBindings); |
368 | 374 | cursor.openTopLevel(); | 378 | cursor.openTopLevel(); |
369 | 375 | Row row; | 379 | Row row; |
370 | @@ -424,7 +428,7 @@ | |||
371 | 424 | new IndexBound(row(cSpatialIndexRowType, beforeEQ, queryLat, queryLon), | 428 | new IndexBound(row(cSpatialIndexRowType, beforeEQ, queryLat, queryLon), |
372 | 425 | new SetColumnSelector(0, 1, 2)); | 429 | new SetColumnSelector(0, 1, 2)); |
373 | 426 | IndexKeyRange zStartRange = IndexKeyRange.around(cSpatialIndexRowType, zStartBound); | 430 | IndexKeyRange zStartRange = IndexKeyRange.around(cSpatialIndexRowType, zStartBound); |
375 | 427 | Operator plan = indexScan_Default(cSpatialIndexRowType, false, zStartRange); | 431 | Operator plan = indexScan_Default(cSpatialIndexRowType, zStartRange, lookaheadQuantum()); |
376 | 428 | Cursor cursor = API.cursor(plan, queryContext, queryBindings); | 432 | Cursor cursor = API.cursor(plan, queryContext, queryBindings); |
377 | 429 | cursor.openTopLevel(); | 433 | cursor.openTopLevel(); |
378 | 430 | Row row; | 434 | Row row; |
379 | 431 | 435 | ||
380 | === added file 'src/test/java/com/akiban/server/test/it/qp/SpatialLatLonGroupIndexScanLookaheadIT.java' | |||
381 | --- src/test/java/com/akiban/server/test/it/qp/SpatialLatLonGroupIndexScanLookaheadIT.java 1970-01-01 00:00:00 +0000 | |||
382 | +++ src/test/java/com/akiban/server/test/it/qp/SpatialLatLonGroupIndexScanLookaheadIT.java 2013-07-18 20:08:26 +0000 | |||
383 | @@ -0,0 +1,26 @@ | |||
384 | 1 | /** | ||
385 | 2 | * Copyright (C) 2009-2013 Akiban Technologies, Inc. | ||
386 | 3 | * | ||
387 | 4 | * This program is free software: you can redistribute it and/or modify | ||
388 | 5 | * it under the terms of the GNU Affero General Public License as published by | ||
389 | 6 | * the Free Software Foundation, either version 3 of the License, or | ||
390 | 7 | * (at your option) any later version. | ||
391 | 8 | * | ||
392 | 9 | * This program is distributed in the hope that it will be useful, | ||
393 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
394 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
395 | 12 | * GNU Affero General Public License for more details. | ||
396 | 13 | * | ||
397 | 14 | * You should have received a copy of the GNU Affero General Public License | ||
398 | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
399 | 16 | */ | ||
400 | 17 | |||
401 | 18 | package com.akiban.server.test.it.qp; | ||
402 | 19 | |||
403 | 20 | public class SpatialLatLonGroupIndexScanLookaheadIT extends SpatialLatLonGroupIndexScanIT | ||
404 | 21 | { | ||
405 | 22 | @Override | ||
406 | 23 | protected int lookaheadQuantum() { | ||
407 | 24 | return 10; | ||
408 | 25 | } | ||
409 | 26 | } | ||
410 | 0 | 27 | ||
411 | === modified file 'src/test/java/com/akiban/server/test/it/qp/SpatialLatLonTableIndexScanIT.java' | |||
412 | --- src/test/java/com/akiban/server/test/it/qp/SpatialLatLonTableIndexScanIT.java 2013-07-09 21:10:22 +0000 | |||
413 | +++ src/test/java/com/akiban/server/test/it/qp/SpatialLatLonTableIndexScanIT.java 2013-07-18 20:08:26 +0000 | |||
414 | @@ -80,6 +80,10 @@ | |||
415 | 80 | queryBindings = queryContext.createBindings(); | 80 | queryBindings = queryContext.createBindings(); |
416 | 81 | } | 81 | } |
417 | 82 | 82 | ||
418 | 83 | protected int lookaheadQuantum() { | ||
419 | 84 | return 1; | ||
420 | 85 | } | ||
421 | 86 | |||
422 | 83 | @Test | 87 | @Test |
423 | 84 | public void testLoad() | 88 | public void testLoad() |
424 | 85 | { | 89 | { |
425 | @@ -341,7 +345,7 @@ | |||
426 | 341 | IndexBound upperRight = new IndexBound(row(latLonIndexRowType, latHi, lonHi), | 345 | IndexBound upperRight = new IndexBound(row(latLonIndexRowType, latHi, lonHi), |
427 | 342 | new SetColumnSelector(0, 1)); | 346 | new SetColumnSelector(0, 1)); |
428 | 343 | IndexKeyRange box = IndexKeyRange.spatial(latLonIndexRowType, lowerLeft, upperRight); | 347 | IndexKeyRange box = IndexKeyRange.spatial(latLonIndexRowType, lowerLeft, upperRight); |
430 | 344 | Operator plan = indexScan_Default(latLonIndexRowType, false, box); | 348 | Operator plan = indexScan_Default(latLonIndexRowType, box, lookaheadQuantum()); |
431 | 345 | Cursor cursor = API.cursor(plan, queryContext, queryBindings); | 349 | Cursor cursor = API.cursor(plan, queryContext, queryBindings); |
432 | 346 | cursor.openTopLevel(); | 350 | cursor.openTopLevel(); |
433 | 347 | Row row; | 351 | Row row; |
434 | @@ -404,7 +408,7 @@ | |||
435 | 404 | IndexBound upperRight = new IndexBound(row(latLonIndexRowType, latHi, lonHi), | 408 | IndexBound upperRight = new IndexBound(row(latLonIndexRowType, latHi, lonHi), |
436 | 405 | new SetColumnSelector(0, 1)); | 409 | new SetColumnSelector(0, 1)); |
437 | 406 | IndexKeyRange box = IndexKeyRange.spatial(latLonIndexRowType, lowerLeft, upperRight); | 410 | IndexKeyRange box = IndexKeyRange.spatial(latLonIndexRowType, lowerLeft, upperRight); |
439 | 407 | Operator plan = indexScan_Default(latLonIndexRowType, false, box); | 411 | Operator plan = indexScan_Default(latLonIndexRowType, box, lookaheadQuantum()); |
440 | 408 | Cursor cursor = API.cursor(plan, queryContext, queryBindings); | 412 | Cursor cursor = API.cursor(plan, queryContext, queryBindings); |
441 | 409 | cursor.openTopLevel(); | 413 | cursor.openTopLevel(); |
442 | 410 | Row row; | 414 | Row row; |
443 | @@ -469,7 +473,7 @@ | |||
444 | 469 | IndexBound upperRight = new IndexBound(row(beforeLatLonIndexRowType, before, latHi, lonHi), | 473 | IndexBound upperRight = new IndexBound(row(beforeLatLonIndexRowType, before, latHi, lonHi), |
445 | 470 | new SetColumnSelector(0, 1, 2)); | 474 | new SetColumnSelector(0, 1, 2)); |
446 | 471 | IndexKeyRange box = IndexKeyRange.spatial(beforeLatLonIndexRowType, lowerLeft, upperRight); | 475 | IndexKeyRange box = IndexKeyRange.spatial(beforeLatLonIndexRowType, lowerLeft, upperRight); |
448 | 472 | Operator plan = indexScan_Default(beforeLatLonIndexRowType, false, box); | 476 | Operator plan = indexScan_Default(beforeLatLonIndexRowType, box, lookaheadQuantum()); |
449 | 473 | Cursor cursor = API.cursor(plan, queryContext, queryBindings); | 477 | Cursor cursor = API.cursor(plan, queryContext, queryBindings); |
450 | 474 | cursor.openTopLevel(); | 478 | cursor.openTopLevel(); |
451 | 475 | Row row; | 479 | Row row; |
452 | @@ -503,7 +507,7 @@ | |||
453 | 503 | IndexBound zStartBound = new IndexBound(row(latLonIndexRowType, queryLat, queryLon), | 507 | IndexBound zStartBound = new IndexBound(row(latLonIndexRowType, queryLat, queryLon), |
454 | 504 | new SetColumnSelector(0, 1)); | 508 | new SetColumnSelector(0, 1)); |
455 | 505 | IndexKeyRange zStartRange = IndexKeyRange.around(latLonIndexRowType, zStartBound); | 509 | IndexKeyRange zStartRange = IndexKeyRange.around(latLonIndexRowType, zStartBound); |
457 | 506 | Operator plan = indexScan_Default(latLonIndexRowType, false, zStartRange); | 510 | Operator plan = indexScan_Default(latLonIndexRowType, zStartRange, lookaheadQuantum()); |
458 | 507 | Cursor cursor = API.cursor(plan, queryContext, queryBindings); | 511 | Cursor cursor = API.cursor(plan, queryContext, queryBindings); |
459 | 508 | cursor.openTopLevel(); | 512 | cursor.openTopLevel(); |
460 | 509 | Row row; | 513 | Row row; |
461 | @@ -558,7 +562,7 @@ | |||
462 | 558 | new IndexBound(row(beforeLatLonIndexRowType, before, queryLat, queryLon), | 562 | new IndexBound(row(beforeLatLonIndexRowType, before, queryLat, queryLon), |
463 | 559 | new SetColumnSelector(0, 1, 2)); | 563 | new SetColumnSelector(0, 1, 2)); |
464 | 560 | IndexKeyRange zStartRange = IndexKeyRange.around(beforeLatLonIndexRowType, zStartBound); | 564 | IndexKeyRange zStartRange = IndexKeyRange.around(beforeLatLonIndexRowType, zStartBound); |
466 | 561 | Operator plan = indexScan_Default(beforeLatLonIndexRowType, false, zStartRange); | 565 | Operator plan = indexScan_Default(beforeLatLonIndexRowType, zStartRange, lookaheadQuantum()); |
467 | 562 | Cursor cursor = API.cursor(plan, queryContext, queryBindings); | 566 | Cursor cursor = API.cursor(plan, queryContext, queryBindings); |
468 | 563 | cursor.openTopLevel(); | 567 | cursor.openTopLevel(); |
469 | 564 | Row row; | 568 | Row row; |
470 | @@ -700,7 +704,7 @@ | |||
471 | 700 | IndexBound upperRight = new IndexBound(row(latLonIndexRowType, latHi, lonHi), | 704 | IndexBound upperRight = new IndexBound(row(latLonIndexRowType, latHi, lonHi), |
472 | 701 | new SetColumnSelector(0, 1)); | 705 | new SetColumnSelector(0, 1)); |
473 | 702 | IndexKeyRange box = IndexKeyRange.spatial(latLonIndexRowType, lowerLeft, upperRight); | 706 | IndexKeyRange box = IndexKeyRange.spatial(latLonIndexRowType, lowerLeft, upperRight); |
475 | 703 | Operator plan = indexScan_Default(latLonIndexRowType, false, box); | 707 | Operator plan = indexScan_Default(latLonIndexRowType, box, lookaheadQuantum()); |
476 | 704 | Cursor cursor = API.cursor(plan, queryContext, queryBindings); | 708 | Cursor cursor = API.cursor(plan, queryContext, queryBindings); |
477 | 705 | cursor.openTopLevel(); | 709 | cursor.openTopLevel(); |
478 | 706 | Row row; | 710 | Row row; |
479 | @@ -745,7 +749,7 @@ | |||
480 | 745 | IndexBound upperRight = new IndexBound(row(latLonIndexRowType, latHi, lonHi), | 749 | IndexBound upperRight = new IndexBound(row(latLonIndexRowType, latHi, lonHi), |
481 | 746 | new SetColumnSelector(0, 1)); | 750 | new SetColumnSelector(0, 1)); |
482 | 747 | IndexKeyRange box = IndexKeyRange.spatial(latLonIndexRowType, lowerLeft, upperRight); | 751 | IndexKeyRange box = IndexKeyRange.spatial(latLonIndexRowType, lowerLeft, upperRight); |
484 | 748 | Operator plan = indexScan_Default(latLonIndexRowType, false, box); | 752 | Operator plan = indexScan_Default(latLonIndexRowType, box, lookaheadQuantum()); |
485 | 749 | Cursor cursor = API.cursor(plan, queryContext, queryBindings); | 753 | Cursor cursor = API.cursor(plan, queryContext, queryBindings); |
486 | 750 | cursor.openTopLevel(); | 754 | cursor.openTopLevel(); |
487 | 751 | Row row; | 755 | Row row; |
488 | 752 | 756 | ||
489 | === added file 'src/test/java/com/akiban/server/test/it/qp/SpatialLatLonTableIndexScanLookaheadIT.java' | |||
490 | --- src/test/java/com/akiban/server/test/it/qp/SpatialLatLonTableIndexScanLookaheadIT.java 1970-01-01 00:00:00 +0000 | |||
491 | +++ src/test/java/com/akiban/server/test/it/qp/SpatialLatLonTableIndexScanLookaheadIT.java 2013-07-18 20:08:26 +0000 | |||
492 | @@ -0,0 +1,26 @@ | |||
493 | 1 | /** | ||
494 | 2 | * Copyright (C) 2009-2013 Akiban Technologies, Inc. | ||
495 | 3 | * | ||
496 | 4 | * This program is free software: you can redistribute it and/or modify | ||
497 | 5 | * it under the terms of the GNU Affero General Public License as published by | ||
498 | 6 | * the Free Software Foundation, either version 3 of the License, or | ||
499 | 7 | * (at your option) any later version. | ||
500 | 8 | * | ||
501 | 9 | * This program is distributed in the hope that it will be useful, | ||
502 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
503 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
504 | 12 | * GNU Affero General Public License for more details. | ||
505 | 13 | * | ||
506 | 14 | * You should have received a copy of the GNU Affero General Public License | ||
507 | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
508 | 16 | */ | ||
509 | 17 | |||
510 | 18 | package com.akiban.server.test.it.qp; | ||
511 | 19 | |||
512 | 20 | public class SpatialLatLonTableIndexScanLookaheadIT extends SpatialLatLonTableIndexScanIT | ||
513 | 21 | { | ||
514 | 22 | @Override | ||
515 | 23 | protected int lookaheadQuantum() { | ||
516 | 24 | return 10; | ||
517 | 25 | } | ||
518 | 26 | } |
Looks as described.