- 
                Notifications
    You must be signed in to change notification settings 
- Fork 15
[ISSUE #22] Created spoint_deg, scircle_deg, spoly_deg functions. #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| @stepan-neretin7 In general, I'm ok with your patch except of some cosmetic issues (float -> float8 is important). To create a complete patch I would ask to change the version to 1.3.0 (API is changed) and create a new upgrade script with name pg_sphere--1.2.3--1.3.0.sql.in in upgrade_scripts subdirectory. Makefile should also be updated to add support for the new upgrade script. Upgrade scripts are used to alter the existing schema of previous version to the new schema. In our case we have to create new functions in the new upgrade script. Thank you! | 
aa46131    to
    e0c76c4      
    Compare
  
    048e068    to
    5ccfedb      
    Compare
  
    | @vitcpp I have updated the version | 
| I also added the spoly_deg function, which accepts, as in the pr of 5 years ago, an array of float8, where there are consecutive pairs in the sequence of two float8 per point for the polygon | 
| 
 Thank you! I was just going to suggest that adding a  | 
| 
 Sorry, I didn't really get your message. So I guessed your thought? :D | 
| 
 Sorry, I thought I already did. Approved! | 
| Oh, sorry, I found one more minor thing: I saw you fixed the "radius must be not greater than 90 degrees" error message, but there is another version of that error on line 84 of src/circle.c. Could you fix line 84 similar to how you fixed line 366? | 
| 
 Of course, I've already fixed it. However, it is strange that there are no tests specifically for this error in circle.sql. | 
| @stepan-neretin7 I added some review comments. Most of the comments are minor and related to the code formatting. I would propose to work out these comments. Another performance issue I've found is in spherepoly_deg(). It will work as it is now but it is not an effective solution. Anyway, I'm ok to apply PR without redesign of this function. | 
        
          
                src/polygon.c
              
                Outdated
          
        
      | for (i = 0; i < num_elements - 1; i += 2) | ||
| { | ||
| point = DirectFunctionCall2( | ||
| spherepoint_from_long_lat_deg, Float8GetDatum(array_data[i]), Float8GetDatum(array_data[i+1]) | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not an effective solution. spherepoint_from_long_lat_deg returns palloc-ed spoint. Later this spoint is copied into already pallocated points array. I propose to pfree it after line 892. It will work but I would rather think how to avoid unecessary palloc.
30a17c7    to
    df45187      
    Compare
  
    | I corrected all the comments | 
| Sorry for trivial coding style issues. I fixed it @esabol | 
        
          
                src/polygon.c
              
                Outdated
          
        
      | ); | ||
| } | ||
| PG_RETURN_POINTER(spherepoly_from_array(points, np)); | ||
|  | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unecessary blank line please.
9d8b007    to
    4199d35      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
@esabol @vitcpp please, review it.