@@ -440,7 +440,6 @@ public static Statistics<?> getNewStatistics(
440440 IChunkMetadata chunkMetadata , TSDataType targetDataType , Statistics <?> statistics ) {
441441 switch (chunkMetadata .getDataType ()) {
442442 case INT32 :
443- case DATE :
444443 case INT64 :
445444 case TIMESTAMP :
446445 case FLOAT :
@@ -465,11 +464,9 @@ public static Statistics<?> getNewStatistics(
465464 new Binary (
466465 chunkMetadata .getStatistics ().getMaxValue ().toString (), StandardCharsets .UTF_8 );
467466 }
468- long [] longValues = new long [4 ];
467+ long [] longValues = new long [2 ];
469468 longValues [0 ] = chunkMetadata .getStatistics ().getStartTime ();
470469 longValues [1 ] = chunkMetadata .getStatistics ().getEndTime ();
471- longValues [2 ] = longValues [1 ];
472- longValues [3 ] = longValues [1 ];
473470 statistics .update (longValues , binaryValues , binaryValues .length );
474471 } else if (targetDataType == TSDataType .TEXT ) {
475472 Binary [] binaryValues = new Binary [2 ];
@@ -492,6 +489,51 @@ public static Statistics<?> getNewStatistics(
492489 statistics = chunkMetadata .getStatistics ();
493490 }
494491 break ;
492+ case DATE :
493+ if (targetDataType == TSDataType .STRING ) {
494+ Binary [] binaryValues = new Binary [4 ];
495+ binaryValues [0 ] =
496+ new Binary (
497+ TSDataType .getDateStringValue (
498+ (Integer ) chunkMetadata .getStatistics ().getFirstValue ()),
499+ StandardCharsets .UTF_8 );
500+ binaryValues [1 ] =
501+ new Binary (
502+ TSDataType .getDateStringValue (
503+ (Integer ) chunkMetadata .getStatistics ().getLastValue ()),
504+ StandardCharsets .UTF_8 );
505+ binaryValues [2 ] =
506+ new Binary (
507+ TSDataType .getDateStringValue (
508+ (Integer ) chunkMetadata .getStatistics ().getMinValue ()),
509+ StandardCharsets .UTF_8 );
510+ binaryValues [3 ] =
511+ new Binary (
512+ TSDataType .getDateStringValue (
513+ (Integer ) chunkMetadata .getStatistics ().getMaxValue ()),
514+ StandardCharsets .UTF_8 );
515+ long [] longValues = new long [2 ];
516+ longValues [0 ] = chunkMetadata .getStatistics ().getStartTime ();
517+ longValues [1 ] = chunkMetadata .getStatistics ().getEndTime ();
518+ statistics .update (longValues , binaryValues , binaryValues .length );
519+ } else if (targetDataType == TSDataType .TEXT ) {
520+ Binary [] binaryValues = new Binary [2 ];
521+ binaryValues [0 ] =
522+ new Binary (
523+ TSDataType .getDateStringValue (
524+ (Integer ) chunkMetadata .getStatistics ().getFirstValue ()),
525+ StandardCharsets .UTF_8 );
526+ binaryValues [1 ] =
527+ new Binary (
528+ TSDataType .getDateStringValue (
529+ (Integer ) chunkMetadata .getStatistics ().getLastValue ()),
530+ StandardCharsets .UTF_8 );
531+ long [] longValues = new long [2 ];
532+ longValues [0 ] = chunkMetadata .getStatistics ().getStartTime ();
533+ longValues [1 ] = chunkMetadata .getStatistics ().getEndTime ();
534+ statistics .update (longValues , binaryValues , binaryValues .length );
535+ }
536+ break ;
495537 case STRING :
496538 if (targetDataType == TSDataType .TEXT ) {
497539 Binary [] binaryValues = new Binary [2 ];
@@ -521,8 +563,8 @@ public static Statistics<?> getNewStatistics(
521563 case TEXT :
522564 if (targetDataType == TSDataType .STRING ) {
523565 Binary [] binaryValues = new Binary [2 ];
524- binaryValues [0 ] = EMPTY_BINARY ;
525- binaryValues [1 ] = EMPTY_BINARY ;
566+ binaryValues [0 ] = ( Binary ) chunkMetadata . getStatistics (). getFirstValue () ;
567+ binaryValues [1 ] = ( Binary ) chunkMetadata . getStatistics (). getLastValue () ;
526568 long [] longValues = new long [2 ];
527569 longValues [0 ] = chunkMetadata .getStatistics ().getStartTime ();
528570 longValues [1 ] = chunkMetadata .getStatistics ().getEndTime ();
0 commit comments