Skip to content

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

Merged
merged 7 commits into from
Dec 12, 2018
Merged

renaming uint128 to RowId #1858

merged 7 commits into from
Dec 12, 2018

Conversation

sfilipi
Copy link
Member

@sfilipi sfilipi commented Dec 11, 2018

Fixes #1534 by renaming Uint128 to RowId

@sfilipi sfilipi self-assigned this Dec 11, 2018
@sfilipi sfilipi added the API Issues pertaining the friendly API label Dec 11, 2018
@sfilipi sfilipi added this to the 1218 milestone Dec 11, 2018
@@ -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>
Copy link
Member

@eerhardt eerhardt Dec 11, 2018

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.
Copy link
Member

@eerhardt eerhardt Dec 11, 2018

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)
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Dec 11, 2018

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

Copy link
Member

@eerhardt eerhardt Dec 11, 2018

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()
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Dec 11, 2018

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

Copy link
Member

@eerhardt eerhardt Dec 11, 2018

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

Copy link
Contributor

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)

Copy link
Contributor

@TomFinley TomFinley Dec 12, 2018

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)
Copy link
Member

@eerhardt eerhardt Dec 11, 2018

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

@eerhardt
Copy link
Member

eerhardt commented Dec 11, 2018

    public static unsafe MD5Hash[] ToUInt128Array(this byte[] buffer, ref int position)

Same here - Uint128 #Resolved


Refers to: src/Microsoft.ML.FastTree/Utils/ToByteArrayExtensions.cs:569 in d335fc6. [](commit_id = d335fc6, deletion_comment = False)

// 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;
Copy link
Member

@eerhardt eerhardt Dec 11, 2018

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

Copy link
Member

@eerhardt eerhardt left a 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.

Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Copy link
Contributor

@TomFinley TomFinley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @sfilipi !

Copy link
Contributor

@TomFinley TomFinley left a 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

Copy link
Contributor

@TomFinley TomFinley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @sfilipi !

@sfilipi sfilipi merged commit a326dda into dotnet:master Dec 12, 2018
@sfilipi sfilipi deleted the renameUint128 branch December 12, 2018 19:12
@ghost ghost locked as resolved and limited conversation to collaborators Mar 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API Issues pertaining the friendly API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants