-
Notifications
You must be signed in to change notification settings - Fork 1.9k
renaming uint128 to RowId #1858
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
@@ -11,14 +11,14 @@ namespace Microsoft.ML.Runtime.Data | |||
/// <summary> | |||
/// A sixteen-byte unsigned integer. | |||
/// </summary> | |||
public readonly struct UInt128 : IComparable<UInt128>, IEquatable<UInt128> | |||
public readonly struct RowId : IComparable<RowId>, IEquatable<RowId> |
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.
Can you rename the file as well? #Resolved
@@ -11,14 +11,14 @@ namespace Microsoft.ML.Runtime.Data | |||
/// <summary> | |||
/// A sixteen-byte unsigned integer. |
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.
Can you update this xml summary comment? This isn't really an "integer" anymore. #Resolved
{ | ||
// The low order bits. Corresponds to H1 in the Murmur algorithms. | ||
public readonly ulong Lo; | ||
// The high order bits. Corresponds to H2 in the Murmur algorithms. | ||
public readonly ulong Hi; | ||
|
||
public UInt128(ulong lo, ulong hi) | ||
public RowId(ulong lo, ulong hi) |
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.
public RowId(ulong lo, ulong hi) [](start = 8, length = 32)
Need proper summary.
I would probably renamed to lowerWord and highWord. #Resolved
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.
If we rename the parameters of the constructor, we should rename the public fields as well. The names should be insync. #Resolved
@@ -167,7 +167,7 @@ private static void FinalMix(ref ulong h1, ref ulong h2, int len) | |||
/// that were all zeros, except for the last bit which is one. | |||
/// </summary> | |||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | |||
public UInt128 Fork() | |||
public RowId Fork() |
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.
Fork [](start = 21, length = 4)
can be internal, right? #Resolved
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.
I will be moving this and any other types that IDataView needs out into a separate assembly, which will not have InternalsVisibleTo on it. So let's keep whatever things we need as public
.
Alternatively, the Lo
and Hi
fields are public, so we could make these methods static extension methods that were only in ML.NET. (And those extension methods would be internal.) #Resolved
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.
If you look on usage, only thing which we use outside is Combine method.
Part of me wants just delete all this unused code, but since it was written by someone, maybe it can be useful someday.
So I would prefer just hide it behind internal/private.
Just in case I'm talking about Hashing region.
In reply to: 240724280 [](ancestors = 240724280)
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.
Part of me wants just delete all this unused code,
Please do not remove this code. It is needed for definite purposes as explained in our code documentation. Refer to ICursor.md
if the point of its usage is unclear.
@@ -194,7 +194,7 @@ public static ulong ToULong(this byte[] buffer, ref int position) | |||
return a; | |||
} | |||
|
|||
// UInt128 | |||
// RowId | |||
|
|||
public static MD5Hash ToUInt128(this byte[] buffer, ref int position) |
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.
Does this method need to be renamed? #Resolved
src/Microsoft.ML.Core/Data/RowId.cs
Outdated
// The high order bits. Corresponds to H2 in the Murmur algorithms. | ||
public readonly ulong Hi; | ||
///<summary>The low order bits. Corresponds to H1 in the Murmur algorithms.</summary> | ||
public readonly ulong LowerWord; |
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.
I should have caught this in Ivan's suggestion, but the word Word
shouldn't be used here. There is a certain connotation that "WORD" means 2 bytes - especially for Windows C++ developers.
My preference for these names is simply Low
and High
. #Resolved
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. Thanks Senja.
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.
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.
Thank you @sfilipi !
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.
Hi @sfilipi , it is essential that Fork
, Combine
, and Next
be public members on RowId
. Please refer to our documentation on this subject to see why. Without them being public, it will be difficult or impossible in some easy to imagine situations to write a correct implementation of row ID getters. Thanks.#Resolved
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.
Thank you @sfilipi !
Fixes #1534 by renaming Uint128 to RowId