Skip to content

Commit

Permalink
wip: numeric to double
Browse files Browse the repository at this point in the history
  • Loading branch information
lupko committed Feb 6, 2024
1 parent 4091e6f commit 6c4290b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions c/driver/postgresql/copy/reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#pragma once

#include <algorithm>
#include <charconv>
#include <cinttypes>
#include <limits>
#include <memory>
Expand Down Expand Up @@ -518,9 +519,7 @@ class PostgresCopyNumericToDoubleFieldReader : public PostgresCopyNumericFieldRe
int64_t max_chars_required = max_chars_required_();
char* target = new char[max_chars_required];
int64_t actual_characters_required = DigitsToString(&target);
target[actual_characters_required + 1] = '\0';

value = strtod(target, NULL);
std::from_chars(target, target + actual_characters_required, value);
delete[] target;

NANOARROW_RETURN_NOT_OK(ArrowBufferAppend(data_, &value, sizeof(double)));
Expand Down

0 comments on commit 6c4290b

Please sign in to comment.