MCPcopy Create free account
hub / github.com/apache/iotdb-client-go / getObjectByTsBlockIndex

Method getObjectByTsBlockIndex

client/rpcdataset.go:512–558  ·  view source on GitHub ↗
(tsBlockColumnIndex int32)

Source from the content-addressed store, hash-verified

510}
511
512func (s *IoTDBRpcDataSet) getObjectByTsBlockIndex(tsBlockColumnIndex int32) (interface{}, error) {
513 if err := s.checkRecord(); err != nil {
514 return nil, err
515 }
516 if s.isNull(tsBlockColumnIndex, s.tsBlockIndex) {
517 s.lastReadWasNull = true
518 return nil, nil
519 }
520 s.lastReadWasNull = false
521 dataType := s.getDataTypeByTsBlockColumnIndex(tsBlockColumnIndex)
522 switch dataType {
523 case BOOLEAN, INT32, INT64, FLOAT, DOUBLE:
524 return s.curTsBlock.GetColumn(tsBlockColumnIndex).GetObject(s.tsBlockIndex)
525 case TIMESTAMP:
526 var timestamp int64
527 var err error
528 if tsBlockColumnIndex == -1 {
529 timestamp, err = s.curTsBlock.GetTimeByIndex(s.tsBlockIndex)
530 } else {
531 timestamp, err = s.curTsBlock.GetColumn(tsBlockColumnIndex).GetLong(s.tsBlockIndex)
532 }
533 if err != nil {
534 return nil, err
535 }
536 return convertToTimestamp(timestamp, s.timeFactor), nil
537 case TEXT, STRING:
538 if binary, err := s.curTsBlock.GetColumn(tsBlockColumnIndex).GetBinary(s.tsBlockIndex); err != nil {
539 return nil, err
540 } else {
541 return binary.GetStringValue(), nil
542 }
543 case BLOB:
544 if binary, err := s.curTsBlock.GetColumn(tsBlockColumnIndex).GetBinary(s.tsBlockIndex); err != nil {
545 return nil, err
546 } else {
547 return binary.GetValues(), nil
548 }
549 case DATE:
550 if value, err := s.curTsBlock.GetColumn(tsBlockColumnIndex).GetInt(s.tsBlockIndex); err != nil {
551 return nil, err
552 } else {
553 return Int32ToDate(value)
554 }
555 default:
556 return nil, nil
557 }
558}
559
560func (s *IoTDBRpcDataSet) getStringByIndex(columnIndex int32) (string, error) {
561 columnIndex, err := s.getTsBlockColumnIndexForColumnIndex(columnIndex)

Callers 2

getObjectByIndexMethod · 0.95
getObjectMethod · 0.95

Calls 13

checkRecordMethod · 0.95
isNullMethod · 0.95
convertToTimestampFunction · 0.85
Int32ToDateFunction · 0.85
GetColumnMethod · 0.80
GetTimeByIndexMethod · 0.80
GetStringValueMethod · 0.80
GetObjectMethod · 0.65
GetLongMethod · 0.65
GetBinaryMethod · 0.65
GetIntMethod · 0.65

Tested by

no test coverage detected