(tsBlockColumnIndex int32)
| 510 | } |
| 511 | |
| 512 | func (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 | |
| 560 | func (s *IoTDBRpcDataSet) getStringByIndex(columnIndex int32) (string, error) { |
| 561 | columnIndex, err := s.getTsBlockColumnIndexForColumnIndex(columnIndex) |
no test coverage detected