Changeset 47 for hw

Show
Ignore:
Timestamp:
09/26/07 02:32:47 (5 years ago)
Author:
cs186
Message:

Make MyStuff? consistent with the source tree!

Location:
hw/hw2/MyStuff
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • hw/hw2/MyStuff/geo_ops.c

    r32 r47  
    808808} 
    809809 
     810double 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} 
    810820 
    811821/*              box_distance    -               returns the distance between the 
     
    817827        BOX                *box1 = PG_GETARG_BOX_P(0); 
    818828        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); 
    826832} 
    827833 
     
    52485254} 
    52495255 
    5250 /*  
    5251  * return the minimum possible distance between an object contained in box1  
    5252  * and an object contained in box2.  assume that box1 and box2 are minimum  
    5253  * bounding rectangles, so they have some object touching each side. 
    5254  */ 
    52555256double box_mindist_internal(BOX *box1, BOX *box2) 
    52565257{ 
    5257   /* fill me in! */ 
    5258   return get_float8_infinity(); 
     5258  /* CS186 HW2: fill me in! */ 
    52595259} 
    52605260 
     
    52665266        PG_RETURN_FLOAT8(box_mindist_internal(box1, box2)); 
    52675267} 
     5268 
     5269Datum box_true(PG_FUNCTION_ARGS) 
     5270{ 
     5271        PG_RETURN_BOOL(TRUE); 
     5272} 
  • hw/hw2/MyStuff/gistget.c

    r32 r47  
    199199  Assert(so->curbuf == InvalidBuffer); 
    200200  Assert(so->stack == NULL); 
    201   Assert(so->pq == NULL); 
    202201 
    203202  so->curbuf = ReadBuffer(scan->indexRelation, GIST_ROOT_BLKNO); 
     
    210209} 
    211210 
    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. 
    218218 */ 
    219219static void 
     
    239239      /* detect page split, follow right link to add pages */ 
    240240 
     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       */ 
    241249      stk = (GISTSearchStack *) palloc0(sizeof(GISTSearchStack)); 
    242250      stk->next = so->stack->next;