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: Introduced comparator functors for Decimal type.
Date Wed, 15 Jun 2016 21:23:48 GMT
Repository: incubator-quickstep
Updated Branches:
  refs/heads/decimal-type 400d268b9 -> 4358b6edd


Introduced comparator functors for Decimal type.


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

Branch: refs/heads/decimal-type
Commit: 4358b6eddd63016f665f0774833ce1d0b81cbee5
Parents: 400d268
Author: Hakan Memisoglu <hakanmemisoglu@apache.org>
Authored: Wed Jun 15 16:23:24 2016 -0500
Committer: Hakan Memisoglu <hakanmemisoglu@apache.org>
Committed: Wed Jun 15 16:23:24 2016 -0500

----------------------------------------------------------------------
 types/operations/comparisons/ComparisonUtil.hpp | 104 +++++++++++++++++++
 1 file changed, 104 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-quickstep/blob/4358b6ed/types/operations/comparisons/ComparisonUtil.hpp
----------------------------------------------------------------------
diff --git a/types/operations/comparisons/ComparisonUtil.hpp b/types/operations/comparisons/ComparisonUtil.hpp
index d7da3fd..2e381b7 100644
--- a/types/operations/comparisons/ComparisonUtil.hpp
+++ b/types/operations/comparisons/ComparisonUtil.hpp
@@ -149,6 +149,11 @@ auto InvokeOnLessComparatorForTypeIgnoreNullability(const Type &type,
                                      double, false> comp;
       return functor(comp);
     }
+    case kDecimal: {
+      LessLiteralUncheckedComparator<DecimalLit, false,
+                                     DecimalLit, false> comp;
+      return functor(comp);
+    }
     case kChar: {
       const std::size_t string_length
           = static_cast<const AsciiStringSuperType&>(type).getStringLength();
@@ -254,6 +259,10 @@ auto InvokeOnLessComparatorForDifferentTypesIgnoreNullability(
           LessLiteralUncheckedComparator<int, false, double, false> comp;
           return functor(comp);
         }
+        case kDecimal: {
+          LessLiteralUncheckedComparator<int, false, DecimalLit, false> comp;
+          return functor(comp);
+        }
         default:
           return comparison_util_detail::InvokeOnLessComparatorForDifferentTypesFallback(
               left_type, right_type, functor);
@@ -280,6 +289,11 @@ auto InvokeOnLessComparatorForDifferentTypesIgnoreNullability(
                                          double, false> comp;
           return functor(comp);
         }
+        case kDecimal: {
+          LessLiteralUncheckedComparator<std::int64_t, false,
+                                         DecimalLit, false> comp;
+          return functor(comp);
+        }
         default:
           return comparison_util_detail::InvokeOnLessComparatorForDifferentTypesFallback(
               left_type, right_type, functor);
@@ -303,6 +317,10 @@ auto InvokeOnLessComparatorForDifferentTypesIgnoreNullability(
           LessLiteralUncheckedComparator<float, false, double, false> comp;
           return functor(comp);
         }
+        case kDecimal: {
+          LessLiteralUncheckedComparator<float, false, DecimalLit, false> comp;
+          return functor(comp);
+        }
         default:
           return comparison_util_detail::InvokeOnLessComparatorForDifferentTypesFallback(
               left_type, right_type, functor);
@@ -326,6 +344,37 @@ auto InvokeOnLessComparatorForDifferentTypesIgnoreNullability(
           LessLiteralUncheckedComparator<double, false, double, false> comp;
           return functor(comp);
         }
+        case kDecimal: {
+          LessLiteralUncheckedComparator<double, false, DecimalLit, false> comp;
+          return functor(comp);
+        }
+        default:
+          return comparison_util_detail::InvokeOnLessComparatorForDifferentTypesFallback(
+              left_type, right_type, functor);
+      }
+    }
+    case kDecimal: {
+      switch (right_type.getTypeID()) {
+        case kInt: {
+          LessLiteralUncheckedComparator<DecimalLit, false, int, false> comp;
+          return functor(comp);
+        }
+        case kLong: {
+          LessLiteralUncheckedComparator<DecimalLit, false, std::int64_t, false> comp;
+          return functor(comp);
+        }
+        case kFloat: {
+          LessLiteralUncheckedComparator<DecimalLit, false, float, false> comp;
+          return functor(comp);
+        }
+        case kDouble: {
+          LessLiteralUncheckedComparator<DecimalLit, false, double, false> comp;
+          return functor(comp);
+        }
+        case kDecimal: {
+          LessLiteralUncheckedComparator<DecimalLit, false, DecimalLit, false> comp;
+          return functor(comp);
+        }
         default:
           return comparison_util_detail::InvokeOnLessComparatorForDifferentTypesFallback(
               left_type, right_type, functor);
@@ -544,6 +593,11 @@ auto InvokeOnBothLessComparatorsForDifferentTypesIgnoreNullability(
           LessLiteralUncheckedComparator<double, false, int, false> comp_reversed;
           return functor(comp, comp_reversed);
         }
+        case kDecimal: {
+          LessLiteralUncheckedComparator<int, false, DecimalLit, false> comp;
+          LessLiteralUncheckedComparator<DecimalLit, false, int, false> comp_reversed;
+          return functor(comp, comp_reversed);
+        }
         default:
           return comparison_util_detail::InvokeOnBothLessComparatorsForDifferentTypesFallback(
               left_type, right_type, functor);
@@ -575,6 +629,11 @@ auto InvokeOnBothLessComparatorsForDifferentTypesIgnoreNullability(
                                          std::int64_t, false> comp_reversed;
           return functor(comp, comp_reversed);
         }
+        case kDecimal: {
+          LessLiteralUncheckedComparator<std::int64_t, false, DecimalLit, false> comp;
+          LessLiteralUncheckedComparator<DecimalLit, false, std::int64_t, false> comp_reversed;
+          return functor(comp, comp_reversed);
+        }
         default:
           return comparison_util_detail::InvokeOnBothLessComparatorsForDifferentTypesFallback(
               left_type, right_type, functor);
@@ -601,6 +660,11 @@ auto InvokeOnBothLessComparatorsForDifferentTypesIgnoreNullability(
           LessLiteralUncheckedComparator<double, false, float, false> comp_reversed;
           return functor(comp, comp_reversed);
         }
+        case kDecimal: {
+          LessLiteralUncheckedComparator<float, false, DecimalLit, false> comp;
+          LessLiteralUncheckedComparator<DecimalLit, false, float, false> comp_reversed;
+          return functor(comp, comp_reversed);
+        }
         default:
           return comparison_util_detail::InvokeOnBothLessComparatorsForDifferentTypesFallback(
               left_type, right_type, functor);
@@ -627,11 +691,47 @@ auto InvokeOnBothLessComparatorsForDifferentTypesIgnoreNullability(
           LessLiteralUncheckedComparator<double, false, double, false> comp;
           return functor(comp, comp);
         }
+        case kDecimal: {
+          LessLiteralUncheckedComparator<double, false, DecimalLit, false> comp;
+          LessLiteralUncheckedComparator<DecimalLit, false, double, false> comp_reversed;
+          return functor(comp, comp_reversed);
+        }
         default:
           return comparison_util_detail::InvokeOnBothLessComparatorsForDifferentTypesFallback(
               left_type, right_type, functor);
       }
     }
+    case kDecimal: {
+      switch (right_type.getTypeID()) {
+        case kInt: {
+          LessLiteralUncheckedComparator<DecimalLit, false, int, false> comp;
+          LessLiteralUncheckedComparator<int, false, DecimalLit, false> comp_reversed;
+          return functor(comp, comp_reversed);
+        }
+        case kLong: {
+          LessLiteralUncheckedComparator<DecimalLit, false, long, false> comp;
+          LessLiteralUncheckedComparator<long, false, DecimalLit, false> comp_reversed;
+          return functor(comp, comp_reversed);
+        }
+        case kFloat: {
+          LessLiteralUncheckedComparator<DecimalLit, false, float, false> comp;
+          LessLiteralUncheckedComparator<float, false, DecimalLit, false> comp_reversed;
+          return functor(comp, comp_reversed);
+        }
+        case kDouble: {
+          LessLiteralUncheckedComparator<DecimalLit, false, double, false> comp;
+          LessLiteralUncheckedComparator<double, false, DecimalLit, false> comp_reversed;
+          return functor(comp, comp_reversed);
+        }
+        case kDecimal: {
+          LessLiteralUncheckedComparator<DecimalLit, false, DecimalLit, false> comp;
+          return functor(comp, comp);
+        }
+      default:
+        return comparison_util_detail::InvokeOnBothLessComparatorsForDifferentTypesFallback(
+            left_type, right_type, functor);
+      }
+    }
     case kChar: {
       const std::size_t left_string_length
           = static_cast<const AsciiStringSuperType&>(left_type).getStringLength();
@@ -959,6 +1059,8 @@ inline bool CheckUntypedValuesEqual(const Type &type, const void
*left, const vo
       return STLLiteralEqual<float>()(left, right);
     case kDouble:
       return STLLiteralEqual<double>()(left, right);
+    case kDecimal:
+      return STLLiteralEqual<DecimalLit>()(left, right);
     case kChar:
       return STLCharEqual(static_cast<const AsciiStringSuperType&>(type).getStringLength())(left,
right);
     case kVarChar:
@@ -1216,6 +1318,8 @@ inline TypedValue GetLastValueForType(const Type &type) {
       return TypedValue(std::numeric_limits<float>::max());
     case kDouble:
       return TypedValue(std::numeric_limits<double>::max());
+    case kDecimal:
+      return TypedValue(DecimalLit{std::numeric_limits<std::int64_t>::max()});
     case kChar:
       return TypedValue(kChar, kLastString, 2);
     case kVarChar:


Mime
View raw message