You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@quickstep.apache.org by ha...@apache.org on 2016/06/15 19:48:52 UTC

[49/50] [abbrv] incubator-quickstep git commit: New changes.

New changes.


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

Branch: refs/heads/decimal-type
Commit: d71599fd124d9ddaf97150b52c7e701e4bcd121b
Parents: 5aa5593
Author: Hakan Memisoglu <ha...@apache.org>
Authored: Tue Jun 14 10:09:25 2016 -0500
Committer: Hakan Memisoglu <ha...@apache.org>
Committed: Wed Jun 15 14:46:25 2016 -0500

----------------------------------------------------------------------
 .../unary_operations/ArithmeticUnaryOperations.cpp     | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/d71599fd/types/operations/unary_operations/ArithmeticUnaryOperations.cpp
----------------------------------------------------------------------
diff --git a/types/operations/unary_operations/ArithmeticUnaryOperations.cpp b/types/operations/unary_operations/ArithmeticUnaryOperations.cpp
index 1e61db3..003c17e 100644
--- a/types/operations/unary_operations/ArithmeticUnaryOperations.cpp
+++ b/types/operations/unary_operations/ArithmeticUnaryOperations.cpp
@@ -20,6 +20,7 @@
 #include <string>
 
 #include "types/DatetimeIntervalType.hpp"
+#include "types/DecimalType.hpp"
 #include "types/DoubleType.hpp"
 #include "types/FloatType.hpp"
 #include "types/IntType.hpp"
@@ -40,7 +41,7 @@ namespace quickstep {
 bool ArithmeticUnaryOperation::canApplyToType(const Type &type) const {
   return QUICKSTEP_EQUALS_ANY_CONSTANT(
       type.getTypeID(),
-      kInt, kLong, kFloat, kDouble, kDatetimeInterval, kYearMonthInterval);
+      kInt, kLong, kFloat, kDouble, kDecimal, kDatetimeInterval, kYearMonthInterval);
 }
 
 const Type* ArithmeticUnaryOperation::resultTypeForArgumentType(const Type &type) const {
@@ -66,7 +67,7 @@ const Type* ArithmeticUnaryOperation::pushDownTypeHint(const Type *type_hint) co
 bool NegateUnaryOperation::resultTypeIsPlausible(const Type &result_type) const {
   return QUICKSTEP_EQUALS_ANY_CONSTANT(
       result_type.getTypeID(),
-      kInt, kLong, kFloat, kDouble, kDatetimeInterval, kYearMonthInterval);
+      kInt, kLong, kFloat, kDouble, kDecimal, kDatetimeInterval, kYearMonthInterval);
 }
 
 TypedValue NegateUnaryOperation::applyToChecked(const TypedValue &argument,
@@ -86,6 +87,8 @@ TypedValue NegateUnaryOperation::applyToChecked(const TypedValue &argument,
       return TypedValue(-argument.getLiteral<typename FloatType::cpptype>());
     case kDouble:
       return TypedValue(-argument.getLiteral<typename DoubleType::cpptype>());
+    case kDecimal:
+      return TypedValue(-argument.getLiteral<typename DecimalType::cpptype>());
     case kDatetimeInterval:
       return TypedValue(-argument.getLiteral<typename DatetimeIntervalType::cpptype>());
     case kYearMonthInterval:
@@ -123,6 +126,12 @@ UncheckedUnaryOperator* NegateUnaryOperation::makeUncheckedUnaryOperatorForType(
       } else {
         return new NegateUncheckedUnaryOperator<DoubleType, false>();
       }
+    case kDecimal:
+      if (type.isNullable()) {
+        return new NegateUncheckedUnaryOperator<DecimalType, true>();
+      } else {
+        return new NegateUncheckedUnaryOperator<DecimalType, false>();
+      }
     case kDatetimeInterval:
       if (type.isNullable()) {
         return new NegateUncheckedUnaryOperator<DatetimeIntervalType, true>();