Skip to content

Commit 96b2995

Browse files
committed
Remove another ISchema because it's only used in Tensorflow
1 parent e72f3f8 commit 96b2995

File tree

1 file changed

+0
-74
lines changed

1 file changed

+0
-74
lines changed

src/Microsoft.ML.Data/DataView/SimpleRow.cs

-74
Original file line numberDiff line numberDiff line change
@@ -69,80 +69,6 @@ public override bool IsColumnActive(int col)
6969
}
7070
}
7171

72-
/// <summary>
73-
/// An <see cref="ISchema"/> that takes all column names and types as constructor parameters.
74-
/// The columns do not have metadata.
75-
/// </summary>
76-
public abstract class SimpleSchemaBase : ISchema
77-
{
78-
protected readonly IExceptionContext Ectx;
79-
private readonly string[] _names;
80-
protected readonly ColumnType[] Types;
81-
protected readonly Dictionary<string, int> ColumnNameMap;
82-
83-
public int ColumnCount => Types.Length;
84-
85-
protected SimpleSchemaBase(IExceptionContext ectx, params KeyValuePair<string, ColumnType>[] columns)
86-
{
87-
Contracts.CheckValueOrNull(ectx);
88-
Ectx = ectx;
89-
Ectx.CheckValue(columns, nameof(columns));
90-
91-
_names = new string[columns.Length];
92-
Types = new ColumnType[columns.Length];
93-
ColumnNameMap = new Dictionary<string, int>();
94-
for (int i = 0; i < columns.Length; i++)
95-
{
96-
_names[i] = columns[i].Key;
97-
Types[i] = columns[i].Value;
98-
if (ColumnNameMap.ContainsKey(columns[i].Key))
99-
throw ectx.ExceptParam(nameof(columns), $"Duplicate column name: '{columns[i].Key}'");
100-
ColumnNameMap[columns[i].Key] = i;
101-
}
102-
}
103-
104-
public bool TryGetColumnIndex(string name, out int col)
105-
{
106-
return ColumnNameMap.TryGetValue(name, out col);
107-
}
108-
109-
public string GetColumnName(int col)
110-
{
111-
Ectx.CheckParam(0 <= col && col < ColumnCount, nameof(col));
112-
return _names[col];
113-
}
114-
115-
public ColumnType GetColumnType(int col)
116-
{
117-
Ectx.CheckParam(0 <= col && col < ColumnCount, nameof(col));
118-
return Types[col];
119-
}
120-
121-
public IEnumerable<KeyValuePair<string, ColumnType>> GetMetadataTypes(int col)
122-
{
123-
Ectx.Assert(0 <= col && col < ColumnCount);
124-
return GetMetadataTypesCore(col);
125-
}
126-
127-
protected abstract IEnumerable<KeyValuePair<string, ColumnType>> GetMetadataTypesCore(int col);
128-
129-
public ColumnType GetMetadataTypeOrNull(string kind, int col)
130-
{
131-
Ectx.CheckParam(0 <= col && col < ColumnCount, nameof(col));
132-
return GetMetadataTypeOrNullCore(kind, col);
133-
}
134-
135-
protected abstract ColumnType GetMetadataTypeOrNullCore(string kind, int col);
136-
137-
public void GetMetadata<TValue>(string kind, int col, ref TValue value)
138-
{
139-
Ectx.CheckParam(0 <= col && col < ColumnCount, nameof(col));
140-
GetMetadataCore(kind, col, ref value);
141-
}
142-
143-
protected abstract void GetMetadataCore<TValue>(string kind, int col, ref TValue value);
144-
}
145-
14672
public static class SimpleSchemaUtils
14773
{
14874
public static Schema Create(IExceptionContext ectx, params KeyValuePair<string, ColumnType>[] columns)

0 commit comments

Comments
 (0)