wgtmac commented on a change in pull request #543:
URL: https://github.com/apache/orc/pull/543#discussion_r514739760



##########
File path: c++/include/orc/sargs/Literal.hh
##########
@@ -36,6 +36,33 @@ namespace orc {
    */
   class Literal {
   public:
+    struct Timestamp {
+      Timestamp() = default;
+      Timestamp(const Timestamp&) = default;
+      Timestamp(Timestamp&&) = default;
+      ~Timestamp() = default;
+      Timestamp(int64_t second_, int32_t nano_): second(second_), nano(nano_) {
+        // PASS
+      }
+      Timestamp& operator=(const Timestamp&) = default;
+      Timestamp& operator=(Timestamp&&) = default;
+      bool operator==(const Timestamp& r) const {
+        return second == r.second && nano == r.nano;
+      }
+      bool operator<(const Timestamp& r) const {
+        return second < r.second || (second == r.second && nano < r.nano);
+      }
+      bool operator<=(const Timestamp& r) const {
+        return second < r.second || (second == r.second && nano <= r.nano);
+      }
+      bool operator!=(const Timestamp& r) const { return !(*this == r); }
+      bool operator>(const Timestamp& r) const { return r < *this; }
+      bool operator>=(const Timestamp& r) const { return r <= *this; }
+      int64_t getMillis() const { return second * 1000 + nano / 1000000; }

Review comment:
       Added a test for getMillis. nano / 1000000 is fine because nano only has 
9 digits and it will not be zero if it has more than 6 digits.

##########
File path: c++/src/sargs/PredicateLeaf.cc
##########
@@ -510,6 +510,7 @@ namespace orc {
         break;
       }
       case PredicateDataType::STRING: {
+        ///TODO: check lowerBound and upperBound as well

Review comment:
       I will fix it in a separate JIRA and patch. But here I want to leave a 
mark in case I forget.

##########
File path: c++/include/orc/sargs/Literal.hh
##########
@@ -36,6 +36,33 @@ namespace orc {
    */
   class Literal {
   public:
+    struct Timestamp {
+      Timestamp() = default;
+      Timestamp(const Timestamp&) = default;
+      Timestamp(Timestamp&&) = default;
+      ~Timestamp() = default;
+      Timestamp(int64_t second_, int32_t nano_): second(second_), nano(nano_) {
+        // PASS
+      }
+      Timestamp& operator=(const Timestamp&) = default;
+      Timestamp& operator=(Timestamp&&) = default;
+      bool operator==(const Timestamp& r) const {
+        return second == r.second && nano == r.nano;
+      }
+      bool operator<(const Timestamp& r) const {
+        return second < r.second || (second == r.second && nano < r.nano);
+      }
+      bool operator<=(const Timestamp& r) const {
+        return second < r.second || (second == r.second && nano <= r.nano);
+      }
+      bool operator!=(const Timestamp& r) const { return !(*this == r); }
+      bool operator>(const Timestamp& r) const { return r < *this; }
+      bool operator>=(const Timestamp& r) const { return r <= *this; }
+      int64_t getMillis() const { return second * 1000 + nano / 1000000; }
+      int64_t second;
+      int32_t nano;

Review comment:
       done




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to