Skip to content

Commit

Permalink
MSVC debug
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd committed Aug 20, 2024
1 parent 83dc3cf commit 4983468
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ known_first_party = "pantab"
build = "cp39-*64 cp310-*64 cp311-*64 cp312-*64"
skip = "*musllinux*"

test-command = "python -m pytest {project}/tests"
test-command = "python -m pytest -s {project}/tests/test_decimal.py"
test-requires = ["pytest", "pandas>=2.0.0", "polars~=1.2.0", "narwhals"]

[tool.ruff]
Expand Down
9 changes: 5 additions & 4 deletions src/pantab/reader.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "reader.hpp"

#include <iostream>
#include <variant>
#include <vector>

Expand Down Expand Up @@ -289,10 +290,10 @@ class DecimalReadHelper : public ReadHelper {
if constexpr (S() <= P()) {
const auto decimal_value = value.get<hyperapi::Numeric<P(), S()>>();
auto value_string = decimal_value.toString();
// C++20 std::erase would really simplify this!
value_string.erase(
std::remove(value_string.begin(), value_string.end(), '.'),
value_string.end());
std::cout << std::endl
<< "Original value string is: " << value_string
<< std::endl;
std::erase(value_string, '.');
return value_string;
}
throw "unreachable";
Expand Down
3 changes: 3 additions & 0 deletions src/pantab/writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <nanoarrow/nanoarrow.hpp>

#include <chrono>
#inlcude < iostream>
#include <set>
#include <utility>
#include <variant>
Expand Down Expand Up @@ -373,6 +374,8 @@ class DecimalInsertHelper : public InsertHelper {
// The Hyper API wants the string to include the decimal place, which
// nanoarrow does not provide
const auto str_with_decimal = str.insert(str.size() - scale_, 1, '.');
std::cout << std::endl
<< "str_with_decimal is: " << str_with_decimal << std::endl;

constexpr auto MaxPrecision = 39; // of-by-one error in solution?
if (precision_ >= MaxPrecision) {
Expand Down

0 comments on commit 4983468

Please sign in to comment.