-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Entry for abhinav-upadhyay #696
Conversation
As my user name contains a '-', I could not use it in the class name
So my GitHub username is |
Realized, I can have file names with |
final long uhash = nameHash ^ (nameHash >> 29); | ||
// final long uhash = nameHash; | ||
int index = (int) uhash & TABLE_MASK; | ||
Row row = table[index]; |
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.
You'll need to handle collisions, otherwise you'd aggregate the values from several stations with the same hash.
Fails with the 10K key set test (see create_measurements_3.sh):
|
Still incorrect results for the 10K keyset. Note that we're after the cut-off time, so you'll have two more changes you can make to this PR (see note at the top of the README). If it's not working or valid then, I'll have to close it unfortunately. Updates should be pushed quickly, so I can evaluate all the pending entries. Thx! |
return; | ||
} | ||
|
||
while (row.hash != uhash) { |
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.
Just checking the hash isn't enough, you'll need to compare the actual name to differentiate between multiple stations with the same hash.
The code was generating probes but not using it. Also, fix rounding issue when computing the mean temperature value
Hey @abhinav-upadhyay, I still believe this does not handle hash collisions correctly. In case of a collision, the actual names of the existing and the incoming entry must be compared. I can't find where this is happening? You can push one more time to this PR before it'll either be merged (if valid) or closed (if invalid). Thx! |
I am building the hash using all the bytes of the location name (lines 180-198 in readFile method). This hash is stored into a 64 bit long value. In the test cases and even in case of the 10k keys file (which contained some huge names), it is not resulting in any cases where two names have the same hash. Because of this, I have not added any checks for comparing the names themselves . |
Understood, but absence of collisions in specific key sets doesn't mean that there cannot be collisions at all. As per the rules, you cannot make any assumptions on specific names:
So, in order for the entry to be considered valid, it must fall back to comparing names in case of collisions. |
I am going to close this one as I haven't heard back within two days and we are after the cut-off time. Thanks for your efforts nevertheless! |
Check List:
./mvnw verify
and the project builds successfully./test.sh <username>
shows no differences between expected and actual outputs)calculate_average_<username>.sh
(make sure to match casing of your GH user name) and is executablecalculate_average_baseline.sh