Skip to content

Updating the DatabaseLoader to not force vector for single element columns #4403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,10 @@ public Range(int min, int max)
internal static Range FromTextLoaderRange(TextLoader.Range range)
{
Contracts.Assert(range.Max.HasValue);
return new Range(range.Min, range.Max.Value);

var dbRange = new Range(range.Min, range.Max.Value);
dbRange.ForceVector = range.ForceVector;
return dbRange;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ private int GetColumnIndex(ColInfo colInfo)

if (seg.Name is null)
{
Contracts.Check(seg.Min == seg.Lim);
Contracts.Check(seg.Lim == (seg.Min + 1));
return seg.Min;
}
else
Expand Down
2 changes: 2 additions & 0 deletions test/Microsoft.ML.Tests/DatabaseLoaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ public class IrisDataWithLoadColumnName

public class IrisVectorData
{
[LoadColumn(0)]
public int Label;

[LoadColumn(1, 2)]
Expand All @@ -312,6 +313,7 @@ public class IrisVectorData

public class IrisVectorDataWithLoadColumnName
{
[LoadColumnName("Label")]
public int Label;

[LoadColumnName("SepalLength", "SepalWidth")]
Expand Down