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-1411: [Python] Booleans in Float Columns cause Segfault
Date Sat, 26 Aug 2017 20:26:22 GMT
Repository: arrow
Updated Branches:
  refs/heads/master ea503a5f0 -> b36aab5ab


ARROW-1411: [Python] Booleans in Float Columns cause Segfault

Author: Phillip Cloud <cpcloud@gmail.com>

Closes #993 from cpcloud/ARROW-1411 and squashes the following commits:

741269f0 [Phillip Cloud] ARROW-1411: [Python] Booleans in Float Columns cause Segfault


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

Branch: refs/heads/master
Commit: b36aab5abfa7b398c9b307930a9f1ba4c9dc08c8
Parents: ea503a5
Author: Phillip Cloud <cpcloud@gmail.com>
Authored: Sat Aug 26 16:26:17 2017 -0400
Committer: Wes McKinney <wes.mckinney@twosigma.com>
Committed: Sat Aug 26 16:26:17 2017 -0400

----------------------------------------------------------------------
 cpp/src/arrow/python/pandas_to_arrow.cc     | 12 ++++++------
 python/pyarrow/tests/test_convert_pandas.py |  4 ++++
 2 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/b36aab5a/cpp/src/arrow/python/pandas_to_arrow.cc
----------------------------------------------------------------------
diff --git a/cpp/src/arrow/python/pandas_to_arrow.cc b/cpp/src/arrow/python/pandas_to_arrow.cc
index b6cc16b..408aef3 100644
--- a/cpp/src/arrow/python/pandas_to_arrow.cc
+++ b/cpp/src/arrow/python/pandas_to_arrow.cc
@@ -552,7 +552,7 @@ Status PandasConverter::ConvertDates() {
       RETURN_NOT_OK(builder.AppendNull());
     } else {
       std::stringstream ss;
-      ss << "Error converting from Python objects to " << type_->ToString()
<< ": ";
+      ss << "Error converting from Python objects to Date: ";
       RETURN_NOT_OK(InvalidConversion(obj, "datetime.date", &ss));
       return Status::Invalid(ss.str());
     }
@@ -608,7 +608,7 @@ Status PandasConverter::ConvertDecimals() {
       RETURN_NOT_OK(builder.AppendNull());
     } else {
       std::stringstream ss;
-      ss << "Error converting from Python objects to " << type_->ToString()
<< ": ";
+      ss << "Error converting from Python objects to Decimal: ";
       RETURN_NOT_OK(InvalidConversion(object, "decimal.Decimal", &ss));
       return Status::Invalid(ss.str());
     }
@@ -636,7 +636,7 @@ Status PandasConverter::ConvertTimes() {
       RETURN_NOT_OK(builder.AppendNull());
     } else {
       std::stringstream ss;
-      ss << "Error converting from Python objects to " << type_->ToString()
<< ": ";
+      ss << "Error converting from Python objects to Time: ";
       RETURN_NOT_OK(InvalidConversion(obj, "datetime.time", &ss));
       return Status::Invalid(ss.str());
     }
@@ -704,7 +704,7 @@ Status PandasConverter::ConvertObjectFloats() {
       RETURN_NOT_OK(builder.Append(val));
     } else {
       std::stringstream ss;
-      ss << "Error converting from Python objects to " << type_->ToString()
<< ": ";
+      ss << "Error converting from Python objects to Double: ";
       RETURN_NOT_OK(InvalidConversion(obj, "float", &ss));
       return Status::Invalid(ss.str());
     }
@@ -739,7 +739,7 @@ Status PandasConverter::ConvertObjectIntegers() {
       RETURN_NOT_OK(builder.Append(val));
     } else {
       std::stringstream ss;
-      ss << "Error converting from Python objects to " << type_->ToString()
<< ": ";
+      ss << "Error converting from Python objects to Int64: ";
       RETURN_NOT_OK(InvalidConversion(obj, "integer", &ss));
       return Status::Invalid(ss.str());
     }
@@ -802,7 +802,7 @@ Status PandasConverter::ConvertBooleans() {
       BitUtil::SetBit(null_bitmap_data_, i);
     } else {
       std::stringstream ss;
-      ss << "Error converting from Python objects to " << type_->ToString()
<< ": ";
+      ss << "Error converting from Python objects to Boolean: ";
       RETURN_NOT_OK(InvalidConversion(obj, "bool", &ss));
       return Status::Invalid(ss.str());
     }

http://git-wip-us.apache.org/repos/asf/arrow/blob/b36aab5a/python/pyarrow/tests/test_convert_pandas.py
----------------------------------------------------------------------
diff --git a/python/pyarrow/tests/test_convert_pandas.py b/python/pyarrow/tests/test_convert_pandas.py
index c263184..6e5e8e8 100644
--- a/python/pyarrow/tests/test_convert_pandas.py
+++ b/python/pyarrow/tests/test_convert_pandas.py
@@ -619,6 +619,10 @@ class TestPandasConversion(unittest.TestCase):
         with self.assertRaises(pa.ArrowException):
             pa.Table.from_pandas(data)
 
+        data = pd.DataFrame({'a': [1, True]})
+        with self.assertRaises(pa.ArrowException):
+            pa.Table.from_pandas(data)
+
     def test_strided_data_import(self):
         cases = []
 


Mime
View raw message