Replace DvInt* with .NET standard data types. WIP - #683

Closed
codemzs wants to merge 56 commits into
dotnet:masterfrom
codemzs:types
Closed

Replace DvInt* with .NET standard data types. WIP#683
codemzs wants to merge 56 commits into
dotnet:masterfrom
codemzs:types

Conversation

@codemzs

@codemzscodemzs commented Aug 16, 2018

Copy link
Copy Markdown
Member

This change also removes missing value handling for sbyte, short, int and long because default of these values is a null and that does not fit well with sparse vector architecture where default for missing values is a zero. fixes#673

RegisterSimpleCodec(new UnsafeTypeCodec<sbyte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<byte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<DvInt2>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<Int16>(this));

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Int16 [](start = 52, length = 5)

short, int, long, not Int16, Int32, Int64. #Closed

}

private void GetCategoricalSlotRanges(int iiinfo, ref VBuffer<DvInt4> dst)
private void GetCategoricalSlotRanges(int iiinfo, ref VBuffer<Int32> dst)

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Int32 [](start = 74, length = 5)

Please just use the keywords for types (so, in this case int), here and everywhere. #Closed

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I made this change across the code base using find-replace. #Resolved


public void Conv(ref long? src, ref DvInt8 dst) => dst = src ?? DvInt8.NA;
public void Conv(ref long? src, ref Int64? dst) => dst = src;

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see there are no conversions from float to float, or double to double. So: are these conversions actually necessary? #Resolved

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I have updated this code to not assume there can be nullables but I do see a conversion between byte and byte. @mandyshieh can you please take a look? #Resolved

@TomFinley

TomFinley commented Aug 16, 2018

Copy link
Copy Markdown
Contributor
 public RefPredicate<T> GetIsDefaultPredicate<T>(ColumnType type)

You will need to be careful here. We want the "default" of the new nullable integer types to be 0, since that's both a more sensible choice and it retains sparsity preservation for conversion from int? to int. (For that reason it may be beneficial to choose a better name than "default" since it will no longer be identical with C# sparsity.)

The implications for things like VBufferUtils.Densify are interesting.

The sparsity question will be quite far reaching, and will be by far the most challenging part of this change. #Resolved


Refers to: src/Microsoft.ML.Data/Data/Conversion.cs:703 in a0ceabb. [](commit_id = a0ceabb, deletion_comment = False)

RegisterSimpleCodec(new UnsafeTypeCodec<sbyte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<byte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<DvInt2>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<Int16>(this));

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

RegisterSimpleCodec(new UnsafeTypeCodec(this)); [](start = 12, length = 54)

We will want the nullable types to be serializable. #Closed

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This is not needed since there will no nullable types 👍 #Resolved

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good, thanks @codemzs. Incidentally were you going to update the description of #673 pursuant to our discussions yesterday? It is still the old description.

Edit: Actually I don't think you've linked to that issue from this PR at all. You should, maybe "fixes #673" in your description.


In reply to: 210744044 [](ancestors = 210744044)

@codemzscodemzs changed the title WIP Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types and remove missing value handling for sbyte, short, int and long.Aug 16, 2018
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types and remove missing value handling for sbyte, short, int and long.Replace DvInt* with .NET standard data types.Aug 16, 2018
namespace Microsoft.ML.Runtime.Internal.Utilities
{
// Reasonable choices are Double and System.Int64.
// Reasonable choices are Double and System.long.

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

long [](start = 48, length = 4)

fix this #Resolved

{
Ch.Assert(colType.ItemType == NumberType.I4);
return CreateConvertingArrayGetterDelegate<int?, DvInt4>(index, x => x ?? DvInt4.NA);
return CreateConvertingArrayGetterDelegate<int, int>(index, x => x);

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need a "converting" delegate here to return the same value? #Resolved

if (type == typeof(DvInt1) || type == typeof(sbyte) || type == typeof(sbyte?))
if (type == typeof(sbyte))
kind = DataKind.I1;
else if (type == typeof(byte) || type == typeof(byte?))

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

byte? should be removed here as well, to follow the rest of the changes. #Resolved

@codemzscodemzsAug 17, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Why is "byte?" mapped to a U1? I thought U1 just mapped to a byte and did not support nullables ....this needs to go away anyways


In reply to: 210963225 [](ancestors = 210963225)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Someone made a mistake somewhere, didn't realize this was supposed to be inverse to above function. Who knows who, but we ought to correct now.


In reply to: 210965477 [](ancestors = 210965477,210963225)

using RawI2 = Int16;
using RawI4 = Int32;
using RawI8 = Int64;
using I1 = SByte;

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it make sense to just start using the C# keywords inline in the code? That way readers didn't have to map I2 => short in their heads? #Resolved

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is generally the case except in this one file, if we consider its nature I feel like this would actually impede readability, at least for me.

So:

AddStd<I2,I1>(Convert);AddStd<I2,I2>(Convert);AddStd<I2,I4>(Convert);AddStd<I2,I8>(Convert);AddStd<I2,R4>(Convert);AddStd<I2,R8>(Convert);AddAux<I2,SB>(Convert);

becomes

AddStd<short,byte>(Convert);AddStd<short,short>(Convert);AddStd<short,int>(Convert);AddStd<short,long>(Convert);AddStd<short,float>(Convert);AddStd<short,double>(Convert);AddAux<short,SB>(Convert);

Maybe. That's hardly disastrous I suppose, and might be easier for some people. Perhaps we ought to revisit though once we've done all the type changes we want to do...


In reply to: 210964331 [](ancestors = 210964331)

private BoolType()
: base(typeof(DvBool), DataKind.BL)
private readonly string _name;

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmmm. What's this for? Is it still relevant? #Closed

@TomFinley

TomFinley commented Aug 29, 2018

Copy link
Copy Markdown
Contributor

Change looks OK for now, let's hold off till after 0.5 is cut then we can perhaps do all the changes to the type system in one go. #Resolved

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @codemzs let's hold off till 0.5 though.

@codemzscodemzs changed the title Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types. WIPAug 29, 2018
@@ -731,6 +731,12 @@ public void GetMetadata<TValue>(string kind, int col, ref TValue value)
/// </summary>
private const ulong ReaderVersion = MissingTextVersion;

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ReaderVersion = MissingTextVersion [](start = 28, length = 34)

This was not updated, it should have been. We can read StandardDataTypesVersion so it should be that. #Resolved

Header.VersionToString(header.CompatibleVersion), Header.VersionToString(MetadataVersion));
}
if (header.CompatibleVersion > ReaderVersion)
if (header.CompatibleVersion > StandardDataTypesVersion)

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CompatibleVersion > StandardDataTypesVersion [](start = 23, length = 44)

Revert these two lines please. #Resolved

/// The first version that removes DvTypes and uses .NET standard
/// data types.
/// </summary>
private const ulong StandardDataTypesVersion = 0x0001000100010006;

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

StandardDataTypesVersion [](start = 28, length = 24)

Also will need to update the constant in Header.cs. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

Sounds good, thanks for reviewing. I was wondering if we should bump the version number for every type conversion PR check-in as this will allow us to check-in PRs without waiting for other PRs to close, thoughts?


In reply to: 417051605 [](ancestors = 417051605)

@codemzs

codemzs commented Aug 30, 2018

Copy link
Copy Markdown
MemberAuthor
 /// Missing values are mapped to zero with a true return.

Fix this #Resolved


Refers to: src/Microsoft.ML.Data/Data/Conversion.cs:1199 in 40c01fc. [](commit_id = 40c01fc, deletion_comment = False)


Assert.True(error);

//5. Missing value in text to int.

@codemzscodemzsAug 30, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

//5. Missing value in text to int. [](start = 12, length = 34)

Empty string #Resolved

mapper(ref src, ref dst);
Assert.Equal(default, dst);

//6. Empty string in text to sbyte.

@codemzscodemzsAug 30, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

  1. Empty string in text to sbyte. [](start = 14, length = 33)

Missing value #Resolved

…to types
# Conflicts:
#	test/Microsoft.ML.TestFramework/DataPipe/TestDataPipeBase.cs
@TomFinley

Copy link
Copy Markdown
Contributor

I think we can avoid in those cases since I feel like we can easily just have separate codecs probably. In this case we could not avoid I think because we were using the same codec for both purposes.


In reply to: 417434524 [](ancestors = 417434524,417051605)

@TomFinley

TomFinley commented Aug 31, 2018

Copy link
Copy Markdown
Contributor

datatypes.idv is still shown as being modified in latest commit #Resolved

…to types
# Conflicts:
#	test/BaselineOutput/SingleDebug/SavePipe/TestParquetPrimitiveDataTypes-Data.txt
#	test/BaselineOutput/SingleDebug/SavePipe/TestParquetPrimitiveDataTypes-Schema.txt
#	test/BaselineOutput/SingleRelease/SavePipe/TestParquetPrimitiveDataTypes-Data.txt
#	test/BaselineOutput/SingleRelease/SavePipe/TestParquetPrimitiveDataTypes-Schema.txt
#	test/data/Parquet/alltypes.parquet
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types. WIPReplace DvInt* with .NET standard data types.Sep 4, 2018
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types. WIPSep 4, 2018
@TomFinley

TomFinley commented Sep 4, 2018

Copy link
Copy Markdown
Contributor

Hi @codemzs you may want to merge master again, I think our work on APIs and additional tests for pigsty may interfere. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

Done.


In reply to: 418545763 [](ancestors = 418545763)

@codemzs

Copy link
Copy Markdown
MemberAuthor

This change was committed via #863

@codemzscodemzs closed this Sep 20, 2018
@codemzs
codemzs deleted the types branch September 20, 2018 18:17
@ghostghost locked as resolved and limited conversation to collaborators Mar 29, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET data type system instead of DvTypes

4 participants

@codemzs@TomFinley@eerhardt@GalOshri
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Replace DvInt* with .NET standard data types. WIP - #683

Closed
codemzs wants to merge 56 commits into
dotnet:masterfrom
codemzs:types
Closed

Replace DvInt* with .NET standard data types. WIP#683
codemzs wants to merge 56 commits into
dotnet:masterfrom
codemzs:types

Conversation

@codemzs

@codemzscodemzs commented Aug 16, 2018

Copy link
Copy Markdown
Member

This change also removes missing value handling for sbyte, short, int and long because default of these values is a null and that does not fit well with sparse vector architecture where default for missing values is a zero. fixes#673

RegisterSimpleCodec(new UnsafeTypeCodec<sbyte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<byte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<DvInt2>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<Int16>(this));

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Int16 [](start = 52, length = 5)

short, int, long, not Int16, Int32, Int64. #Closed

}

private void GetCategoricalSlotRanges(int iiinfo, ref VBuffer<DvInt4> dst)
private void GetCategoricalSlotRanges(int iiinfo, ref VBuffer<Int32> dst)

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Int32 [](start = 74, length = 5)

Please just use the keywords for types (so, in this case int), here and everywhere. #Closed

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I made this change across the code base using find-replace. #Resolved


public void Conv(ref long? src, ref DvInt8 dst) => dst = src ?? DvInt8.NA;
public void Conv(ref long? src, ref Int64? dst) => dst = src;

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see there are no conversions from float to float, or double to double. So: are these conversions actually necessary? #Resolved

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I have updated this code to not assume there can be nullables but I do see a conversion between byte and byte. @mandyshieh can you please take a look? #Resolved

@TomFinley

TomFinley commented Aug 16, 2018

Copy link
Copy Markdown
Contributor
 public RefPredicate<T> GetIsDefaultPredicate<T>(ColumnType type)

You will need to be careful here. We want the "default" of the new nullable integer types to be 0, since that's both a more sensible choice and it retains sparsity preservation for conversion from int? to int. (For that reason it may be beneficial to choose a better name than "default" since it will no longer be identical with C# sparsity.)

The implications for things like VBufferUtils.Densify are interesting.

The sparsity question will be quite far reaching, and will be by far the most challenging part of this change. #Resolved


Refers to: src/Microsoft.ML.Data/Data/Conversion.cs:703 in a0ceabb. [](commit_id = a0ceabb, deletion_comment = False)

RegisterSimpleCodec(new UnsafeTypeCodec<sbyte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<byte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<DvInt2>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<Int16>(this));

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

RegisterSimpleCodec(new UnsafeTypeCodec(this)); [](start = 12, length = 54)

We will want the nullable types to be serializable. #Closed

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This is not needed since there will no nullable types 👍 #Resolved

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good, thanks @codemzs. Incidentally were you going to update the description of #673 pursuant to our discussions yesterday? It is still the old description.

Edit: Actually I don't think you've linked to that issue from this PR at all. You should, maybe "fixes #673" in your description.


In reply to: 210744044 [](ancestors = 210744044)

@codemzscodemzs changed the title WIP Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types and remove missing value handling for sbyte, short, int and long.Aug 16, 2018
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types and remove missing value handling for sbyte, short, int and long.Replace DvInt* with .NET standard data types.Aug 16, 2018
namespace Microsoft.ML.Runtime.Internal.Utilities
{
// Reasonable choices are Double and System.Int64.
// Reasonable choices are Double and System.long.

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

long [](start = 48, length = 4)

fix this #Resolved

{
Ch.Assert(colType.ItemType == NumberType.I4);
return CreateConvertingArrayGetterDelegate<int?, DvInt4>(index, x => x ?? DvInt4.NA);
return CreateConvertingArrayGetterDelegate<int, int>(index, x => x);

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need a "converting" delegate here to return the same value? #Resolved

if (type == typeof(DvInt1) || type == typeof(sbyte) || type == typeof(sbyte?))
if (type == typeof(sbyte))
kind = DataKind.I1;
else if (type == typeof(byte) || type == typeof(byte?))

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

byte? should be removed here as well, to follow the rest of the changes. #Resolved

@codemzscodemzsAug 17, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Why is "byte?" mapped to a U1? I thought U1 just mapped to a byte and did not support nullables ....this needs to go away anyways


In reply to: 210963225 [](ancestors = 210963225)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Someone made a mistake somewhere, didn't realize this was supposed to be inverse to above function. Who knows who, but we ought to correct now.


In reply to: 210965477 [](ancestors = 210965477,210963225)

using RawI2 = Int16;
using RawI4 = Int32;
using RawI8 = Int64;
using I1 = SByte;

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it make sense to just start using the C# keywords inline in the code? That way readers didn't have to map I2 => short in their heads? #Resolved

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is generally the case except in this one file, if we consider its nature I feel like this would actually impede readability, at least for me.

So:

AddStd<I2,I1>(Convert);AddStd<I2,I2>(Convert);AddStd<I2,I4>(Convert);AddStd<I2,I8>(Convert);AddStd<I2,R4>(Convert);AddStd<I2,R8>(Convert);AddAux<I2,SB>(Convert);

becomes

AddStd<short,byte>(Convert);AddStd<short,short>(Convert);AddStd<short,int>(Convert);AddStd<short,long>(Convert);AddStd<short,float>(Convert);AddStd<short,double>(Convert);AddAux<short,SB>(Convert);

Maybe. That's hardly disastrous I suppose, and might be easier for some people. Perhaps we ought to revisit though once we've done all the type changes we want to do...


In reply to: 210964331 [](ancestors = 210964331)

private BoolType()
: base(typeof(DvBool), DataKind.BL)
private readonly string _name;

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmmm. What's this for? Is it still relevant? #Closed

@TomFinley

TomFinley commented Aug 29, 2018

Copy link
Copy Markdown
Contributor

Change looks OK for now, let's hold off till after 0.5 is cut then we can perhaps do all the changes to the type system in one go. #Resolved

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @codemzs let's hold off till 0.5 though.

@codemzscodemzs changed the title Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types. WIPAug 29, 2018
@@ -731,6 +731,12 @@ public void GetMetadata<TValue>(string kind, int col, ref TValue value)
/// </summary>
private const ulong ReaderVersion = MissingTextVersion;

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ReaderVersion = MissingTextVersion [](start = 28, length = 34)

This was not updated, it should have been. We can read StandardDataTypesVersion so it should be that. #Resolved

Header.VersionToString(header.CompatibleVersion), Header.VersionToString(MetadataVersion));
}
if (header.CompatibleVersion > ReaderVersion)
if (header.CompatibleVersion > StandardDataTypesVersion)

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CompatibleVersion > StandardDataTypesVersion [](start = 23, length = 44)

Revert these two lines please. #Resolved

/// The first version that removes DvTypes and uses .NET standard
/// data types.
/// </summary>
private const ulong StandardDataTypesVersion = 0x0001000100010006;

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

StandardDataTypesVersion [](start = 28, length = 24)

Also will need to update the constant in Header.cs. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

Sounds good, thanks for reviewing. I was wondering if we should bump the version number for every type conversion PR check-in as this will allow us to check-in PRs without waiting for other PRs to close, thoughts?


In reply to: 417051605 [](ancestors = 417051605)

@codemzs

codemzs commented Aug 30, 2018

Copy link
Copy Markdown
MemberAuthor
 /// Missing values are mapped to zero with a true return.

Fix this #Resolved


Refers to: src/Microsoft.ML.Data/Data/Conversion.cs:1199 in 40c01fc. [](commit_id = 40c01fc, deletion_comment = False)


Assert.True(error);

//5. Missing value in text to int.

@codemzscodemzsAug 30, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

//5. Missing value in text to int. [](start = 12, length = 34)

Empty string #Resolved

mapper(ref src, ref dst);
Assert.Equal(default, dst);

//6. Empty string in text to sbyte.

@codemzscodemzsAug 30, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

  1. Empty string in text to sbyte. [](start = 14, length = 33)

Missing value #Resolved

…to types
# Conflicts:
#	test/Microsoft.ML.TestFramework/DataPipe/TestDataPipeBase.cs
@TomFinley

Copy link
Copy Markdown
Contributor

I think we can avoid in those cases since I feel like we can easily just have separate codecs probably. In this case we could not avoid I think because we were using the same codec for both purposes.


In reply to: 417434524 [](ancestors = 417434524,417051605)

@TomFinley

TomFinley commented Aug 31, 2018

Copy link
Copy Markdown
Contributor

datatypes.idv is still shown as being modified in latest commit #Resolved

…to types
# Conflicts:
#	test/BaselineOutput/SingleDebug/SavePipe/TestParquetPrimitiveDataTypes-Data.txt
#	test/BaselineOutput/SingleDebug/SavePipe/TestParquetPrimitiveDataTypes-Schema.txt
#	test/BaselineOutput/SingleRelease/SavePipe/TestParquetPrimitiveDataTypes-Data.txt
#	test/BaselineOutput/SingleRelease/SavePipe/TestParquetPrimitiveDataTypes-Schema.txt
#	test/data/Parquet/alltypes.parquet
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types. WIPReplace DvInt* with .NET standard data types.Sep 4, 2018
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types. WIPSep 4, 2018
@TomFinley

TomFinley commented Sep 4, 2018

Copy link
Copy Markdown
Contributor

Hi @codemzs you may want to merge master again, I think our work on APIs and additional tests for pigsty may interfere. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

Done.


In reply to: 418545763 [](ancestors = 418545763)

@codemzs

Copy link
Copy Markdown
MemberAuthor

This change was committed via #863

@codemzscodemzs closed this Sep 20, 2018
@codemzs
codemzs deleted the types branch September 20, 2018 18:17
@ghostghost locked as resolved and limited conversation to collaborators Mar 29, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET data type system instead of DvTypes

4 participants

@codemzs@TomFinley@eerhardt@GalOshri
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Replace DvInt* with .NET standard data types. WIP - #683

Closed
codemzs wants to merge 56 commits into
dotnet:masterfrom
codemzs:types
Closed

Replace DvInt* with .NET standard data types. WIP#683
codemzs wants to merge 56 commits into
dotnet:masterfrom
codemzs:types

Conversation

@codemzs

@codemzscodemzs commented Aug 16, 2018

Copy link
Copy Markdown
Member

This change also removes missing value handling for sbyte, short, int and long because default of these values is a null and that does not fit well with sparse vector architecture where default for missing values is a zero. fixes#673

RegisterSimpleCodec(new UnsafeTypeCodec<sbyte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<byte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<DvInt2>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<Int16>(this));

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Int16 [](start = 52, length = 5)

short, int, long, not Int16, Int32, Int64. #Closed

}

private void GetCategoricalSlotRanges(int iiinfo, ref VBuffer<DvInt4> dst)
private void GetCategoricalSlotRanges(int iiinfo, ref VBuffer<Int32> dst)

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Int32 [](start = 74, length = 5)

Please just use the keywords for types (so, in this case int), here and everywhere. #Closed

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I made this change across the code base using find-replace. #Resolved


public void Conv(ref long? src, ref DvInt8 dst) => dst = src ?? DvInt8.NA;
public void Conv(ref long? src, ref Int64? dst) => dst = src;

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see there are no conversions from float to float, or double to double. So: are these conversions actually necessary? #Resolved

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I have updated this code to not assume there can be nullables but I do see a conversion between byte and byte. @mandyshieh can you please take a look? #Resolved

@TomFinley

TomFinley commented Aug 16, 2018

Copy link
Copy Markdown
Contributor
 public RefPredicate<T> GetIsDefaultPredicate<T>(ColumnType type)

You will need to be careful here. We want the "default" of the new nullable integer types to be 0, since that's both a more sensible choice and it retains sparsity preservation for conversion from int? to int. (For that reason it may be beneficial to choose a better name than "default" since it will no longer be identical with C# sparsity.)

The implications for things like VBufferUtils.Densify are interesting.

The sparsity question will be quite far reaching, and will be by far the most challenging part of this change. #Resolved


Refers to: src/Microsoft.ML.Data/Data/Conversion.cs:703 in a0ceabb. [](commit_id = a0ceabb, deletion_comment = False)

RegisterSimpleCodec(new UnsafeTypeCodec<sbyte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<byte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<DvInt2>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<Int16>(this));

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

RegisterSimpleCodec(new UnsafeTypeCodec(this)); [](start = 12, length = 54)

We will want the nullable types to be serializable. #Closed

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This is not needed since there will no nullable types 👍 #Resolved

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good, thanks @codemzs. Incidentally were you going to update the description of #673 pursuant to our discussions yesterday? It is still the old description.

Edit: Actually I don't think you've linked to that issue from this PR at all. You should, maybe "fixes #673" in your description.


In reply to: 210744044 [](ancestors = 210744044)

@codemzscodemzs changed the title WIP Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types and remove missing value handling for sbyte, short, int and long.Aug 16, 2018
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types and remove missing value handling for sbyte, short, int and long.Replace DvInt* with .NET standard data types.Aug 16, 2018
namespace Microsoft.ML.Runtime.Internal.Utilities
{
// Reasonable choices are Double and System.Int64.
// Reasonable choices are Double and System.long.

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

long [](start = 48, length = 4)

fix this #Resolved

{
Ch.Assert(colType.ItemType == NumberType.I4);
return CreateConvertingArrayGetterDelegate<int?, DvInt4>(index, x => x ?? DvInt4.NA);
return CreateConvertingArrayGetterDelegate<int, int>(index, x => x);

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need a "converting" delegate here to return the same value? #Resolved

if (type == typeof(DvInt1) || type == typeof(sbyte) || type == typeof(sbyte?))
if (type == typeof(sbyte))
kind = DataKind.I1;
else if (type == typeof(byte) || type == typeof(byte?))

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

byte? should be removed here as well, to follow the rest of the changes. #Resolved

@codemzscodemzsAug 17, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Why is "byte?" mapped to a U1? I thought U1 just mapped to a byte and did not support nullables ....this needs to go away anyways


In reply to: 210963225 [](ancestors = 210963225)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Someone made a mistake somewhere, didn't realize this was supposed to be inverse to above function. Who knows who, but we ought to correct now.


In reply to: 210965477 [](ancestors = 210965477,210963225)

using RawI2 = Int16;
using RawI4 = Int32;
using RawI8 = Int64;
using I1 = SByte;

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it make sense to just start using the C# keywords inline in the code? That way readers didn't have to map I2 => short in their heads? #Resolved

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is generally the case except in this one file, if we consider its nature I feel like this would actually impede readability, at least for me.

So:

AddStd<I2,I1>(Convert);AddStd<I2,I2>(Convert);AddStd<I2,I4>(Convert);AddStd<I2,I8>(Convert);AddStd<I2,R4>(Convert);AddStd<I2,R8>(Convert);AddAux<I2,SB>(Convert);

becomes

AddStd<short,byte>(Convert);AddStd<short,short>(Convert);AddStd<short,int>(Convert);AddStd<short,long>(Convert);AddStd<short,float>(Convert);AddStd<short,double>(Convert);AddAux<short,SB>(Convert);

Maybe. That's hardly disastrous I suppose, and might be easier for some people. Perhaps we ought to revisit though once we've done all the type changes we want to do...


In reply to: 210964331 [](ancestors = 210964331)

private BoolType()
: base(typeof(DvBool), DataKind.BL)
private readonly string _name;

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmmm. What's this for? Is it still relevant? #Closed

@TomFinley

TomFinley commented Aug 29, 2018

Copy link
Copy Markdown
Contributor

Change looks OK for now, let's hold off till after 0.5 is cut then we can perhaps do all the changes to the type system in one go. #Resolved

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @codemzs let's hold off till 0.5 though.

@codemzscodemzs changed the title Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types. WIPAug 29, 2018
@@ -731,6 +731,12 @@ public void GetMetadata<TValue>(string kind, int col, ref TValue value)
/// </summary>
private const ulong ReaderVersion = MissingTextVersion;

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ReaderVersion = MissingTextVersion [](start = 28, length = 34)

This was not updated, it should have been. We can read StandardDataTypesVersion so it should be that. #Resolved

Header.VersionToString(header.CompatibleVersion), Header.VersionToString(MetadataVersion));
}
if (header.CompatibleVersion > ReaderVersion)
if (header.CompatibleVersion > StandardDataTypesVersion)

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CompatibleVersion > StandardDataTypesVersion [](start = 23, length = 44)

Revert these two lines please. #Resolved

/// The first version that removes DvTypes and uses .NET standard
/// data types.
/// </summary>
private const ulong StandardDataTypesVersion = 0x0001000100010006;

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

StandardDataTypesVersion [](start = 28, length = 24)

Also will need to update the constant in Header.cs. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

Sounds good, thanks for reviewing. I was wondering if we should bump the version number for every type conversion PR check-in as this will allow us to check-in PRs without waiting for other PRs to close, thoughts?


In reply to: 417051605 [](ancestors = 417051605)

@codemzs

codemzs commented Aug 30, 2018

Copy link
Copy Markdown
MemberAuthor
 /// Missing values are mapped to zero with a true return.

Fix this #Resolved


Refers to: src/Microsoft.ML.Data/Data/Conversion.cs:1199 in 40c01fc. [](commit_id = 40c01fc, deletion_comment = False)


Assert.True(error);

//5. Missing value in text to int.

@codemzscodemzsAug 30, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

//5. Missing value in text to int. [](start = 12, length = 34)

Empty string #Resolved

mapper(ref src, ref dst);
Assert.Equal(default, dst);

//6. Empty string in text to sbyte.

@codemzscodemzsAug 30, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

  1. Empty string in text to sbyte. [](start = 14, length = 33)

Missing value #Resolved

…to types
# Conflicts:
#	test/Microsoft.ML.TestFramework/DataPipe/TestDataPipeBase.cs
@TomFinley

Copy link
Copy Markdown
Contributor

I think we can avoid in those cases since I feel like we can easily just have separate codecs probably. In this case we could not avoid I think because we were using the same codec for both purposes.


In reply to: 417434524 [](ancestors = 417434524,417051605)

@TomFinley

TomFinley commented Aug 31, 2018

Copy link
Copy Markdown
Contributor

datatypes.idv is still shown as being modified in latest commit #Resolved

…to types
# Conflicts:
#	test/BaselineOutput/SingleDebug/SavePipe/TestParquetPrimitiveDataTypes-Data.txt
#	test/BaselineOutput/SingleDebug/SavePipe/TestParquetPrimitiveDataTypes-Schema.txt
#	test/BaselineOutput/SingleRelease/SavePipe/TestParquetPrimitiveDataTypes-Data.txt
#	test/BaselineOutput/SingleRelease/SavePipe/TestParquetPrimitiveDataTypes-Schema.txt
#	test/data/Parquet/alltypes.parquet
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types. WIPReplace DvInt* with .NET standard data types.Sep 4, 2018
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types. WIPSep 4, 2018
@TomFinley

TomFinley commented Sep 4, 2018

Copy link
Copy Markdown
Contributor

Hi @codemzs you may want to merge master again, I think our work on APIs and additional tests for pigsty may interfere. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

Done.


In reply to: 418545763 [](ancestors = 418545763)

@codemzs

Copy link
Copy Markdown
MemberAuthor

This change was committed via #863

@codemzscodemzs closed this Sep 20, 2018
@codemzs
codemzs deleted the types branch September 20, 2018 18:17
@ghostghost locked as resolved and limited conversation to collaborators Mar 29, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET data type system instead of DvTypes

4 participants

@codemzs@TomFinley@eerhardt@GalOshri
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Replace DvInt* with .NET standard data types. WIP - #683

Closed
codemzs wants to merge 56 commits into
dotnet:masterfrom
codemzs:types
Closed

Replace DvInt* with .NET standard data types. WIP#683
codemzs wants to merge 56 commits into
dotnet:masterfrom
codemzs:types

Conversation

@codemzs

@codemzscodemzs commented Aug 16, 2018

Copy link
Copy Markdown
Member

This change also removes missing value handling for sbyte, short, int and long because default of these values is a null and that does not fit well with sparse vector architecture where default for missing values is a zero. fixes#673

RegisterSimpleCodec(new UnsafeTypeCodec<sbyte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<byte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<DvInt2>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<Int16>(this));

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Int16 [](start = 52, length = 5)

short, int, long, not Int16, Int32, Int64. #Closed

}

private void GetCategoricalSlotRanges(int iiinfo, ref VBuffer<DvInt4> dst)
private void GetCategoricalSlotRanges(int iiinfo, ref VBuffer<Int32> dst)

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Int32 [](start = 74, length = 5)

Please just use the keywords for types (so, in this case int), here and everywhere. #Closed

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I made this change across the code base using find-replace. #Resolved


public void Conv(ref long? src, ref DvInt8 dst) => dst = src ?? DvInt8.NA;
public void Conv(ref long? src, ref Int64? dst) => dst = src;

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see there are no conversions from float to float, or double to double. So: are these conversions actually necessary? #Resolved

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I have updated this code to not assume there can be nullables but I do see a conversion between byte and byte. @mandyshieh can you please take a look? #Resolved

@TomFinley

TomFinley commented Aug 16, 2018

Copy link
Copy Markdown
Contributor
 public RefPredicate<T> GetIsDefaultPredicate<T>(ColumnType type)

You will need to be careful here. We want the "default" of the new nullable integer types to be 0, since that's both a more sensible choice and it retains sparsity preservation for conversion from int? to int. (For that reason it may be beneficial to choose a better name than "default" since it will no longer be identical with C# sparsity.)

The implications for things like VBufferUtils.Densify are interesting.

The sparsity question will be quite far reaching, and will be by far the most challenging part of this change. #Resolved


Refers to: src/Microsoft.ML.Data/Data/Conversion.cs:703 in a0ceabb. [](commit_id = a0ceabb, deletion_comment = False)

RegisterSimpleCodec(new UnsafeTypeCodec<sbyte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<byte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<DvInt2>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<Int16>(this));

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

RegisterSimpleCodec(new UnsafeTypeCodec(this)); [](start = 12, length = 54)

We will want the nullable types to be serializable. #Closed

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This is not needed since there will no nullable types 👍 #Resolved

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good, thanks @codemzs. Incidentally were you going to update the description of #673 pursuant to our discussions yesterday? It is still the old description.

Edit: Actually I don't think you've linked to that issue from this PR at all. You should, maybe "fixes #673" in your description.


In reply to: 210744044 [](ancestors = 210744044)

@codemzscodemzs changed the title WIP Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types and remove missing value handling for sbyte, short, int and long.Aug 16, 2018
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types and remove missing value handling for sbyte, short, int and long.Replace DvInt* with .NET standard data types.Aug 16, 2018
namespace Microsoft.ML.Runtime.Internal.Utilities
{
// Reasonable choices are Double and System.Int64.
// Reasonable choices are Double and System.long.

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

long [](start = 48, length = 4)

fix this #Resolved

{
Ch.Assert(colType.ItemType == NumberType.I4);
return CreateConvertingArrayGetterDelegate<int?, DvInt4>(index, x => x ?? DvInt4.NA);
return CreateConvertingArrayGetterDelegate<int, int>(index, x => x);

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need a "converting" delegate here to return the same value? #Resolved

if (type == typeof(DvInt1) || type == typeof(sbyte) || type == typeof(sbyte?))
if (type == typeof(sbyte))
kind = DataKind.I1;
else if (type == typeof(byte) || type == typeof(byte?))

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

byte? should be removed here as well, to follow the rest of the changes. #Resolved

@codemzscodemzsAug 17, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Why is "byte?" mapped to a U1? I thought U1 just mapped to a byte and did not support nullables ....this needs to go away anyways


In reply to: 210963225 [](ancestors = 210963225)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Someone made a mistake somewhere, didn't realize this was supposed to be inverse to above function. Who knows who, but we ought to correct now.


In reply to: 210965477 [](ancestors = 210965477,210963225)

using RawI2 = Int16;
using RawI4 = Int32;
using RawI8 = Int64;
using I1 = SByte;

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it make sense to just start using the C# keywords inline in the code? That way readers didn't have to map I2 => short in their heads? #Resolved

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is generally the case except in this one file, if we consider its nature I feel like this would actually impede readability, at least for me.

So:

AddStd<I2,I1>(Convert);AddStd<I2,I2>(Convert);AddStd<I2,I4>(Convert);AddStd<I2,I8>(Convert);AddStd<I2,R4>(Convert);AddStd<I2,R8>(Convert);AddAux<I2,SB>(Convert);

becomes

AddStd<short,byte>(Convert);AddStd<short,short>(Convert);AddStd<short,int>(Convert);AddStd<short,long>(Convert);AddStd<short,float>(Convert);AddStd<short,double>(Convert);AddAux<short,SB>(Convert);

Maybe. That's hardly disastrous I suppose, and might be easier for some people. Perhaps we ought to revisit though once we've done all the type changes we want to do...


In reply to: 210964331 [](ancestors = 210964331)

private BoolType()
: base(typeof(DvBool), DataKind.BL)
private readonly string _name;

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmmm. What's this for? Is it still relevant? #Closed

@TomFinley

TomFinley commented Aug 29, 2018

Copy link
Copy Markdown
Contributor

Change looks OK for now, let's hold off till after 0.5 is cut then we can perhaps do all the changes to the type system in one go. #Resolved

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @codemzs let's hold off till 0.5 though.

@codemzscodemzs changed the title Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types. WIPAug 29, 2018
@@ -731,6 +731,12 @@ public void GetMetadata<TValue>(string kind, int col, ref TValue value)
/// </summary>
private const ulong ReaderVersion = MissingTextVersion;

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ReaderVersion = MissingTextVersion [](start = 28, length = 34)

This was not updated, it should have been. We can read StandardDataTypesVersion so it should be that. #Resolved

Header.VersionToString(header.CompatibleVersion), Header.VersionToString(MetadataVersion));
}
if (header.CompatibleVersion > ReaderVersion)
if (header.CompatibleVersion > StandardDataTypesVersion)

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CompatibleVersion > StandardDataTypesVersion [](start = 23, length = 44)

Revert these two lines please. #Resolved

/// The first version that removes DvTypes and uses .NET standard
/// data types.
/// </summary>
private const ulong StandardDataTypesVersion = 0x0001000100010006;

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

StandardDataTypesVersion [](start = 28, length = 24)

Also will need to update the constant in Header.cs. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

Sounds good, thanks for reviewing. I was wondering if we should bump the version number for every type conversion PR check-in as this will allow us to check-in PRs without waiting for other PRs to close, thoughts?


In reply to: 417051605 [](ancestors = 417051605)

@codemzs

codemzs commented Aug 30, 2018

Copy link
Copy Markdown
MemberAuthor
 /// Missing values are mapped to zero with a true return.

Fix this #Resolved


Refers to: src/Microsoft.ML.Data/Data/Conversion.cs:1199 in 40c01fc. [](commit_id = 40c01fc, deletion_comment = False)


Assert.True(error);

//5. Missing value in text to int.

@codemzscodemzsAug 30, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

//5. Missing value in text to int. [](start = 12, length = 34)

Empty string #Resolved

mapper(ref src, ref dst);
Assert.Equal(default, dst);

//6. Empty string in text to sbyte.

@codemzscodemzsAug 30, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

  1. Empty string in text to sbyte. [](start = 14, length = 33)

Missing value #Resolved

…to types
# Conflicts:
#	test/Microsoft.ML.TestFramework/DataPipe/TestDataPipeBase.cs
@TomFinley

Copy link
Copy Markdown
Contributor

I think we can avoid in those cases since I feel like we can easily just have separate codecs probably. In this case we could not avoid I think because we were using the same codec for both purposes.


In reply to: 417434524 [](ancestors = 417434524,417051605)

@TomFinley

TomFinley commented Aug 31, 2018

Copy link
Copy Markdown
Contributor

datatypes.idv is still shown as being modified in latest commit #Resolved

…to types
# Conflicts:
#	test/BaselineOutput/SingleDebug/SavePipe/TestParquetPrimitiveDataTypes-Data.txt
#	test/BaselineOutput/SingleDebug/SavePipe/TestParquetPrimitiveDataTypes-Schema.txt
#	test/BaselineOutput/SingleRelease/SavePipe/TestParquetPrimitiveDataTypes-Data.txt
#	test/BaselineOutput/SingleRelease/SavePipe/TestParquetPrimitiveDataTypes-Schema.txt
#	test/data/Parquet/alltypes.parquet
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types. WIPReplace DvInt* with .NET standard data types.Sep 4, 2018
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types. WIPSep 4, 2018
@TomFinley

TomFinley commented Sep 4, 2018

Copy link
Copy Markdown
Contributor

Hi @codemzs you may want to merge master again, I think our work on APIs and additional tests for pigsty may interfere. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

Done.


In reply to: 418545763 [](ancestors = 418545763)

@codemzs

Copy link
Copy Markdown
MemberAuthor

This change was committed via #863

@codemzscodemzs closed this Sep 20, 2018
@codemzs
codemzs deleted the types branch September 20, 2018 18:17
@ghostghost locked as resolved and limited conversation to collaborators Mar 29, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET data type system instead of DvTypes

4 participants

@codemzs@TomFinley@eerhardt@GalOshri
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Replace DvInt* with .NET standard data types. WIP - #683

Closed
codemzs wants to merge 56 commits into
dotnet:masterfrom
codemzs:types
Closed

Replace DvInt* with .NET standard data types. WIP#683
codemzs wants to merge 56 commits into
dotnet:masterfrom
codemzs:types

Conversation

@codemzs

@codemzscodemzs commented Aug 16, 2018

Copy link
Copy Markdown
Member

This change also removes missing value handling for sbyte, short, int and long because default of these values is a null and that does not fit well with sparse vector architecture where default for missing values is a zero. fixes#673

RegisterSimpleCodec(new UnsafeTypeCodec<sbyte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<byte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<DvInt2>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<Int16>(this));

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Int16 [](start = 52, length = 5)

short, int, long, not Int16, Int32, Int64. #Closed

}

private void GetCategoricalSlotRanges(int iiinfo, ref VBuffer<DvInt4> dst)
private void GetCategoricalSlotRanges(int iiinfo, ref VBuffer<Int32> dst)

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Int32 [](start = 74, length = 5)

Please just use the keywords for types (so, in this case int), here and everywhere. #Closed

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I made this change across the code base using find-replace. #Resolved


public void Conv(ref long? src, ref DvInt8 dst) => dst = src ?? DvInt8.NA;
public void Conv(ref long? src, ref Int64? dst) => dst = src;

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see there are no conversions from float to float, or double to double. So: are these conversions actually necessary? #Resolved

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I have updated this code to not assume there can be nullables but I do see a conversion between byte and byte. @mandyshieh can you please take a look? #Resolved

@TomFinley

TomFinley commented Aug 16, 2018

Copy link
Copy Markdown
Contributor
 public RefPredicate<T> GetIsDefaultPredicate<T>(ColumnType type)

You will need to be careful here. We want the "default" of the new nullable integer types to be 0, since that's both a more sensible choice and it retains sparsity preservation for conversion from int? to int. (For that reason it may be beneficial to choose a better name than "default" since it will no longer be identical with C# sparsity.)

The implications for things like VBufferUtils.Densify are interesting.

The sparsity question will be quite far reaching, and will be by far the most challenging part of this change. #Resolved


Refers to: src/Microsoft.ML.Data/Data/Conversion.cs:703 in a0ceabb. [](commit_id = a0ceabb, deletion_comment = False)

RegisterSimpleCodec(new UnsafeTypeCodec<sbyte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<byte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<DvInt2>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<Int16>(this));

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

RegisterSimpleCodec(new UnsafeTypeCodec(this)); [](start = 12, length = 54)

We will want the nullable types to be serializable. #Closed

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This is not needed since there will no nullable types 👍 #Resolved

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good, thanks @codemzs. Incidentally were you going to update the description of #673 pursuant to our discussions yesterday? It is still the old description.

Edit: Actually I don't think you've linked to that issue from this PR at all. You should, maybe "fixes #673" in your description.


In reply to: 210744044 [](ancestors = 210744044)

@codemzscodemzs changed the title WIP Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types and remove missing value handling for sbyte, short, int and long.Aug 16, 2018
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types and remove missing value handling for sbyte, short, int and long.Replace DvInt* with .NET standard data types.Aug 16, 2018
namespace Microsoft.ML.Runtime.Internal.Utilities
{
// Reasonable choices are Double and System.Int64.
// Reasonable choices are Double and System.long.

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

long [](start = 48, length = 4)

fix this #Resolved

{
Ch.Assert(colType.ItemType == NumberType.I4);
return CreateConvertingArrayGetterDelegate<int?, DvInt4>(index, x => x ?? DvInt4.NA);
return CreateConvertingArrayGetterDelegate<int, int>(index, x => x);

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need a "converting" delegate here to return the same value? #Resolved

if (type == typeof(DvInt1) || type == typeof(sbyte) || type == typeof(sbyte?))
if (type == typeof(sbyte))
kind = DataKind.I1;
else if (type == typeof(byte) || type == typeof(byte?))

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

byte? should be removed here as well, to follow the rest of the changes. #Resolved

@codemzscodemzsAug 17, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Why is "byte?" mapped to a U1? I thought U1 just mapped to a byte and did not support nullables ....this needs to go away anyways


In reply to: 210963225 [](ancestors = 210963225)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Someone made a mistake somewhere, didn't realize this was supposed to be inverse to above function. Who knows who, but we ought to correct now.


In reply to: 210965477 [](ancestors = 210965477,210963225)

using RawI2 = Int16;
using RawI4 = Int32;
using RawI8 = Int64;
using I1 = SByte;

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it make sense to just start using the C# keywords inline in the code? That way readers didn't have to map I2 => short in their heads? #Resolved

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is generally the case except in this one file, if we consider its nature I feel like this would actually impede readability, at least for me.

So:

AddStd<I2,I1>(Convert);AddStd<I2,I2>(Convert);AddStd<I2,I4>(Convert);AddStd<I2,I8>(Convert);AddStd<I2,R4>(Convert);AddStd<I2,R8>(Convert);AddAux<I2,SB>(Convert);

becomes

AddStd<short,byte>(Convert);AddStd<short,short>(Convert);AddStd<short,int>(Convert);AddStd<short,long>(Convert);AddStd<short,float>(Convert);AddStd<short,double>(Convert);AddAux<short,SB>(Convert);

Maybe. That's hardly disastrous I suppose, and might be easier for some people. Perhaps we ought to revisit though once we've done all the type changes we want to do...


In reply to: 210964331 [](ancestors = 210964331)

private BoolType()
: base(typeof(DvBool), DataKind.BL)
private readonly string _name;

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmmm. What's this for? Is it still relevant? #Closed

@TomFinley

TomFinley commented Aug 29, 2018

Copy link
Copy Markdown
Contributor

Change looks OK for now, let's hold off till after 0.5 is cut then we can perhaps do all the changes to the type system in one go. #Resolved

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @codemzs let's hold off till 0.5 though.

@codemzscodemzs changed the title Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types. WIPAug 29, 2018
@@ -731,6 +731,12 @@ public void GetMetadata<TValue>(string kind, int col, ref TValue value)
/// </summary>
private const ulong ReaderVersion = MissingTextVersion;

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ReaderVersion = MissingTextVersion [](start = 28, length = 34)

This was not updated, it should have been. We can read StandardDataTypesVersion so it should be that. #Resolved

Header.VersionToString(header.CompatibleVersion), Header.VersionToString(MetadataVersion));
}
if (header.CompatibleVersion > ReaderVersion)
if (header.CompatibleVersion > StandardDataTypesVersion)

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CompatibleVersion > StandardDataTypesVersion [](start = 23, length = 44)

Revert these two lines please. #Resolved

/// The first version that removes DvTypes and uses .NET standard
/// data types.
/// </summary>
private const ulong StandardDataTypesVersion = 0x0001000100010006;

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

StandardDataTypesVersion [](start = 28, length = 24)

Also will need to update the constant in Header.cs. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

Sounds good, thanks for reviewing. I was wondering if we should bump the version number for every type conversion PR check-in as this will allow us to check-in PRs without waiting for other PRs to close, thoughts?


In reply to: 417051605 [](ancestors = 417051605)

@codemzs

codemzs commented Aug 30, 2018

Copy link
Copy Markdown
MemberAuthor
 /// Missing values are mapped to zero with a true return.

Fix this #Resolved


Refers to: src/Microsoft.ML.Data/Data/Conversion.cs:1199 in 40c01fc. [](commit_id = 40c01fc, deletion_comment = False)


Assert.True(error);

//5. Missing value in text to int.

@codemzscodemzsAug 30, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

//5. Missing value in text to int. [](start = 12, length = 34)

Empty string #Resolved

mapper(ref src, ref dst);
Assert.Equal(default, dst);

//6. Empty string in text to sbyte.

@codemzscodemzsAug 30, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

  1. Empty string in text to sbyte. [](start = 14, length = 33)

Missing value #Resolved

…to types
# Conflicts:
#	test/Microsoft.ML.TestFramework/DataPipe/TestDataPipeBase.cs
@TomFinley

Copy link
Copy Markdown
Contributor

I think we can avoid in those cases since I feel like we can easily just have separate codecs probably. In this case we could not avoid I think because we were using the same codec for both purposes.


In reply to: 417434524 [](ancestors = 417434524,417051605)

@TomFinley

TomFinley commented Aug 31, 2018

Copy link
Copy Markdown
Contributor

datatypes.idv is still shown as being modified in latest commit #Resolved

…to types
# Conflicts:
#	test/BaselineOutput/SingleDebug/SavePipe/TestParquetPrimitiveDataTypes-Data.txt
#	test/BaselineOutput/SingleDebug/SavePipe/TestParquetPrimitiveDataTypes-Schema.txt
#	test/BaselineOutput/SingleRelease/SavePipe/TestParquetPrimitiveDataTypes-Data.txt
#	test/BaselineOutput/SingleRelease/SavePipe/TestParquetPrimitiveDataTypes-Schema.txt
#	test/data/Parquet/alltypes.parquet
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types. WIPReplace DvInt* with .NET standard data types.Sep 4, 2018
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types. WIPSep 4, 2018
@TomFinley

TomFinley commented Sep 4, 2018

Copy link
Copy Markdown
Contributor

Hi @codemzs you may want to merge master again, I think our work on APIs and additional tests for pigsty may interfere. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

Done.


In reply to: 418545763 [](ancestors = 418545763)

@codemzs

Copy link
Copy Markdown
MemberAuthor

This change was committed via #863

@codemzscodemzs closed this Sep 20, 2018
@codemzs
codemzs deleted the types branch September 20, 2018 18:17
@ghostghost locked as resolved and limited conversation to collaborators Mar 29, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET data type system instead of DvTypes

4 participants

@codemzs@TomFinley@eerhardt@GalOshri
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Replace DvInt* with .NET standard data types. WIP - #683

Closed
codemzs wants to merge 56 commits into
dotnet:masterfrom
codemzs:types
Closed

Replace DvInt* with .NET standard data types. WIP#683
codemzs wants to merge 56 commits into
dotnet:masterfrom
codemzs:types

Conversation

@codemzs

@codemzscodemzs commented Aug 16, 2018

Copy link
Copy Markdown
Member

This change also removes missing value handling for sbyte, short, int and long because default of these values is a null and that does not fit well with sparse vector architecture where default for missing values is a zero. fixes#673

RegisterSimpleCodec(new UnsafeTypeCodec<sbyte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<byte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<DvInt2>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<Int16>(this));

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Int16 [](start = 52, length = 5)

short, int, long, not Int16, Int32, Int64. #Closed

}

private void GetCategoricalSlotRanges(int iiinfo, ref VBuffer<DvInt4> dst)
private void GetCategoricalSlotRanges(int iiinfo, ref VBuffer<Int32> dst)

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Int32 [](start = 74, length = 5)

Please just use the keywords for types (so, in this case int), here and everywhere. #Closed

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I made this change across the code base using find-replace. #Resolved


public void Conv(ref long? src, ref DvInt8 dst) => dst = src ?? DvInt8.NA;
public void Conv(ref long? src, ref Int64? dst) => dst = src;

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see there are no conversions from float to float, or double to double. So: are these conversions actually necessary? #Resolved

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I have updated this code to not assume there can be nullables but I do see a conversion between byte and byte. @mandyshieh can you please take a look? #Resolved

@TomFinley

TomFinley commented Aug 16, 2018

Copy link
Copy Markdown
Contributor
 public RefPredicate<T> GetIsDefaultPredicate<T>(ColumnType type)

You will need to be careful here. We want the "default" of the new nullable integer types to be 0, since that's both a more sensible choice and it retains sparsity preservation for conversion from int? to int. (For that reason it may be beneficial to choose a better name than "default" since it will no longer be identical with C# sparsity.)

The implications for things like VBufferUtils.Densify are interesting.

The sparsity question will be quite far reaching, and will be by far the most challenging part of this change. #Resolved


Refers to: src/Microsoft.ML.Data/Data/Conversion.cs:703 in a0ceabb. [](commit_id = a0ceabb, deletion_comment = False)

RegisterSimpleCodec(new UnsafeTypeCodec<sbyte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<byte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<DvInt2>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<Int16>(this));

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

RegisterSimpleCodec(new UnsafeTypeCodec(this)); [](start = 12, length = 54)

We will want the nullable types to be serializable. #Closed

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This is not needed since there will no nullable types 👍 #Resolved

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good, thanks @codemzs. Incidentally were you going to update the description of #673 pursuant to our discussions yesterday? It is still the old description.

Edit: Actually I don't think you've linked to that issue from this PR at all. You should, maybe "fixes #673" in your description.


In reply to: 210744044 [](ancestors = 210744044)

@codemzscodemzs changed the title WIP Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types and remove missing value handling for sbyte, short, int and long.Aug 16, 2018
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types and remove missing value handling for sbyte, short, int and long.Replace DvInt* with .NET standard data types.Aug 16, 2018
namespace Microsoft.ML.Runtime.Internal.Utilities
{
// Reasonable choices are Double and System.Int64.
// Reasonable choices are Double and System.long.

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

long [](start = 48, length = 4)

fix this #Resolved

{
Ch.Assert(colType.ItemType == NumberType.I4);
return CreateConvertingArrayGetterDelegate<int?, DvInt4>(index, x => x ?? DvInt4.NA);
return CreateConvertingArrayGetterDelegate<int, int>(index, x => x);

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need a "converting" delegate here to return the same value? #Resolved

if (type == typeof(DvInt1) || type == typeof(sbyte) || type == typeof(sbyte?))
if (type == typeof(sbyte))
kind = DataKind.I1;
else if (type == typeof(byte) || type == typeof(byte?))

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

byte? should be removed here as well, to follow the rest of the changes. #Resolved

@codemzscodemzsAug 17, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Why is "byte?" mapped to a U1? I thought U1 just mapped to a byte and did not support nullables ....this needs to go away anyways


In reply to: 210963225 [](ancestors = 210963225)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Someone made a mistake somewhere, didn't realize this was supposed to be inverse to above function. Who knows who, but we ought to correct now.


In reply to: 210965477 [](ancestors = 210965477,210963225)

using RawI2 = Int16;
using RawI4 = Int32;
using RawI8 = Int64;
using I1 = SByte;

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it make sense to just start using the C# keywords inline in the code? That way readers didn't have to map I2 => short in their heads? #Resolved

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is generally the case except in this one file, if we consider its nature I feel like this would actually impede readability, at least for me.

So:

AddStd<I2,I1>(Convert);AddStd<I2,I2>(Convert);AddStd<I2,I4>(Convert);AddStd<I2,I8>(Convert);AddStd<I2,R4>(Convert);AddStd<I2,R8>(Convert);AddAux<I2,SB>(Convert);

becomes

AddStd<short,byte>(Convert);AddStd<short,short>(Convert);AddStd<short,int>(Convert);AddStd<short,long>(Convert);AddStd<short,float>(Convert);AddStd<short,double>(Convert);AddAux<short,SB>(Convert);

Maybe. That's hardly disastrous I suppose, and might be easier for some people. Perhaps we ought to revisit though once we've done all the type changes we want to do...


In reply to: 210964331 [](ancestors = 210964331)

private BoolType()
: base(typeof(DvBool), DataKind.BL)
private readonly string _name;

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmmm. What's this for? Is it still relevant? #Closed

@TomFinley

TomFinley commented Aug 29, 2018

Copy link
Copy Markdown
Contributor

Change looks OK for now, let's hold off till after 0.5 is cut then we can perhaps do all the changes to the type system in one go. #Resolved

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @codemzs let's hold off till 0.5 though.

@codemzscodemzs changed the title Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types. WIPAug 29, 2018
@@ -731,6 +731,12 @@ public void GetMetadata<TValue>(string kind, int col, ref TValue value)
/// </summary>
private const ulong ReaderVersion = MissingTextVersion;

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ReaderVersion = MissingTextVersion [](start = 28, length = 34)

This was not updated, it should have been. We can read StandardDataTypesVersion so it should be that. #Resolved

Header.VersionToString(header.CompatibleVersion), Header.VersionToString(MetadataVersion));
}
if (header.CompatibleVersion > ReaderVersion)
if (header.CompatibleVersion > StandardDataTypesVersion)

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CompatibleVersion > StandardDataTypesVersion [](start = 23, length = 44)

Revert these two lines please. #Resolved

/// The first version that removes DvTypes and uses .NET standard
/// data types.
/// </summary>
private const ulong StandardDataTypesVersion = 0x0001000100010006;

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

StandardDataTypesVersion [](start = 28, length = 24)

Also will need to update the constant in Header.cs. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

Sounds good, thanks for reviewing. I was wondering if we should bump the version number for every type conversion PR check-in as this will allow us to check-in PRs without waiting for other PRs to close, thoughts?


In reply to: 417051605 [](ancestors = 417051605)

@codemzs

codemzs commented Aug 30, 2018

Copy link
Copy Markdown
MemberAuthor
 /// Missing values are mapped to zero with a true return.

Fix this #Resolved


Refers to: src/Microsoft.ML.Data/Data/Conversion.cs:1199 in 40c01fc. [](commit_id = 40c01fc, deletion_comment = False)


Assert.True(error);

//5. Missing value in text to int.

@codemzscodemzsAug 30, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

//5. Missing value in text to int. [](start = 12, length = 34)

Empty string #Resolved

mapper(ref src, ref dst);
Assert.Equal(default, dst);

//6. Empty string in text to sbyte.

@codemzscodemzsAug 30, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

  1. Empty string in text to sbyte. [](start = 14, length = 33)

Missing value #Resolved

…to types
# Conflicts:
#	test/Microsoft.ML.TestFramework/DataPipe/TestDataPipeBase.cs
@TomFinley

Copy link
Copy Markdown
Contributor

I think we can avoid in those cases since I feel like we can easily just have separate codecs probably. In this case we could not avoid I think because we were using the same codec for both purposes.


In reply to: 417434524 [](ancestors = 417434524,417051605)

@TomFinley

TomFinley commented Aug 31, 2018

Copy link
Copy Markdown
Contributor

datatypes.idv is still shown as being modified in latest commit #Resolved

…to types
# Conflicts:
#	test/BaselineOutput/SingleDebug/SavePipe/TestParquetPrimitiveDataTypes-Data.txt
#	test/BaselineOutput/SingleDebug/SavePipe/TestParquetPrimitiveDataTypes-Schema.txt
#	test/BaselineOutput/SingleRelease/SavePipe/TestParquetPrimitiveDataTypes-Data.txt
#	test/BaselineOutput/SingleRelease/SavePipe/TestParquetPrimitiveDataTypes-Schema.txt
#	test/data/Parquet/alltypes.parquet
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types. WIPReplace DvInt* with .NET standard data types.Sep 4, 2018
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types. WIPSep 4, 2018
@TomFinley

TomFinley commented Sep 4, 2018

Copy link
Copy Markdown
Contributor

Hi @codemzs you may want to merge master again, I think our work on APIs and additional tests for pigsty may interfere. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

Done.


In reply to: 418545763 [](ancestors = 418545763)

@codemzs

Copy link
Copy Markdown
MemberAuthor

This change was committed via #863

@codemzscodemzs closed this Sep 20, 2018
@codemzs
codemzs deleted the types branch September 20, 2018 18:17
@ghostghost locked as resolved and limited conversation to collaborators Mar 29, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET data type system instead of DvTypes

4 participants

@codemzs@TomFinley@eerhardt@GalOshri
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Replace DvInt* with .NET standard data types. WIP - #683

Closed
codemzs wants to merge 56 commits into
dotnet:masterfrom
codemzs:types
Closed

Replace DvInt* with .NET standard data types. WIP#683
codemzs wants to merge 56 commits into
dotnet:masterfrom
codemzs:types

Conversation

@codemzs

@codemzscodemzs commented Aug 16, 2018

Copy link
Copy Markdown
Member

This change also removes missing value handling for sbyte, short, int and long because default of these values is a null and that does not fit well with sparse vector architecture where default for missing values is a zero. fixes#673

RegisterSimpleCodec(new UnsafeTypeCodec<sbyte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<byte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<DvInt2>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<Int16>(this));

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Int16 [](start = 52, length = 5)

short, int, long, not Int16, Int32, Int64. #Closed

}

private void GetCategoricalSlotRanges(int iiinfo, ref VBuffer<DvInt4> dst)
private void GetCategoricalSlotRanges(int iiinfo, ref VBuffer<Int32> dst)

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Int32 [](start = 74, length = 5)

Please just use the keywords for types (so, in this case int), here and everywhere. #Closed

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I made this change across the code base using find-replace. #Resolved


public void Conv(ref long? src, ref DvInt8 dst) => dst = src ?? DvInt8.NA;
public void Conv(ref long? src, ref Int64? dst) => dst = src;

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see there are no conversions from float to float, or double to double. So: are these conversions actually necessary? #Resolved

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I have updated this code to not assume there can be nullables but I do see a conversion between byte and byte. @mandyshieh can you please take a look? #Resolved

@TomFinley

TomFinley commented Aug 16, 2018

Copy link
Copy Markdown
Contributor
 public RefPredicate<T> GetIsDefaultPredicate<T>(ColumnType type)

You will need to be careful here. We want the "default" of the new nullable integer types to be 0, since that's both a more sensible choice and it retains sparsity preservation for conversion from int? to int. (For that reason it may be beneficial to choose a better name than "default" since it will no longer be identical with C# sparsity.)

The implications for things like VBufferUtils.Densify are interesting.

The sparsity question will be quite far reaching, and will be by far the most challenging part of this change. #Resolved


Refers to: src/Microsoft.ML.Data/Data/Conversion.cs:703 in a0ceabb. [](commit_id = a0ceabb, deletion_comment = False)

RegisterSimpleCodec(new UnsafeTypeCodec<sbyte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<byte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<DvInt2>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<Int16>(this));

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

RegisterSimpleCodec(new UnsafeTypeCodec(this)); [](start = 12, length = 54)

We will want the nullable types to be serializable. #Closed

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This is not needed since there will no nullable types 👍 #Resolved

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good, thanks @codemzs. Incidentally were you going to update the description of #673 pursuant to our discussions yesterday? It is still the old description.

Edit: Actually I don't think you've linked to that issue from this PR at all. You should, maybe "fixes #673" in your description.


In reply to: 210744044 [](ancestors = 210744044)

@codemzscodemzs changed the title WIP Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types and remove missing value handling for sbyte, short, int and long.Aug 16, 2018
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types and remove missing value handling for sbyte, short, int and long.Replace DvInt* with .NET standard data types.Aug 16, 2018
namespace Microsoft.ML.Runtime.Internal.Utilities
{
// Reasonable choices are Double and System.Int64.
// Reasonable choices are Double and System.long.

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

long [](start = 48, length = 4)

fix this #Resolved

{
Ch.Assert(colType.ItemType == NumberType.I4);
return CreateConvertingArrayGetterDelegate<int?, DvInt4>(index, x => x ?? DvInt4.NA);
return CreateConvertingArrayGetterDelegate<int, int>(index, x => x);

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need a "converting" delegate here to return the same value? #Resolved

if (type == typeof(DvInt1) || type == typeof(sbyte) || type == typeof(sbyte?))
if (type == typeof(sbyte))
kind = DataKind.I1;
else if (type == typeof(byte) || type == typeof(byte?))

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

byte? should be removed here as well, to follow the rest of the changes. #Resolved

@codemzscodemzsAug 17, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Why is "byte?" mapped to a U1? I thought U1 just mapped to a byte and did not support nullables ....this needs to go away anyways


In reply to: 210963225 [](ancestors = 210963225)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Someone made a mistake somewhere, didn't realize this was supposed to be inverse to above function. Who knows who, but we ought to correct now.


In reply to: 210965477 [](ancestors = 210965477,210963225)

using RawI2 = Int16;
using RawI4 = Int32;
using RawI8 = Int64;
using I1 = SByte;

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it make sense to just start using the C# keywords inline in the code? That way readers didn't have to map I2 => short in their heads? #Resolved

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is generally the case except in this one file, if we consider its nature I feel like this would actually impede readability, at least for me.

So:

AddStd<I2,I1>(Convert);AddStd<I2,I2>(Convert);AddStd<I2,I4>(Convert);AddStd<I2,I8>(Convert);AddStd<I2,R4>(Convert);AddStd<I2,R8>(Convert);AddAux<I2,SB>(Convert);

becomes

AddStd<short,byte>(Convert);AddStd<short,short>(Convert);AddStd<short,int>(Convert);AddStd<short,long>(Convert);AddStd<short,float>(Convert);AddStd<short,double>(Convert);AddAux<short,SB>(Convert);

Maybe. That's hardly disastrous I suppose, and might be easier for some people. Perhaps we ought to revisit though once we've done all the type changes we want to do...


In reply to: 210964331 [](ancestors = 210964331)

private BoolType()
: base(typeof(DvBool), DataKind.BL)
private readonly string _name;

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmmm. What's this for? Is it still relevant? #Closed

@TomFinley

TomFinley commented Aug 29, 2018

Copy link
Copy Markdown
Contributor

Change looks OK for now, let's hold off till after 0.5 is cut then we can perhaps do all the changes to the type system in one go. #Resolved

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @codemzs let's hold off till 0.5 though.

@codemzscodemzs changed the title Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types. WIPAug 29, 2018
@@ -731,6 +731,12 @@ public void GetMetadata<TValue>(string kind, int col, ref TValue value)
/// </summary>
private const ulong ReaderVersion = MissingTextVersion;

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ReaderVersion = MissingTextVersion [](start = 28, length = 34)

This was not updated, it should have been. We can read StandardDataTypesVersion so it should be that. #Resolved

Header.VersionToString(header.CompatibleVersion), Header.VersionToString(MetadataVersion));
}
if (header.CompatibleVersion > ReaderVersion)
if (header.CompatibleVersion > StandardDataTypesVersion)

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CompatibleVersion > StandardDataTypesVersion [](start = 23, length = 44)

Revert these two lines please. #Resolved

/// The first version that removes DvTypes and uses .NET standard
/// data types.
/// </summary>
private const ulong StandardDataTypesVersion = 0x0001000100010006;

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

StandardDataTypesVersion [](start = 28, length = 24)

Also will need to update the constant in Header.cs. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

Sounds good, thanks for reviewing. I was wondering if we should bump the version number for every type conversion PR check-in as this will allow us to check-in PRs without waiting for other PRs to close, thoughts?


In reply to: 417051605 [](ancestors = 417051605)

@codemzs

codemzs commented Aug 30, 2018

Copy link
Copy Markdown
MemberAuthor
 /// Missing values are mapped to zero with a true return.

Fix this #Resolved


Refers to: src/Microsoft.ML.Data/Data/Conversion.cs:1199 in 40c01fc. [](commit_id = 40c01fc, deletion_comment = False)


Assert.True(error);

//5. Missing value in text to int.

@codemzscodemzsAug 30, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

//5. Missing value in text to int. [](start = 12, length = 34)

Empty string #Resolved

mapper(ref src, ref dst);
Assert.Equal(default, dst);

//6. Empty string in text to sbyte.

@codemzscodemzsAug 30, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

  1. Empty string in text to sbyte. [](start = 14, length = 33)

Missing value #Resolved

…to types
# Conflicts:
#	test/Microsoft.ML.TestFramework/DataPipe/TestDataPipeBase.cs
@TomFinley

Copy link
Copy Markdown
Contributor

I think we can avoid in those cases since I feel like we can easily just have separate codecs probably. In this case we could not avoid I think because we were using the same codec for both purposes.


In reply to: 417434524 [](ancestors = 417434524,417051605)

@TomFinley

TomFinley commented Aug 31, 2018

Copy link
Copy Markdown
Contributor

datatypes.idv is still shown as being modified in latest commit #Resolved

…to types
# Conflicts:
#	test/BaselineOutput/SingleDebug/SavePipe/TestParquetPrimitiveDataTypes-Data.txt
#	test/BaselineOutput/SingleDebug/SavePipe/TestParquetPrimitiveDataTypes-Schema.txt
#	test/BaselineOutput/SingleRelease/SavePipe/TestParquetPrimitiveDataTypes-Data.txt
#	test/BaselineOutput/SingleRelease/SavePipe/TestParquetPrimitiveDataTypes-Schema.txt
#	test/data/Parquet/alltypes.parquet
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types. WIPReplace DvInt* with .NET standard data types.Sep 4, 2018
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types. WIPSep 4, 2018
@TomFinley

TomFinley commented Sep 4, 2018

Copy link
Copy Markdown
Contributor

Hi @codemzs you may want to merge master again, I think our work on APIs and additional tests for pigsty may interfere. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

Done.


In reply to: 418545763 [](ancestors = 418545763)

@codemzs

Copy link
Copy Markdown
MemberAuthor

This change was committed via #863

@codemzscodemzs closed this Sep 20, 2018
@codemzs
codemzs deleted the types branch September 20, 2018 18:17
@ghostghost locked as resolved and limited conversation to collaborators Mar 29, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET data type system instead of DvTypes

4 participants

@codemzs@TomFinley@eerhardt@GalOshri
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Replace DvInt* with .NET standard data types. WIP - #683

Closed
codemzs wants to merge 56 commits into
dotnet:masterfrom
codemzs:types
Closed

Replace DvInt* with .NET standard data types. WIP#683
codemzs wants to merge 56 commits into
dotnet:masterfrom
codemzs:types

Conversation

@codemzs

@codemzscodemzs commented Aug 16, 2018

Copy link
Copy Markdown
Member

This change also removes missing value handling for sbyte, short, int and long because default of these values is a null and that does not fit well with sparse vector architecture where default for missing values is a zero. fixes#673

RegisterSimpleCodec(new UnsafeTypeCodec<sbyte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<byte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<DvInt2>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<Int16>(this));

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Int16 [](start = 52, length = 5)

short, int, long, not Int16, Int32, Int64. #Closed

}

private void GetCategoricalSlotRanges(int iiinfo, ref VBuffer<DvInt4> dst)
private void GetCategoricalSlotRanges(int iiinfo, ref VBuffer<Int32> dst)

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Int32 [](start = 74, length = 5)

Please just use the keywords for types (so, in this case int), here and everywhere. #Closed

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I made this change across the code base using find-replace. #Resolved


public void Conv(ref long? src, ref DvInt8 dst) => dst = src ?? DvInt8.NA;
public void Conv(ref long? src, ref Int64? dst) => dst = src;

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see there are no conversions from float to float, or double to double. So: are these conversions actually necessary? #Resolved

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I have updated this code to not assume there can be nullables but I do see a conversion between byte and byte. @mandyshieh can you please take a look? #Resolved

@TomFinley

TomFinley commented Aug 16, 2018

Copy link
Copy Markdown
Contributor
 public RefPredicate<T> GetIsDefaultPredicate<T>(ColumnType type)

You will need to be careful here. We want the "default" of the new nullable integer types to be 0, since that's both a more sensible choice and it retains sparsity preservation for conversion from int? to int. (For that reason it may be beneficial to choose a better name than "default" since it will no longer be identical with C# sparsity.)

The implications for things like VBufferUtils.Densify are interesting.

The sparsity question will be quite far reaching, and will be by far the most challenging part of this change. #Resolved


Refers to: src/Microsoft.ML.Data/Data/Conversion.cs:703 in a0ceabb. [](commit_id = a0ceabb, deletion_comment = False)

RegisterSimpleCodec(new UnsafeTypeCodec<sbyte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<byte>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<DvInt2>(this));
RegisterSimpleCodec(new UnsafeTypeCodec<Int16>(this));

@TomFinleyTomFinleyAug 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

RegisterSimpleCodec(new UnsafeTypeCodec(this)); [](start = 12, length = 54)

We will want the nullable types to be serializable. #Closed

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

This is not needed since there will no nullable types 👍 #Resolved

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good, thanks @codemzs. Incidentally were you going to update the description of #673 pursuant to our discussions yesterday? It is still the old description.

Edit: Actually I don't think you've linked to that issue from this PR at all. You should, maybe "fixes #673" in your description.


In reply to: 210744044 [](ancestors = 210744044)

@codemzscodemzs changed the title WIP Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types and remove missing value handling for sbyte, short, int and long.Aug 16, 2018
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types and remove missing value handling for sbyte, short, int and long.Replace DvInt* with .NET standard data types.Aug 16, 2018
namespace Microsoft.ML.Runtime.Internal.Utilities
{
// Reasonable choices are Double and System.Int64.
// Reasonable choices are Double and System.long.

@codemzscodemzsAug 16, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

long [](start = 48, length = 4)

fix this #Resolved

{
Ch.Assert(colType.ItemType == NumberType.I4);
return CreateConvertingArrayGetterDelegate<int?, DvInt4>(index, x => x ?? DvInt4.NA);
return CreateConvertingArrayGetterDelegate<int, int>(index, x => x);

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need a "converting" delegate here to return the same value? #Resolved

if (type == typeof(DvInt1) || type == typeof(sbyte) || type == typeof(sbyte?))
if (type == typeof(sbyte))
kind = DataKind.I1;
else if (type == typeof(byte) || type == typeof(byte?))

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

byte? should be removed here as well, to follow the rest of the changes. #Resolved

@codemzscodemzsAug 17, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Why is "byte?" mapped to a U1? I thought U1 just mapped to a byte and did not support nullables ....this needs to go away anyways


In reply to: 210963225 [](ancestors = 210963225)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Someone made a mistake somewhere, didn't realize this was supposed to be inverse to above function. Who knows who, but we ought to correct now.


In reply to: 210965477 [](ancestors = 210965477,210963225)

using RawI2 = Int16;
using RawI4 = Int32;
using RawI8 = Int64;
using I1 = SByte;

@eerhardteerhardtAug 17, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it make sense to just start using the C# keywords inline in the code? That way readers didn't have to map I2 => short in their heads? #Resolved

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is generally the case except in this one file, if we consider its nature I feel like this would actually impede readability, at least for me.

So:

AddStd<I2,I1>(Convert);AddStd<I2,I2>(Convert);AddStd<I2,I4>(Convert);AddStd<I2,I8>(Convert);AddStd<I2,R4>(Convert);AddStd<I2,R8>(Convert);AddAux<I2,SB>(Convert);

becomes

AddStd<short,byte>(Convert);AddStd<short,short>(Convert);AddStd<short,int>(Convert);AddStd<short,long>(Convert);AddStd<short,float>(Convert);AddStd<short,double>(Convert);AddAux<short,SB>(Convert);

Maybe. That's hardly disastrous I suppose, and might be easier for some people. Perhaps we ought to revisit though once we've done all the type changes we want to do...


In reply to: 210964331 [](ancestors = 210964331)

private BoolType()
: base(typeof(DvBool), DataKind.BL)
private readonly string _name;

@TomFinleyTomFinleyAug 17, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmmm. What's this for? Is it still relevant? #Closed

@TomFinley

TomFinley commented Aug 29, 2018

Copy link
Copy Markdown
Contributor

Change looks OK for now, let's hold off till after 0.5 is cut then we can perhaps do all the changes to the type system in one go. #Resolved

@TomFinleyTomFinley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @codemzs let's hold off till 0.5 though.

@codemzscodemzs changed the title Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types. WIPAug 29, 2018
@@ -731,6 +731,12 @@ public void GetMetadata<TValue>(string kind, int col, ref TValue value)
/// </summary>
private const ulong ReaderVersion = MissingTextVersion;

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ReaderVersion = MissingTextVersion [](start = 28, length = 34)

This was not updated, it should have been. We can read StandardDataTypesVersion so it should be that. #Resolved

Header.VersionToString(header.CompatibleVersion), Header.VersionToString(MetadataVersion));
}
if (header.CompatibleVersion > ReaderVersion)
if (header.CompatibleVersion > StandardDataTypesVersion)

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

CompatibleVersion > StandardDataTypesVersion [](start = 23, length = 44)

Revert these two lines please. #Resolved

/// The first version that removes DvTypes and uses .NET standard
/// data types.
/// </summary>
private const ulong StandardDataTypesVersion = 0x0001000100010006;

@TomFinleyTomFinleyAug 29, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

StandardDataTypesVersion [](start = 28, length = 24)

Also will need to update the constant in Header.cs. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

Sounds good, thanks for reviewing. I was wondering if we should bump the version number for every type conversion PR check-in as this will allow us to check-in PRs without waiting for other PRs to close, thoughts?


In reply to: 417051605 [](ancestors = 417051605)

@codemzs

codemzs commented Aug 30, 2018

Copy link
Copy Markdown
MemberAuthor
 /// Missing values are mapped to zero with a true return.

Fix this #Resolved


Refers to: src/Microsoft.ML.Data/Data/Conversion.cs:1199 in 40c01fc. [](commit_id = 40c01fc, deletion_comment = False)


Assert.True(error);

//5. Missing value in text to int.

@codemzscodemzsAug 30, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

//5. Missing value in text to int. [](start = 12, length = 34)

Empty string #Resolved

mapper(ref src, ref dst);
Assert.Equal(default, dst);

//6. Empty string in text to sbyte.

@codemzscodemzsAug 30, 2018

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

  1. Empty string in text to sbyte. [](start = 14, length = 33)

Missing value #Resolved

…to types
# Conflicts:
#	test/Microsoft.ML.TestFramework/DataPipe/TestDataPipeBase.cs
@TomFinley

Copy link
Copy Markdown
Contributor

I think we can avoid in those cases since I feel like we can easily just have separate codecs probably. In this case we could not avoid I think because we were using the same codec for both purposes.


In reply to: 417434524 [](ancestors = 417434524,417051605)

@TomFinley

TomFinley commented Aug 31, 2018

Copy link
Copy Markdown
Contributor

datatypes.idv is still shown as being modified in latest commit #Resolved

…to types
# Conflicts:
#	test/BaselineOutput/SingleDebug/SavePipe/TestParquetPrimitiveDataTypes-Data.txt
#	test/BaselineOutput/SingleDebug/SavePipe/TestParquetPrimitiveDataTypes-Schema.txt
#	test/BaselineOutput/SingleRelease/SavePipe/TestParquetPrimitiveDataTypes-Data.txt
#	test/BaselineOutput/SingleRelease/SavePipe/TestParquetPrimitiveDataTypes-Schema.txt
#	test/data/Parquet/alltypes.parquet
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types. WIPReplace DvInt* with .NET standard data types.Sep 4, 2018
@codemzscodemzs changed the title Replace DvInt* with .NET standard data types.Replace DvInt* with .NET standard data types. WIPSep 4, 2018
@TomFinley

TomFinley commented Sep 4, 2018

Copy link
Copy Markdown
Contributor

Hi @codemzs you may want to merge master again, I think our work on APIs and additional tests for pigsty may interfere. #Resolved

@codemzs

Copy link
Copy Markdown
MemberAuthor

Done.


In reply to: 418545763 [](ancestors = 418545763)

@codemzs

Copy link
Copy Markdown
MemberAuthor

This change was committed via #863

@codemzscodemzs closed this Sep 20, 2018
@codemzs
codemzs deleted the types branch September 20, 2018 18:17
@ghostghost locked as resolved and limited conversation to collaborators Mar 29, 2022
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET data type system instead of DvTypes

4 participants

@codemzs@TomFinley@eerhardt@GalOshri