From 3a9ba6f602a65e831d293596dca044d15f1bc461 Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Sun, 18 Aug 2024 18:35:26 -0400 Subject: [PATCH] MSVC compat --- src/pantab/writer.cpp | 4 ++-- tests/test_decimal.py | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/pantab/writer.cpp b/src/pantab/writer.cpp index 3e8a71e7..d35bb345 100644 --- a/src/pantab/writer.cpp +++ b/src/pantab/writer.cpp @@ -347,8 +347,8 @@ struct NumericCreatorInserter { static void insert(funcMapType &func_map) { func_map.emplace(std::make_pair(Precision, Scale), [](hyperapi::Inserter &inserter, std::string_view sv) { - // TODO: separate Precision and Scale - hyperapi::Numeric value{sv}; + hyperapi::string_view hsv(sv); // for MSVC + hyperapi::Numeric value(hsv); inserter.add(value); }); } diff --git a/tests/test_decimal.py b/tests/test_decimal.py index 755cc4b2..b8a2630d 100644 --- a/tests/test_decimal.py +++ b/tests/test_decimal.py @@ -9,6 +9,7 @@ def test_decimal_roundtrip(tmp_hyper, compat): ("no_fractional", pa.decimal128(38, 0)), ("mixed_decimal", pa.decimal128(38, 10)), ("only_fractional", pa.decimal128(38, 38)), + ("five_two", pa.decimal128(5, 2)), ] ) @@ -35,6 +36,13 @@ def test_decimal_roundtrip(tmp_hyper, compat): None, ] ), + pa.array( + [ + "123.45", + "-543.21", + None, + ] + ), ], schema=schema, )