File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
hbase-common/src/main/java/org/apache/hadoop/hbase
hbase-shell/src/main/ruby/hbase Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -1602,6 +1602,11 @@ public enum OperationStatusCode {
16021602 "hbase.regionserver.slowlog.systable.enabled" ;
16031603 public static final boolean DEFAULT_SLOW_LOG_SYS_TABLE_ENABLED_KEY = false ;
16041604
1605+ public static final String SHELL_TIMESTAMP_FORMAT_EPOCH_KEY =
1606+ "hbase.shell.timestamp.format.epoch" ;
1607+
1608+ public static final boolean DEFAULT_SHELL_TIMESTAMP_FORMAT_EPOCH = false ;
1609+
16051610 /**
16061611 * Number of rows in a batch operation above which a warning will be logged.
16071612 */
Original file line number Diff line number Diff line change @@ -119,6 +119,9 @@ def initialize(table, shell)
119119 @name = @table . getName . getNameAsString
120120 @shell = shell
121121 @converters = { }
122+ @timestamp_format_epoch = table . getConfiguration . getBoolean (
123+ HConstants ::SHELL_TIMESTAMP_FORMAT_EPOCH_KEY ,
124+ HConstants ::DEFAULT_SHELL_TIMESTAMP_FORMAT_EPOCH )
122125 end
123126
124127 def close
@@ -751,8 +754,12 @@ def parse_column_name(column)
751754 end
752755
753756 def toLocalDateTime ( millis )
754- instant = java . time . Instant . ofEpochMilli ( millis )
755- return java . time . LocalDateTime . ofInstant ( instant , java . time . ZoneId . systemDefault ( ) ) . toString
757+ if @timestamp_format_epoch
758+ return millis
759+ else
760+ instant = java . time . Instant . ofEpochMilli ( millis )
761+ return java . time . LocalDateTime . ofInstant ( instant , java . time . ZoneId . systemDefault ( ) ) . toString
762+ end
756763 end
757764
758765 # Make a String of the passed kv
You can’t perform that action at this time.
0 commit comments