kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject [1/2] kudu git commit: Change timestamp printing to ISO-8601 (with microseconds)
Date Mon, 19 Sep 2016 18:28:31 GMT
Repository: kudu
Updated Branches:
  refs/heads/master ffb8fd967 -> 1f639da62


Change timestamp printing to ISO-8601 (with microseconds)

Dan raised the concern in a recent review that we're not adhering to the
standard while printing timestamps. The main point of this was to mimic
impala's behavior but then we would also print 'GMT', which impala does
not, meaning we aren't really mimicking impala either.

This changes timestamp printing to adhere to ISO-8601, hopefully allowing
standard date parsers to more easily process the output, if needed.

Change-Id: I421e3595af2b21eee6ec22606b6046e470559ad4
Reviewed-on: http://gerrit.cloudera.org:8080/1995
Tested-by: David Ribeiro Alves <dralves@apache.org>
Reviewed-by: Todd Lipcon <todd@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/09bf0340
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/09bf0340
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/09bf0340

Branch: refs/heads/master
Commit: 09bf03401e2ff6b1b2c041a2e94268ec5351d7b0
Parents: ffb8fd9
Author: David Alves <david.alves@cloudera.com>
Authored: Tue Feb 2 12:31:54 2016 -0800
Committer: David Ribeiro Alves <dralves@apache.org>
Committed: Fri Sep 16 23:22:21 2016 +0000

----------------------------------------------------------------------
 src/kudu/common/types-test.cc | 10 +++++-----
 src/kudu/common/types.h       |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/09bf0340/src/kudu/common/types-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/common/types-test.cc b/src/kudu/common/types-test.cc
index 51eedf0..ff93301 100644
--- a/src/kudu/common/types-test.cc
+++ b/src/kudu/common/types-test.cc
@@ -41,13 +41,13 @@ TEST(TestTypes, TestTimestampPrinting) {
   info->CopyMinValue(&time);
   string result;
   info->AppendDebugStringForValue(&time, &result);
-  ASSERT_EQ("-290308-12-21 19:59:05.224192 GMT", result);
+  ASSERT_EQ("-290308-12-21T19:59:05.224192Z", result);
   result = "";
 
   // Test a regular negative timestamp.
   time = -1454368523123456;
   info->AppendDebugStringForValue(&time, &result);
-  ASSERT_EQ("1923-12-01 00:44:36.876544 GMT", result);
+  ASSERT_EQ("1923-12-01T00:44:36.876544Z", result);
   result = "";
 
   // Test that passing 0 microseconds returns the correct time (0 msecs after the epoch).
@@ -55,19 +55,19 @@ TEST(TestTypes, TestTimestampPrinting) {
   // current time instead.
   time = 0;
   info->AppendDebugStringForValue(&time, &result);
-  ASSERT_EQ("1970-01-01 00:00:00.000000 GMT", result);
+  ASSERT_EQ("1970-01-01T00:00:00.000000Z", result);
   result = "";
 
   // Test a regular positive timestamp.
   time = 1454368523123456;
   info->AppendDebugStringForValue(&time, &result);
-  ASSERT_EQ("2016-02-01 23:15:23.123456 GMT", result);
+  ASSERT_EQ("2016-02-01T23:15:23.123456Z", result);
   result = "";
 
   // Test the maximum value.
   time = MathLimits<int64>::kMax;
   info->AppendDebugStringForValue(&time, &result);
-  ASSERT_EQ("294247-01-10 04:00:54.775807 GMT", result);
+  ASSERT_EQ("294247-01-10T04:00:54.775807Z", result);
 }
 
 namespace {

http://git-wip-us.apache.org/repos/asf/kudu/blob/09bf0340/src/kudu/common/types.h
----------------------------------------------------------------------
diff --git a/src/kudu/common/types.h b/src/kudu/common/types.h
index d768b79..9bed955 100644
--- a/src/kudu/common/types.h
+++ b/src/kudu/common/types.h
@@ -416,8 +416,8 @@ struct DataTypeTraits<STRING> : public DerivedTypeTraits<BINARY>{
   }
 };
 
-static const char* kDateFormat = "%Y-%m-%d %H:%M:%S";
-static const char* kDateMicrosAndTzFormat = "%s.%06d GMT";
+static const char* kDateFormat = "%Y-%m-%dT%H:%M:%S";
+static const char* kDateMicrosAndTzFormat = "%s.%06dZ";
 
 template<>
 struct DataTypeTraits<UNIXTIME_MICROS> : public DerivedTypeTraits<INT64>{


Mime
View raw message