quickstep-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hakanmemiso...@apache.org
Subject incubator-quickstep git commit: Some additional changes for the size change.
Date Tue, 06 Sep 2016 14:02:55 GMT
Repository: incubator-quickstep
Updated Branches:
  refs/heads/date-representation 2f5b6ddfd -> 92555fc43


Some additional changes for the size change.


Project: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/commit/92555fc4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/tree/92555fc4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-quickstep/diff/92555fc4

Branch: refs/heads/date-representation
Commit: 92555fc4311d8efdee4b66faeb4fb0cd48938595
Parents: 2f5b6dd
Author: Hakan Memisoglu <hakanmemisoglu@gmail.com>
Authored: Tue Sep 6 09:02:40 2016 -0500
Committer: Hakan Memisoglu <hakanmemisoglu@gmail.com>
Committed: Tue Sep 6 09:02:40 2016 -0500

----------------------------------------------------------------------
 types/DatetimeLit.hpp  | 6 ++++++
 types/TypedValue.cpp   | 9 ++-------
 types/TypedValue.hpp   | 4 +++-
 types/TypedValue.proto | 8 +-------
 4 files changed, 12 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/92555fc4/types/DatetimeLit.hpp
----------------------------------------------------------------------
diff --git a/types/DatetimeLit.hpp b/types/DatetimeLit.hpp
index 7ce7177..c99dae4 100644
--- a/types/DatetimeLit.hpp
+++ b/types/DatetimeLit.hpp
@@ -73,6 +73,12 @@ struct DateLit {
     return date;
   }
 
+  static DateLit Create(const std::uint32_t serialized) {
+    DateLit date;
+    date.year_month_day = serialized;
+    return date;
+  }
+
   inline bool operator< (const DateLit& rhs) const {
     return year_month_day < rhs.year_month_day;
   }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/92555fc4/types/TypedValue.cpp
----------------------------------------------------------------------
diff --git a/types/TypedValue.cpp b/types/TypedValue.cpp
index d7b4956..ada69c6 100644
--- a/types/TypedValue.cpp
+++ b/types/TypedValue.cpp
@@ -110,10 +110,7 @@ serialization::TypedValue TypedValue::getProto() const {
     case kDate:
       proto.set_type_id(serialization::Type::DATE);
       if (!isNull()) {
-        serialization::TypedValue::DateLit *literal_date_proto = proto.mutable_date_value();
-        literal_date_proto->set_year(value_union_.date_value.yearField());
-        literal_date_proto->set_month(value_union_.date_value.monthField());
-        literal_date_proto->set_day(value_union_.date_value.dayField());
+        proto.set_date_value(getLiteral<DateLit>().year_month_day);
       }
       break;
     case kDatetime:
@@ -185,9 +182,7 @@ TypedValue TypedValue::ReconstructFromProto(const serialization::TypedValue
&pro
           TypedValue(kDouble);
     case serialization::Type::DATE:
       if (proto.has_date_value()) {
-        return TypedValue(DateLit::Create(proto.date_value().year(),
-                                          proto.date_value().month(),
-                                          proto.date_value().day()));
+        return TypedValue(DateLit::Create(proto.date_value()));
       } else {
         return TypedValue(kDate);
       }

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/92555fc4/types/TypedValue.hpp
----------------------------------------------------------------------
diff --git a/types/TypedValue.hpp b/types/TypedValue.hpp
index d75720a..dae8bd8 100644
--- a/types/TypedValue.hpp
+++ b/types/TypedValue.hpp
@@ -393,10 +393,10 @@ class TypedValue {
     switch (getTypeID()) {
       case kInt:
       case kFloat:
+      case kDate:
         return sizeof(int);
       case kLong:
       case kDouble:
-      case kDate:
       case kDatetime:
       case kDatetimeInterval:
       case kYearMonthInterval:
@@ -552,6 +552,8 @@ class TypedValue {
           // 4 bytes byte-for-byte copy.
           *static_cast<int*>(destination) = value_union_.int_value;
           break;
+        case kDate:
+          *static_cast<DateLit*>(destination) = value_union_.date_value;
         default:
           // 8 bytes byte-for-byte copy.
           *static_cast<ValueUnion*>(destination) = value_union_;

http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/92555fc4/types/TypedValue.proto
----------------------------------------------------------------------
diff --git a/types/TypedValue.proto b/types/TypedValue.proto
index 7f3ab7a..0164688 100644
--- a/types/TypedValue.proto
+++ b/types/TypedValue.proto
@@ -34,11 +34,5 @@ message TypedValue {
   optional int64 datetime_interval_value = 8;
   optional int64 year_month_interval_value = 9;
 
-  message DateLit {
-    required int32 year = 1;
-    required uint32 month = 2;
-    required uint32 day = 3;
-  }
-
-  optional DateLit date_value = 10;
+  optional uint32 date_value = 10;
 }


Mime
View raw message