예제 #1
0
        internal static void GetColumnTypeShape(DataViewType type,
                                                out Column.VectorKind vecKind,
                                                out DataViewType itemType,
                                                out bool isKey)
        {
            if (type is VectorType vectorType)
            {
                if (vectorType.IsKnownSize)
                {
                    vecKind = Column.VectorKind.Vector;
                }
                else
                {
                    vecKind = Column.VectorKind.VariableVector;
                }

                itemType = vectorType.ItemType;
            }
            else
            {
                vecKind  = Column.VectorKind.Scalar;
                itemType = type;
            }

            isKey = itemType is KeyType;
            if (isKey)
            {
                itemType = ColumnTypeExtensions.PrimitiveTypeFromType(itemType.RawType);
            }
        }
            protected override DataViewSchema.DetachedColumn[] GetOutputColumnsCore()
            {
                var columns = new List <DataViewSchema.DetachedColumn>();

                foreach (DateTimeEstimator.ColumnsProduced column in Enum.GetValues(typeof(DateTimeEstimator.ColumnsProduced)))
                {
                    columns.Add(new DataViewSchema.DetachedColumn(_parent._column.Prefix + column.ToString(),
                                                                  ColumnTypeExtensions.PrimitiveTypeFromType(column.GetRawColumnType())));
                }

                return(columns.ToArray());
            }
        public SchemaShape GetOutputSchema(SchemaShape inputSchema)
        {
            var columns = inputSchema.ToDictionary(x => x.Name);

            foreach (ColumnsProduced column in Enum.GetValues(typeof(ColumnsProduced)))
            {
                columns[_options.Prefix + column.ToString()] = new SchemaShape.Column(_options.Prefix + column.ToString(), SchemaShape.Column.VectorKind.Scalar,
                                                                                      ColumnTypeExtensions.PrimitiveTypeFromType(column.GetRawColumnType()), false, null);
            }

            return(new SchemaShape(columns.Values));
        }
예제 #4
0
 protected override DataViewSchema.DetachedColumn[] GetOutputColumnsCore()
 {
     return(_parent._columns.Select(x => new DataViewSchema.DetachedColumn(x.Name, ColumnTypeExtensions.PrimitiveTypeFromType(x.Type))).ToArray());
 }