protected override Delegate GetGetterCore(IChannel ch, Row input, int iinfo, out Action disposer)
        {
            Host.AssertValueOrNull(ch);
            Host.AssertValue(input);
            Host.Assert(0 <= iinfo && iinfo < Infos.Length);

            var  type      = _types[iinfo];
            var  ex        = _exes[iinfo];
            bool needScale = ex.Offset != 0 || ex.Scale != 1;

            disposer = null;
            var sourceType = InputSchema.GetColumnType(Infos[iinfo].Source);

            if (sourceType.ItemType == NumberType.R4 || sourceType.ItemType == NumberType.R8)
            {
                return(GetterFromType <float>(input, iinfo, ex, needScale));
            }
            else
            if (sourceType.ItemType == NumberType.U1)
            {
                return(GetterFromType <byte>(input, iinfo, ex, false));
            }
            else
            {
                throw Contracts.Except("We only support float or byte arrays");
            }
        }
Ejemplo n.º 2
0
 public override RowMapperColumnInfo[] GetOutputColumns()
 => _parent.ColumnPairs.Select((x, idx) => new RowMapperColumnInfo(x.output, InputSchema.GetColumnType(ColMapNewToOld[idx]), null)).ToArray();