@@ -386,6 +386,7 @@ func (s *IoTDBRpcDataSet) getLong(columnName string) (int64, error) {
386
386
return 0 , err
387
387
}
388
388
if columnName == TimestampColumnName {
389
+ s .lastReadWasNull = false
389
390
return s .curTsBlock .GetTimeByIndex (s .tsBlockIndex )
390
391
}
391
392
index := s .columnOrdinalMap [columnName ] - startIndex
@@ -433,6 +434,7 @@ func (s *IoTDBRpcDataSet) getObject(columnName string) (interface{}, error) {
433
434
return nil , err
434
435
}
435
436
if columnName == TimestampColumnName {
437
+ s .lastReadWasNull = false
436
438
if value , err := s .curTsBlock .GetTimeByIndex (s .tsBlockIndex ); err != nil {
437
439
return nil , err
438
440
} else {
@@ -465,21 +467,14 @@ func (s *IoTDBRpcDataSet) getTimestampByIndex(columnIndex int32) (time.Time, err
465
467
}
466
468
467
469
func (s * IoTDBRpcDataSet ) getTimestamp (columnName string ) (time.Time , error ) {
468
- err := s .checkRecord ( )
470
+ longValue , err := s .getLong ( columnName )
469
471
if err != nil {
470
472
return time.Time {}, err
471
473
}
472
- index := s .columnOrdinalMap [columnName ] - startIndex
473
- if ! s .isNull (index , s .tsBlockIndex ) {
474
- s .lastReadWasNull = false
475
- if longValue , err := s .curTsBlock .GetColumn (index ).GetLong (s .tsBlockIndex ); err != nil {
476
- return time.Time {}, err
477
- } else {
478
- return time .Unix (longValue / 1e3 , (longValue % 1e3 )* 1e6 ), nil
479
- }
474
+ if s .lastReadWasNull {
475
+ return time.Time {}, err
480
476
} else {
481
- s .lastReadWasNull = true
482
- return time.Time {}, nil
477
+ return time .Unix (longValue / 1e3 , (longValue % 1e3 )* 1e6 ), nil
483
478
}
484
479
}
485
480
@@ -492,21 +487,14 @@ func (s *IoTDBRpcDataSet) GetDateByIndex(columnIndex int32) (time.Time, error) {
492
487
}
493
488
494
489
func (s * IoTDBRpcDataSet ) GetDate (columnName string ) (time.Time , error ) {
495
- err := s .checkRecord ( )
490
+ intValue , err := s .getInt ( columnName )
496
491
if err != nil {
497
492
return time.Time {}, err
498
493
}
499
- index := s .columnOrdinalMap [columnName ] - startIndex
500
- if ! s .isNull (index , s .tsBlockIndex ) {
501
- s .lastReadWasNull = false
502
- if value , err := s .curTsBlock .GetColumn (index ).GetInt (s .tsBlockIndex ); err != nil {
503
- return time.Time {}, err
504
- } else {
505
- return Int32ToDate (value )
506
- }
494
+ if s .lastReadWasNull {
495
+ return time.Time {}, err
507
496
} else {
508
- s .lastReadWasNull = true
509
- return time.Time {}, nil
497
+ return Int32ToDate (intValue )
510
498
}
511
499
}
512
500
@@ -520,6 +508,7 @@ func (s *IoTDBRpcDataSet) getValueByName(columnName string) (string, error) {
520
508
return "" , err
521
509
}
522
510
if columnName == TimestampColumnName {
511
+ s .lastReadWasNull = false
523
512
if t , err := s .curTsBlock .GetTimeByIndex (s .tsBlockIndex ); err != nil {
524
513
return "" , err
525
514
} else {
0 commit comments