Exemplo n.º 1
0
 protected override void GetMetadataCore <TValue>(string kind, int col, ref TValue value)
 {
     Ectx.Assert(0 <= col && col < ColumnCount);
     if (kind == OpType)
     {
         _opTypeGetters[col].Marshal(col, ref value);
     }
     else if (kind == InputOps && _inputOpsGetters[col] != null)
     {
         _inputOpsGetters[col].Marshal(col, ref value);
     }
     else
     {
         throw Ectx.ExceptGetMetadata();
     }
 }
Exemplo n.º 2
0
 public SimpleSchema(IExceptionContext ectx, KeyValuePair <string, ColumnType>[] columns,
                     Dictionary <string, MetadataUtils.MetadataGetter <VBuffer <ReadOnlyMemory <char> > > > keyValues)
     : this(ectx, columns)
 {
     foreach (var kvp in keyValues)
     {
         var name   = kvp.Key;
         var getter = kvp.Value;
         if (!ColumnNameMap.TryGetValue(name, out int col))
         {
             throw Ectx.ExceptParam(nameof(keyValues), $"Output schema does not contain column '{name}'");
         }
         if (!Types[col].ItemType.IsKey)
         {
             throw Ectx.ExceptParam(nameof(keyValues), $"Column '{name}' is not a key column, so it cannot have key value metadata");
         }
         _keyValueGetters[col] = getter;
     }
 }