Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Microsoft.ML.Api/ApiUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ private static OpCode GetAssignmentOpCode(Type t)
// REVIEW: This should be a Dictionary<Type, OpCode> based solution.
// DvTypes, strings, arrays, all nullable types, VBuffers and UInt128.
if (t == typeof(DvInt8) || t == typeof(DvInt4) || t == typeof(DvInt2) || t == typeof(DvInt1) ||
t == typeof(DvBool) || t == typeof(DvText) || t == typeof(string) || t.IsArray ||
t == typeof(DvText) || t == typeof(string) || t.IsArray ||
(t.IsGenericType && t.GetGenericTypeDefinition() == typeof(VBuffer<>)) ||
(t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>)) ||
t == typeof(DvDateTime) || t == typeof(DvDateTimeZone) || t == typeof(DvTimeSpan) || t == typeof(UInt128))
Expand Down
22 changes: 0 additions & 22 deletions src/Microsoft.ML.Api/DataViewConstructionUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,6 @@ private Delegate CreateGetter(int index)
Ch.Assert(colType.ItemType == NumberType.I1);
return CreateConvertingArrayGetterDelegate<sbyte?, DvInt1>(index, x => x ?? DvInt1.NA);
}
else if (outputType.GetElementType() == typeof(bool))
{
Ch.Assert(colType.ItemType.IsBool);
return CreateConvertingArrayGetterDelegate<bool, DvBool>(index, x => x);
}
else if (outputType.GetElementType() == typeof(bool?))
{
Ch.Assert(colType.ItemType.IsBool);
return CreateConvertingArrayGetterDelegate<bool?, DvBool>(index, x => x ?? DvBool.NA);
}

// T[] -> VBuffer<T>
if (outputType.GetElementType().IsGenericType && outputType.GetElementType().GetGenericTypeDefinition() == typeof(Nullable<>))
Expand Down Expand Up @@ -208,18 +198,6 @@ private Delegate CreateGetter(int index)
Ch.Assert(colType.IsText);
return CreateConvertingGetterDelegate<String, DvText>(index, x => x == null ? DvText.NA : new DvText(x));
}
else if (outputType == typeof(bool))
{
// Bool -> DvBool
Ch.Assert(colType.IsBool);
return CreateConvertingGetterDelegate<bool, DvBool>(index, x => x);
}
else if (outputType == typeof(bool?))
{
// Bool? -> DvBool
Ch.Assert(colType.IsBool);
return CreateConvertingGetterDelegate<bool?, DvBool>(index, x => x ?? DvBool.NA);
}
else if (outputType == typeof(int))
{
// int -> DvInt4
Expand Down
22 changes: 0 additions & 22 deletions src/Microsoft.ML.Api/TypedCursor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,16 +282,6 @@ private Action<TRow> GenerateSetter(IRow input, int index, InternalSchemaDefinit
Ch.Assert(colType.ItemType.IsText);
return CreateConvertingVBufferSetter<DvText, string>(input, index, poke, peek, x => x.ToString());
}
else if (fieldType.GetElementType() == typeof(bool))
{
Ch.Assert(colType.ItemType.IsBool);
return CreateConvertingVBufferSetter<DvBool, bool>(input, index, poke, peek, x => (bool)x);
}
else if (fieldType.GetElementType() == typeof(bool?))
{
Ch.Assert(colType.ItemType.IsBool);
return CreateConvertingVBufferSetter<DvBool, bool?>(input, index, poke, peek, x => (bool?)x);
}
else if (fieldType.GetElementType() == typeof(int))
{
Ch.Assert(colType.ItemType == NumberType.I4);
Expand Down Expand Up @@ -360,18 +350,6 @@ private Action<TRow> GenerateSetter(IRow input, int index, InternalSchemaDefinit
Ch.Assert(peek == null);
return CreateConvertingActionSetter<DvText, string>(input, index, poke, x => x.ToString());
}
else if (fieldType == typeof(bool))
{
Ch.Assert(colType.IsBool);
Ch.Assert(peek == null);
return CreateConvertingActionSetter<DvBool, bool>(input, index, poke, x => (bool)x);
}
else if (fieldType == typeof(bool?))
{
Ch.Assert(colType.IsBool);
Ch.Assert(peek == null);
return CreateConvertingActionSetter<DvBool, bool?>(input, index, poke, x => (bool?)x);
}
else if (fieldType == typeof(int))
{
Ch.Assert(colType == NumberType.I4);
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.ML.Core/Data/ColumnType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ public static BoolType Instance
}

private BoolType()
: base(typeof(DvBool), DataKind.BL)
: base(typeof(bool), DataKind.BL)
{
}

Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.ML.Core/Data/DataKind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public static Type ToType(this DataKind kind)
case DataKind.TX:
return typeof(DvText);
case DataKind.BL:
return typeof(DvBool);
return typeof(bool);
case DataKind.TS:
return typeof(DvTimeSpan);
case DataKind.DT:
Expand Down Expand Up @@ -207,7 +207,7 @@ public static bool TryGetDataKind(this Type type, out DataKind kind)
kind = DataKind.R8;
else if (type == typeof(DvText))
kind = DataKind.TX;
else if (type == typeof(DvBool) || type == typeof(bool) || type == typeof(bool?))
else if (type == typeof(bool))
kind = DataKind.BL;
else if (type == typeof(DvTimeSpan))
kind = DataKind.TS;
Expand Down
226 changes: 0 additions & 226 deletions src/Microsoft.ML.Core/Data/DvBool.cs

This file was deleted.

Loading