當前位置: 首頁>>代碼示例>>Golang>>正文


Golang proto.ColumnEncoding類代碼示例

本文整理匯總了Golang中code/simon-critchley/co/uk/orc/proto.ColumnEncoding的典型用法代碼示例。如果您正苦於以下問題:Golang ColumnEncoding類的具體用法?Golang ColumnEncoding怎麽用?Golang ColumnEncoding使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ColumnEncoding類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: NewStringTreeReader

// NewStringTreeReader returns a StringTreeReader implementation along with any error that occurs.s
func NewStringTreeReader(present, data, length, dictionary io.Reader, encoding *proto.ColumnEncoding) (StringTreeReader, error) {
	switch kind := encoding.GetKind(); kind {
	case proto.ColumnEncoding_DIRECT, proto.ColumnEncoding_DIRECT_V2:
		return NewStringDirectTreeReader(present, data, length, kind)
	case proto.ColumnEncoding_DICTIONARY, proto.ColumnEncoding_DICTIONARY_V2:
		return NewStringDictionaryTreeReader(present, data, length, dictionary, encoding)
	}
	return nil, fmt.Errorf("unsupported column encoding: %s", encoding.GetKind())
}
開發者ID:scritchley,項目名稱:orc,代碼行數:10,代碼來源:treereader.go

示例2: NewIntegerTreeReader

// NewIntegerTreeReader returns a new IntegerReader or an error if one occurs.
func NewIntegerTreeReader(present, data io.Reader, encoding *proto.ColumnEncoding) (*IntegerTreeReader, error) {
	ireader, err := createIntegerReader(encoding.GetKind(), data, true, false)
	if err != nil {
		return nil, err
	}
	return &IntegerTreeReader{
		NewBaseTreeReader(present),
		ireader,
	}, nil
}
開發者ID:scritchley,項目名稱:orc,代碼行數:11,代碼來源:treereader.go

示例3: NewBinaryTreeReader

func NewBinaryTreeReader(present, data, length io.Reader, encoding *proto.ColumnEncoding) (*BinaryTreeReader, error) {
	lengthReader, err := createIntegerReader(encoding.GetKind(), length, false, false)
	if err != nil {
		return nil, err
	}
	return &BinaryTreeReader{
		BaseTreeReader: NewBaseTreeReader(present),
		length:         lengthReader,
		data:           data,
	}, nil
}
開發者ID:scritchley,項目名稱:orc,代碼行數:11,代碼來源:treereader.go

示例4: NewListTreeReader

func NewListTreeReader(present, length io.Reader, value TreeReader, encoding *proto.ColumnEncoding) (*ListTreeReader, error) {
	lengthReader, err := createIntegerReader(encoding.GetKind(), length, false, false)
	if err != nil {
		return nil, err
	}
	return &ListTreeReader{
		BaseTreeReader: NewBaseTreeReader(present),
		length:         lengthReader,
		value:          value,
	}, nil
}
開發者ID:scritchley,項目名稱:orc,代碼行數:11,代碼來源:treereader.go

示例5: NewDecimalTreeReader

// NewDecimalTreeReader returns a new instances of a DecimalTreeReader or an error if one occurs.
func NewDecimalTreeReader(present, data, secondary io.Reader, encoding *proto.ColumnEncoding, precision, scale int) (*DecimalTreeReader, error) {
	ireader, err := createIntegerReader(encoding.GetKind(), secondary, true, false)
	if err != nil {
		return nil, err
	}
	return &DecimalTreeReader{
		BaseTreeReader: NewBaseTreeReader(present),
		data:           bufio.NewReader(data),
		secondary:      ireader,
		precision:      precision,
		scale:          scale,
	}, nil
}
開發者ID:scritchley,項目名稱:orc,代碼行數:14,代碼來源:treereader.go

示例6: NewTimestampTreeReader

// NewTimestampTreeReader returns a new TimestampTreeReader along with any error that occurs.
func NewTimestampTreeReader(present, data, secondary io.Reader, encoding *proto.ColumnEncoding) (*TimestampTreeReader, error) {
	dataReader, err := createIntegerReader(encoding.GetKind(), data, true, false)
	if err != nil {
		return nil, err
	}
	secondaryReader, err := createIntegerReader(encoding.GetKind(), secondary, true, false)
	if err != nil {
		return nil, err
	}
	return &TimestampTreeReader{
		BaseTreeReader: NewBaseTreeReader(present),
		data:           dataReader,
		secondary:      secondaryReader,
	}, nil
}
開發者ID:scritchley,項目名稱:orc,代碼行數:16,代碼來源:treereader.go

示例7: readDictionaryLength

func (s *StringDictionaryTreeReader) readDictionaryLength(length io.Reader, encoding *proto.ColumnEncoding) error {
	lreader, err := createIntegerReader(encoding.GetKind(), length, false, false)
	if err != nil {
		return err
	}
	var offset int
	for lreader.Next() {
		l := int(lreader.Int())
		s.dictionaryLength = append(s.dictionaryLength, l)
		s.dictionaryOffsets = append(s.dictionaryOffsets, offset)
		offset += l
	}
	if err := lreader.Err(); err != nil && err != io.EOF {
		return err
	}
	return nil
}
開發者ID:scritchley,項目名稱:orc,代碼行數:17,代碼來源:treereader.go

示例8: NewStringDictionaryTreeReader

func NewStringDictionaryTreeReader(present, data, length, dictionary io.Reader, encoding *proto.ColumnEncoding) (*StringDictionaryTreeReader, error) {
	ireader, err := createIntegerReader(encoding.GetKind(), data, false, false)
	if err != nil {
		return nil, err
	}
	r := &StringDictionaryTreeReader{
		BaseTreeReader: NewBaseTreeReader(present),
		reader:         ireader,
	}
	if dictionary != nil && encoding != nil {
		err := r.readDictionaryStream(dictionary)
		if err != nil {
			return nil, err
		}
		if length != nil {
			err = r.readDictionaryLength(length, encoding)
			if err != nil {
				return nil, err
			}
		}
	}
	return r, nil
}
開發者ID:scritchley,項目名稱:orc,代碼行數:23,代碼來源:treereader.go


注:本文中的code/simon-critchley/co/uk/orc/proto.ColumnEncoding類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。