示例#1
0
        public void GetMetadata <TValue>(string kind, int col, ref TValue value)
        {
            _env.Check(0 <= col && col < ColumnCount);
            var inputCol  = _shape[col];
            var metaShape = inputCol.Metadata;

            if (metaShape == null || !metaShape.TryFindColumn(kind, out var metaColumn))
            {
                throw _env.ExceptGetMetadata();
            }

            var colType = MakeColumnType(metaColumn);

            _env.Check(colType.RawType.Equals(typeof(TValue)));

            if (colType.IsVector)
            {
                // This as an atypical use of VBuffer: we create it in GetMetadataVec, and then pass through
                // via boxing to be returned out of this method. This is intentional.
                value = (TValue)Utils.MarshalInvoke(GetMetadataVec <int>, colType.ItemType.RawType);
            }
            else
            {
                value = default;
            }
        }