Skip to content

enabled developer naming their column same as valid v… #344

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

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 3 additions & 3 deletions src/Microsoft.ML/Data/TextLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public TextLoaderRange(int min, int max)
{

Contracts.CheckParam(min >= 0, nameof(min), "Cannot be a negative number.");
Contracts.CheckParam(max >= min, nameof(max), "Cannot be less than " + nameof(min) +".");
Contracts.CheckParam(max >= min, nameof(max), "Cannot be less than " + nameof(min) + ".");

Min = min;
Max = max;
Expand Down Expand Up @@ -84,8 +84,8 @@ public TextLoader CreateFrom<TInput>(bool useHeader = false,
$"Valid characters are 0-9, *, - and ~");

var name = mappingAttr.Name ?? field.Name;
if (name.Any(c => !Char.IsLetterOrDigit(c)))
throw Contracts.Except($"{name} is not alphanumeric.");
if (Regex.Match(name, @"^[a-zA-Z_@]\w*$").Success)
throw Contracts.Except($"{name} contains invalid characters as a column name. ");

Runtime.Data.TextLoader.Range[] sources;
if (!Runtime.Data.TextLoader.Column.TryParseSourceEx(mappingAttr.Ordinal, out sources))
Expand Down