tableschema

package
v0.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2024 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TypeToArrowType

func TypeToArrowType(odpsType datatype.DataType) (arrow.DataType, error)

TypeToArrowType convert odps field type to arrow field type * Storage Type | Arrow Type * ----------------------+--------------------- * boolean | boolean * tinyint | int8 * smallint | int16 * int | int32 * bigint | int64 * float | float32 * double | float64 * char | utf8 * varchar | utf8 * string | utf8 * binary | binary * date | date32 * datetime | timestamp(nano) * timestamp | timestamp(nano) 【注:精度选择功能开发中】 * interval_day_time | day_time_interval * interval_year_month | month_interval * decimal | decimal * struct | struct * array | list * map | map

Types

type ClusterInfo

type ClusterInfo struct {
	ClusterType string
	ClusterInfo []string
	SortCols    []SortColumn
}

ClusterInfo 聚簇信息

type Column

type Column struct {
	Name            string
	Type            datatype2.DataType
	Comment         string
	Label           string
	IsNullable      bool
	HasDefaultValue bool
	DefaultValue    string
	ExtendedLabels  []string
}

func (*Column) UnmarshalJSON

func (c *Column) UnmarshalJSON(data []byte) error

type SchemaBuilder

type SchemaBuilder struct {
	// contains filtered or unexported fields
}

func NewSchemaBuilder

func NewSchemaBuilder() SchemaBuilder

func (*SchemaBuilder) Build

func (builder *SchemaBuilder) Build() TableSchema

func (*SchemaBuilder) Column

func (builder *SchemaBuilder) Column(column Column) *SchemaBuilder

func (*SchemaBuilder) Columns

func (builder *SchemaBuilder) Columns(columns ...Column) *SchemaBuilder

func (*SchemaBuilder) Comment

func (builder *SchemaBuilder) Comment(comment string) *SchemaBuilder

func (*SchemaBuilder) Lifecycle

func (builder *SchemaBuilder) Lifecycle(lifecycle int) *SchemaBuilder

Lifecycle 表的生命周期,仅支持正整数。单位:天

func (*SchemaBuilder) Location

func (builder *SchemaBuilder) Location(location string) *SchemaBuilder

func (*SchemaBuilder) Name

func (builder *SchemaBuilder) Name(name string) *SchemaBuilder

func (*SchemaBuilder) PartitionColumn

func (builder *SchemaBuilder) PartitionColumn(column Column) *SchemaBuilder

func (*SchemaBuilder) PartitionColumns

func (builder *SchemaBuilder) PartitionColumns(columns ...Column) *SchemaBuilder

func (*SchemaBuilder) StorageHandler

func (builder *SchemaBuilder) StorageHandler(storageHandler string) *SchemaBuilder

type SortColumn

type SortColumn struct {
	// contains filtered or unexported fields
}

type TableSchema

type TableSchema struct {
	TableName          string
	Columns            []Column
	Comment            string
	CreateTime         common.GMTTime
	ExtendedLabel      []string
	HubLifecycle       int
	IsExternal         bool
	IsMaterializedView bool
	IsVirtualView      bool
	LastDDLTime        common.GMTTime
	LastModifiedTime   common.GMTTime
	Lifecycle          int
	Owner              string
	PartitionColumns   []Column `json:"PartitionKeys"`
	RecordNum          int
	ShardExist         bool
	ShardInfo          string
	Size               int
	TableLabel         string
	ViewText           string

	// extended schema, got by adding "?extended" to table api
	FileNum      int
	IsArchived   bool
	PhysicalSize int
	Reserved     string // reserved json string, 字段不固定

	// for external table extended info
	StorageHandler string
	Location       string

	// for clustered info
	ClusterInfo ClusterInfo
	// contains filtered or unexported fields
}

func (*TableSchema) FieldByName

func (schema *TableSchema) FieldByName(name string) (Column, bool)

func (*TableSchema) ToArrowSchema

func (schema *TableSchema) ToArrowSchema() *arrow.Schema

func (*TableSchema) ToBaseSQLString

func (schema *TableSchema) ToBaseSQLString(projectName string, createIfNotExists, isExternal bool) (string, error)

func (*TableSchema) ToExternalSQLString

func (schema *TableSchema) ToExternalSQLString(
	projectName string,
	createIfNotExists bool,
	serdeProperties map[string]string,
	jars []string) (string, error)

func (*TableSchema) ToSQLString

func (schema *TableSchema) ToSQLString(projectName string, createIfNotExists bool) (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL