This is an automated email from the ASF dual-hosted git repository.

gangwu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-cpp.git


The following commit(s) were added to refs/heads/main by this push:
     new c559a083 fix: fix misspelled variable, missing format arg, and wrong 
pointer assignment (#570)
c559a083 is described below

commit c559a08370a3081717e6e490b0cc5a9cbc92519e
Author: Xinli Shang <[email protected]>
AuthorDate: Sun Feb 22 06:39:32 2026 -0800

    fix: fix misspelled variable, missing format arg, and wrong pointer 
assignment (#570)
    
    ## Summary
    - Rename `while_digits` to `whole_digits` in decimal parser (typo for
    "whole" digits, the integer part before the decimal point)
    - Add missing `{}` format placeholder in parquet writer error message so
    the codec name is actually included
    - Fix `batch = nullptr` to `*batch = nullptr` in
    `EmptyRecordBatchReader::ReadNext()` so the caller's shared_ptr is
    properly cleared
    
    ## Test plan
    - Build verified locally
    - All existing tests pass (`expression_test`, `util_test`,
    `parquet_test`)
    
    Co-authored-by: shangxinli <[email protected]>
---
 src/iceberg/parquet/parquet_reader.cc |  2 +-
 src/iceberg/parquet/parquet_writer.cc |  2 +-
 src/iceberg/util/decimal.cc           | 14 +++++++-------
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/iceberg/parquet/parquet_reader.cc 
b/src/iceberg/parquet/parquet_reader.cc
index d13df0eb..2fbf8e0a 100644
--- a/src/iceberg/parquet/parquet_reader.cc
+++ b/src/iceberg/parquet/parquet_reader.cc
@@ -87,7 +87,7 @@ class EmptyRecordBatchReader : public 
::arrow::RecordBatchReader {
   std::shared_ptr<::arrow::Schema> schema() const override { return nullptr; }
 
   ::arrow::Status ReadNext(std::shared_ptr<::arrow::RecordBatch>* batch) 
override {
-    batch = nullptr;
+    *batch = nullptr;
     return ::arrow::Status::OK();
   }
 };
diff --git a/src/iceberg/parquet/parquet_writer.cc 
b/src/iceberg/parquet/parquet_writer.cc
index c874665a..a68e9e61 100644
--- a/src/iceberg/parquet/parquet_writer.cc
+++ b/src/iceberg/parquet/parquet_writer.cc
@@ -61,7 +61,7 @@ Result<::arrow::Compression::type> ParseCompression(const 
WriterProperties& prop
   } else if (compression_name == "zstd") {
     return ::arrow::Compression::ZSTD;
   } else {
-    return InvalidArgument("Unsupported Parquet compression codec: ", 
compression_name);
+    return InvalidArgument("Unsupported Parquet compression codec: {}", 
compression_name);
   }
 }
 
diff --git a/src/iceberg/util/decimal.cc b/src/iceberg/util/decimal.cc
index aeb7c614..0599afa4 100644
--- a/src/iceberg/util/decimal.cc
+++ b/src/iceberg/util/decimal.cc
@@ -56,7 +56,7 @@ constexpr Decimal kMaxDecimalValue(5421010862427522170LL, 
687399551400673279ULL)
 constexpr Decimal kMinDecimalValue(-5421010862427522171LL, 
17759344522308878337ULL);
 
 struct DecimalComponents {
-  std::string_view while_digits;
+  std::string_view whole_digits;
   std::string_view fractional_digits;
   int32_t exponent{0};
   char sign{0};
@@ -92,9 +92,9 @@ bool ParseDecimalComponents(std::string_view str, 
DecimalComponents* out) {
     out->sign = str[pos++];
   }
   // First run of digits
-  pos = ParseDigitsRun(str, pos, &out->while_digits);
+  pos = ParseDigitsRun(str, pos, &out->whole_digits);
   if (pos == str.size()) {
-    return !out->while_digits.empty();
+    return !out->whole_digits.empty();
   }
 
   // Optional dot
@@ -102,7 +102,7 @@ bool ParseDecimalComponents(std::string_view str, 
DecimalComponents* out) {
     // Second run of digits after the dot
     pos = ParseDigitsRun(str, ++pos, &out->fractional_digits);
   }
-  if (out->fractional_digits.empty() && out->while_digits.empty()) {
+  if (out->fractional_digits.empty() && out->whole_digits.empty()) {
     // Need at least some digits (whole or fractional)
     return false;
   }
@@ -437,10 +437,10 @@ Result<Decimal> Decimal::FromString(std::string_view str, 
int32_t* precision,
   }
 
   // Count number of significant digits (without leading zeros)
-  size_t first_non_zero = dec.while_digits.find_first_not_of('0');
+  size_t first_non_zero = dec.whole_digits.find_first_not_of('0');
   size_t significant_digits = dec.fractional_digits.size();
   if (first_non_zero != std::string_view::npos) {
-    significant_digits += dec.while_digits.size() - first_non_zero;
+    significant_digits += dec.whole_digits.size() - first_non_zero;
   }
 
   auto parsed_precision = static_cast<int32_t>(significant_digits);
@@ -454,7 +454,7 @@ Result<Decimal> Decimal::FromString(std::string_view str, 
int32_t* precision,
   }
 
   uint128_t value = 0;
-  ShiftAndAdd(dec.while_digits, value);
+  ShiftAndAdd(dec.whole_digits, value);
   ShiftAndAdd(dec.fractional_digits, value);
   Decimal result(static_cast<int128_t>(value));
 

Reply via email to