func (t *TableMeta) GetPartitionInfo() *PartitionInfo {
	return nil
}
GetPartitionInfo returns the partition information.
package model
import (
	"encoding/json"
	"github.com/pingcap/parser/ast"
	parser_model "github.com/pingcap/parser/model"
	"github.com/pingcap/parser/mysql"
	"github.com/pingcap/parser/types"
	"github.com/pingcap/pd/v4/server/schedule/placement"
	tspb "github.com/zhihu/zetta-proto/pkg/tablestore"
	"github.com/zhihu/zetta/tablestore/rpc"
)
const (
	AttrKeyMode   = "mode"
	AttrKeyLayout = "layout"
	AttrFlexible = "flexible"
	AttrFixed    = "fixed"
	AttrCompact  = "compact"
	AttrSparse   = "sparse"
)
type TableMeta struct {
	Id int64 `json:"id"`
	tspb.TableMeta
	parser_model.TableInfo
	MaxColumnFamilyID int64               `json:"max_cf_id`
	Columns           []*ColumnMeta       `json:"columns"`
	ColumnFamilies    []*ColumnFamilyMeta `json:"columnfamilies"`
	Indices           []*IndexMeta        `json:"indices"`
	Rules             []*placement.Rule   `json:"rules"`
}
func NewTableMetaFromPb(tm *tspb.TableMeta) *TableMeta {
	ntm := &TableMeta{
		TableMeta: *tm,
		TableInfo: parser_model.TableInfo{
			Name: parser_model.NewCIStr(tm.TableName),
		},
	}
	ntm.transferColumns()
	ntm.transferColumnFamilies()
	return ntm
}
func NewTableMetaFromPbReq(tmr *tspb.CreateTableRequest) *TableMeta {
	tm := NewTableMetaFromPb(tmr.GetTableMeta())
	indices := tmr.GetIndexes()
	tm.addIndices(indices)
	return tm
}
func (tm *TableMeta) GetColumnIDMap() map[string]int {
	res := make(map[string]int, len(tm.Columns))
	for i, col := range tm.Columns {
		res[col.Name] = i
	}
	return res
}
func (tm *TableMeta) ToTableInfo() *parser_model.TableInfo {
	return &tm.TableInfo
}
func (tm *TableMeta) GetIndexes() []*IndexMeta {
	return tm.Indices
}
func (tm *TableMeta) addIndices(indices []*tspb.IndexMeta) {
	nindices := make([]*IndexMeta, 0)
	for _, i := range indices {
		nindices = append(nindices, NewIndexMetaFromPb(i))
	}
	tm.Indices = nindices
}
func (tm *TableMeta) GetPrimaryFieldTypes() []*types.FieldType {
	res := make([]*types.FieldType, 0)
	for _, p := range tm.TableMeta.GetPrimaryKey() {
		for _, c := range tm.Columns {
			if p == c.ColumnMeta.Name {
				res = append(res, &c.FieldType)
			}
		}
	}
	return res
}
func (tm *TableMeta) GetColumnMap() (map[string]*ColumnMeta, map[int64]*ColumnMeta) {
	resName := make(map[string]*ColumnMeta)
	resId := make(map[int64]*ColumnMeta)
	for _, c := range tm.Columns {
		resName[c.ColumnMeta.Name] = c
		resId[c.Id] = c
	}
	return resName, resId
}
func (tm *TableMeta) transferColumns() {
	clms := make([]*ColumnMeta, 0)
	for _, c := range tm.TableMeta.Columns {
		clms = append(clms, NewColumnMetaFromPb(c))
	}
	tm.Columns = clms
}
func (tm *TableMeta) transferColumnFamilies() {
	cfs := make([]*ColumnFamilyMeta, 0)
	for _, cf := range tm.TableMeta.ColumnFamilies {
		ncf := &ColumnFamilyMeta{
			ColumnFamilyMeta: *cf,
		}
		cfs = append(cfs, ncf)
	}
	tm.ColumnFamilies = cfs
}
func (tm *TableMeta) FindColumnByName(name string) *ColumnMeta {
	for _, col := range tm.Columns {
		if col.ColumnMeta.Name == name {
			return col
		}
	}
	return nil
}
func (tm *TableMeta) FindIndexByName(name string) *IndexMeta {
	for _, idx := range tm.Indices {
		if idx.Name == name {
			return idx
		}
	}
	return nil
}
func (tm *TableMeta) GetIndexByColumnName(name string) (int, *IndexMeta) {
	for _, idx := range tm.Indices {
		for i, col := range idx.DefinedColumns {
			if col == name {
				return i, idx
			}
		}
	}
	for i, col := range tm.PrimaryKey {
		if col == name {
			return i, nil
		}
	}
	return -1, nil
}
type PartitionInfoZ struct{}