- Timestamp:
- 09/26/07 02:32:47 (5 years ago)
- Location:
- hw/hw2/MyStuff
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
hw/hw2/MyStuff/geo_ops.c
r32 r47 808 808 } 809 809 810 double box_distance_internal(BOX *box1, BOX *box2) 811 { 812 Point a, 813 b; 814 815 box_cn(&a, box1); 816 box_cn(&b, box2); 817 return(HYPOT(a.x - b.x, a.y - b.y)); 818 819 } 810 820 811 821 /* box_distance - returns the distance between the … … 817 827 BOX *box1 = PG_GETARG_BOX_P(0); 818 828 BOX *box2 = PG_GETARG_BOX_P(1); 819 Point a, 820 b; 821 822 box_cn(&a, box1); 823 box_cn(&b, box2); 824 825 PG_RETURN_FLOAT8(HYPOT(a.x - b.x, a.y - b.y)); 829 double result = box_distance_internal(box1, box2); 830 831 PG_RETURN_FLOAT8(result); 826 832 } 827 833 … … 5248 5254 } 5249 5255 5250 /*5251 * return the minimum possible distance between an object contained in box15252 * and an object contained in box2. assume that box1 and box2 are minimum5253 * bounding rectangles, so they have some object touching each side.5254 */5255 5256 double box_mindist_internal(BOX *box1, BOX *box2) 5256 5257 { 5257 /* fill me in! */ 5258 return get_float8_infinity(); 5258 /* CS186 HW2: fill me in! */ 5259 5259 } 5260 5260 … … 5266 5266 PG_RETURN_FLOAT8(box_mindist_internal(box1, box2)); 5267 5267 } 5268 5269 Datum box_true(PG_FUNCTION_ARGS) 5270 { 5271 PG_RETURN_BOOL(TRUE); 5272 } -
hw/hw2/MyStuff/gistget.c
r32 r47 199 199 Assert(so->curbuf == InvalidBuffer); 200 200 Assert(so->stack == NULL); 201 Assert(so->pq == NULL);202 201 203 202 so->curbuf = ReadBuffer(scan->indexRelation, GIST_ROOT_BLKNO); … … 210 209 } 211 210 212 /* 213 * Support routine for gistnext. Deals with concurrency control issues to 214 * check if a node on the (cached) search stack was split by a concurrent 215 * inserter. If so, the result of the split can be found by adding right-hand 216 * neighbors of the split node to the search stack. See 217 * Kornacker/Mohan/Hellerstein, SIGMOD 1997, for the protocol description. 211 /* 212 * Support routine for gistnext. Deals with concurrency control issues to 213 * check if the top node on the search stack was split by a concurrent 214 * inserter since the time it was put on the stack. If so, the "rest" 215 * of the split can be found by adding the right-hand 216 * neighbor of the split node to the search stack. See 217 * Kornacker/Mohan/Hellerstein, SIGMOD 1997, for details. 218 218 */ 219 219 static void … … 239 239 /* detect page split, follow right link to add pages */ 240 240 241 /* 242 * CS186 HW2: Fix me! 243 * Modify this next code to put the rightlinked block on 244 * the priority queue. 245 * Note: since this page was split since it was inserted into 246 * the priority queue, it has fewer items on it, and a different 247 * bounding box, so its priority may have changed. 248 */ 241 249 stk = (GISTSearchStack *) palloc0(sizeof(GISTSearchStack)); 242 250 stk->next = so->stack->next;
