This is an automated email from the ASF dual-hosted git repository.

pankajkumar pushed a commit to branch branch-2.3
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.3 by this push:
     new d2e0e4d  HBASE-24937 table.rb use LocalDateTime to replace Instant 
(#2351)
d2e0e4d is described below

commit d2e0e4dc44afff193be3a4ab29f9ed88d4147b9e
Author: Bo Cui <[email protected]>
AuthorDate: Fri Sep 4 22:50:39 2020 +0800

    HBASE-24937 table.rb use LocalDateTime to replace Instant (#2351)
    
    Signed-off-by: Pankaj Kumar<[email protected]>
    (cherry picked from commit 1e8db480b349d6e90e6e2419455cad9e5eff7f35)
---
 hbase-shell/src/main/ruby/hbase/table.rb | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/hbase-shell/src/main/ruby/hbase/table.rb 
b/hbase-shell/src/main/ruby/hbase/table.rb
index 3d489db..b7f302e 100644
--- a/hbase-shell/src/main/ruby/hbase/table.rb
+++ b/hbase-shell/src/main/ruby/hbase/table.rb
@@ -736,8 +736,9 @@ EOF
       [split[0], split.length > 1 ? split[1] : nil]
     end
 
-    def toISO8601(millis)
-      return java.time.Instant.ofEpochMilli(millis).toString
+    def toLocalDateTime(millis)
+      instant = java.time.Instant.ofEpochMilli(millis)
+      return java.time.LocalDateTime.ofInstant(instant, 
java.time.ZoneId.systemDefault()).toString
     end
 
     # Make a String of the passed kv
@@ -748,7 +749,7 @@ EOF
             column.start_with?('info:merge')
           hri = 
org.apache.hadoop.hbase.HRegionInfo.parseFromOrNull(kv.getValueArray,
             kv.getValueOffset, kv.getValueLength)
-          return format('timestamp=%s, value=%s', toISO8601(kv.getTimestamp),
+          return format('timestamp=%s, value=%s', 
toLocalDateTime(kv.getTimestamp),
             hri.nil? ? '' : hri.toString)
         end
         if column == 'info:serverstartcode'
@@ -759,14 +760,14 @@ EOF
             str_val = 
org.apache.hadoop.hbase.util.Bytes.toStringBinary(kv.getValueArray,
                                                                         
kv.getValueOffset, kv.getValueLength)
           end
-          return format('timestamp=%s, value=%s', toISO8601(kv.getTimestamp), 
str_val)
+          return format('timestamp=%s, value=%s', 
toLocalDateTime(kv.getTimestamp), str_val)
         end
       end
 
       if org.apache.hadoop.hbase.CellUtil.isDelete(kv)
-        val = "timestamp=#{toISO8601(kv.getTimestamp)}, 
type=#{org.apache.hadoop.hbase.KeyValue::Type.codeToType(kv.getTypeByte)}"
+        val = "timestamp=#{toLocalDateTime(kv.getTimestamp)}, 
type=#{org.apache.hadoop.hbase.KeyValue::Type.codeToType(kv.getTypeByte)}"
       else
-        val = "timestamp=#{toISO8601(kv.getTimestamp)}, 
value=#{convert(column, kv, converter_class, converter)}"
+        val = "timestamp=#{toLocalDateTime(kv.getTimestamp)}, 
value=#{convert(column, kv, converter_class, converter)}"
       end
       maxlength != -1 ? val[0, maxlength] : val
     end

Reply via email to