arrow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject arrow git commit: ARROW-709: [C++] Restore type comparator for DecimalType
Date Sat, 25 Mar 2017 02:10:44 GMT
Repository: arrow
Updated Branches:
  refs/heads/master 60b5832e4 -> c7947dc2d


ARROW-709: [C++] Restore type comparator for DecimalType

Needed for PARQUET-923.

Author: Wes McKinney <wes.mckinney@twosigma.com>

Closes #439 from wesm/ARROW-709 and squashes the following commits:

55d23a3 [Wes McKinney] Restore type comparator for DecimalType


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

Branch: refs/heads/master
Commit: c7947dc2d08a0a2295016d34db201cc38a38360c
Parents: 60b5832
Author: Wes McKinney <wes.mckinney@twosigma.com>
Authored: Fri Mar 24 22:10:36 2017 -0400
Committer: Wes McKinney <wes.mckinney@twosigma.com>
Committed: Fri Mar 24 22:10:36 2017 -0400

----------------------------------------------------------------------
 cpp/src/arrow/compare.cc       | 6 ++++++
 cpp/src/arrow/loader.cc        | 2 ++
 cpp/src/arrow/type_traits.h    | 6 ++++++
 cpp/src/arrow/visitor_inline.h | 2 ++
 4 files changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/c7947dc2/cpp/src/arrow/compare.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/compare.cc b/cpp/src/arrow/compare.cc
index 13511cf..8274e0f 100644
--- a/cpp/src/arrow/compare.cc
+++ b/cpp/src/arrow/compare.cc
@@ -690,6 +690,12 @@ class TypeEqualsVisitor {
     return Status::OK();
   }
 
+  Status Visit(const DecimalType& left) {
+    const auto& right = static_cast<const DecimalType&>(right_);
+    result_ = left.precision == right.precision && left.scale == right.scale;
+    return Status::OK();
+  }
+
   Status Visit(const ListType& left) { return VisitChildren(left); }
 
   Status Visit(const StructType& left) { return VisitChildren(left); }

http://git-wip-us.apache.org/repos/asf/arrow/blob/c7947dc2/cpp/src/arrow/loader.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/loader.cc b/cpp/src/arrow/loader.cc
index a67a3e9..cc64c4d 100644
--- a/cpp/src/arrow/loader.cc
+++ b/cpp/src/arrow/loader.cc
@@ -135,6 +135,8 @@ class ArrayLoader {
 
   Status Visit(const NullType& type) { return Status::NotImplemented("null"); }
 
+  Status Visit(const DecimalType& type) { return Status::NotImplemented("decimal"); }
+
   template <typename T>
   typename std::enable_if<std::is_base_of<FixedWidthType, T>::value &&
                               !std::is_base_of<FixedWidthBinaryType, T>::value &&

http://git-wip-us.apache.org/repos/asf/arrow/blob/c7947dc2/cpp/src/arrow/type_traits.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/type_traits.h b/cpp/src/arrow/type_traits.h
index f735d27..1270aee 100644
--- a/cpp/src/arrow/type_traits.h
+++ b/cpp/src/arrow/type_traits.h
@@ -278,6 +278,12 @@ struct TypeTraits<DictionaryType> {
   constexpr static bool is_parameter_free = false;
 };
 
+template <>
+struct TypeTraits<DecimalType> {
+  // using ArrayType = DecimalArray;
+  constexpr static bool is_parameter_free = false;
+};
+
 // Not all type classes have a c_type
 template <typename T>
 struct as_void {

http://git-wip-us.apache.org/repos/asf/arrow/blob/c7947dc2/cpp/src/arrow/visitor_inline.h
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/visitor_inline.h b/cpp/src/arrow/visitor_inline.h
index 0ea16bc..586b123 100644
--- a/cpp/src/arrow/visitor_inline.h
+++ b/cpp/src/arrow/visitor_inline.h
@@ -53,6 +53,7 @@ inline Status VisitTypeInline(const DataType& type, VISITOR* visitor)
{
     TYPE_VISIT_INLINE(TimestampType);
     TYPE_VISIT_INLINE(Time32Type);
     TYPE_VISIT_INLINE(Time64Type);
+    TYPE_VISIT_INLINE(DecimalType);
     TYPE_VISIT_INLINE(ListType);
     TYPE_VISIT_INLINE(StructType);
     TYPE_VISIT_INLINE(UnionType);
@@ -91,6 +92,7 @@ inline Status VisitArrayInline(const Array& array, VISITOR* visitor)
{
     ARRAY_VISIT_INLINE(TimestampType);
     ARRAY_VISIT_INLINE(Time32Type);
     ARRAY_VISIT_INLINE(Time64Type);
+    // ARRAY_VISIT_INLINE(DecimalType);
     ARRAY_VISIT_INLINE(ListType);
     ARRAY_VISIT_INLINE(StructType);
     ARRAY_VISIT_INLINE(UnionType);


Mime
View raw message