-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add vroom category functions with timestamps #14
Add vroom category functions with timestamps #14
Conversation
@cvvergara Needed some suggestions from you:
Btw, this is still a draft, will make these changes before it is ready for review. |
For pgRouting I have this legwork for Open Source Day / FOSS4G code sprint that will fix that error of the \echo
You might want to use this script
The ones that can not be fixed are the |
95d55cd
to
31747c7
Compare
Trying to understand the meaning of |
This was Vicky's suggestion: For the other functions already present such as pickDeliver, we used Any other naming suggestions apart from |
OK, so then the timestamp is without suffix, and the one with integers is called I think consistency is important though. So whatever we find, a good naming should be consistent over all the functions. Just some brainstorming for other ideas:
And what about "function overloading" and using the same function name? Or is that a bad thing? Then the function with the matching arguments/types would be selected. |
Yes, the timestamp is without the suffix (because that's what most of the vrprouting users will prefer to use), and the one with integers is The other naming ideas also look good, @cvvergara looking for your suggestions here. :-) Function overloading is also a good idea, and I think that would be more convenient for the end-user. However, a "direct" function overloading won't work here, because, for the end PostgreSQL function, all the types are "same". E.g.: Both the functions However, as a workaround, we can implement the function overloading internally. I think in the PostgreSQL language, that should not be called "function overloading", because all the types and no. of arguments are the same. We can call it something like "overloading of the inner query types". When the inner queries are getting processed, we will need to check the types and adjust according to them. |
The idea looks good to me, and I think it will be more convenient for the end-user. We have something similar in the existing functions, such as ANY-INTEGER or ANY-NUMERICAL. E.g.: ANY-INTEGER denotes SMALLINT, INTEGER, or BIGINT. We can call it... maybe, ANY-TIMESTAMP (INTEGER or TIMESTAMP) and ANY-INTERVAL (INTEGER or INTERVAL). Whichever type the internal column is, we can process it according to that. For getting the type of the result columns, we can add an extra argument to the function, Not sure if this is considered a bad thing according to design... Maybe @cvvergara can guide us here. |
That's a good and valid point! Of course "automagical" is nice for the users. I would also expect that the "timestamp" usage is the common one. What makes me a bit hesitant to create new functions, that basically do the same, is the increase of (eventually redundant) documentation, etc. And we need to think about the naming of the suffix. Another option would be to have another optional parameter, which would be something like the "directed" or "with reverse cost" flag in pgRouting. If the parameter is not set, then the function assumes "timestamp". What do you think about this? |
Yes, even I am hesitant to create new functions. It looks redundant... even I mentioned that in my "first" comment of this PR. The functions work the same, so generally, there should be only a "single" page dedicated for them in the documentation. So, if we want to have a single function (instead of two), we will need to add an optional argument, to get the final type of result columns. For the inner queries, we can make it "automagical" for the user, or determine the type based on the optional argument. I think this looks good, and we can go ahead... the automagical one would be more convenient for the user. |
I like But the optional parameter looks good. The position doesn't really matter if we support named parameters. I think having an optional parameter, is a good idea even if we later try to identify the data type internally, because we can add this parameter to the documentation and make the user aware of this option. Checking the data type internally (and validate it) will also allow to return more meaningful error messages, if the input data is not right. |
Yes, I will add the optional parameter, it is definitely better. Also, even now, we check & validate the data type internally. For |
TIMESTAMP on postgres is a |
I dont know about the users, things can get complicated if they mix up types |
I think for the current state of things, this PR is good to go. |
Changes proposed in this pull request:
(denoting that the functions have plain integer types, not the TIMESTAMP/INTERVAL types)
@pgRouting/admins