Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1602,6 +1602,11 @@ public enum OperationStatusCode {
"hbase.regionserver.slowlog.systable.enabled";
public static final boolean DEFAULT_SLOW_LOG_SYS_TABLE_ENABLED_KEY = false;

public static final String SHELL_TIMESTAMP_FORMAT_EPOCH_KEY =
"hbase.shell.timestamp.format.epoch";

public static final boolean DEFAULT_SHELL_TIMESTAMP_FORMAT_EPOCH = false;

/**
* Number of rows in a batch operation above which a warning will be logged.
*/
Expand Down
11 changes: 9 additions & 2 deletions hbase-shell/src/main/ruby/hbase/table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ def initialize(table, shell)
@name = @table.getName.getNameAsString
@shell = shell
@converters = {}
@timestamp_format_epoch = table.getConfiguration.getBoolean(
HConstants::SHELL_TIMESTAMP_FORMAT_EPOCH_KEY,
HConstants::DEFAULT_SHELL_TIMESTAMP_FORMAT_EPOCH)
end

def close
Expand Down Expand Up @@ -751,8 +754,12 @@ def parse_column_name(column)
end

def toLocalDateTime(millis)
instant = java.time.Instant.ofEpochMilli(millis)
return java.time.LocalDateTime.ofInstant(instant, java.time.ZoneId.systemDefault()).toString
if @timestamp_format_epoch
return millis
else
instant = java.time.Instant.ofEpochMilli(millis)
return java.time.LocalDateTime.ofInstant(instant, java.time.ZoneId.systemDefault()).toString
end
end

# Make a String of the passed kv
Expand Down