Skip to content

Commit c559a08

Browse files
authored
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 <shangxinli@users.noreply.github.com>
1 parent 35d3006 commit c559a08

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/iceberg/parquet/parquet_reader.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class EmptyRecordBatchReader : public ::arrow::RecordBatchReader {
8787
std::shared_ptr<::arrow::Schema> schema() const override { return nullptr; }
8888

8989
::arrow::Status ReadNext(std::shared_ptr<::arrow::RecordBatch>* batch) override {
90-
batch = nullptr;
90+
*batch = nullptr;
9191
return ::arrow::Status::OK();
9292
}
9393
};

src/iceberg/parquet/parquet_writer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Result<::arrow::Compression::type> ParseCompression(const WriterProperties& prop
6161
} else if (compression_name == "zstd") {
6262
return ::arrow::Compression::ZSTD;
6363
} else {
64-
return InvalidArgument("Unsupported Parquet compression codec: ", compression_name);
64+
return InvalidArgument("Unsupported Parquet compression codec: {}", compression_name);
6565
}
6666
}
6767

src/iceberg/util/decimal.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ constexpr Decimal kMaxDecimalValue(5421010862427522170LL, 687399551400673279ULL)
5656
constexpr Decimal kMinDecimalValue(-5421010862427522171LL, 17759344522308878337ULL);
5757

5858
struct DecimalComponents {
59-
std::string_view while_digits;
59+
std::string_view whole_digits;
6060
std::string_view fractional_digits;
6161
int32_t exponent{0};
6262
char sign{0};
@@ -92,17 +92,17 @@ bool ParseDecimalComponents(std::string_view str, DecimalComponents* out) {
9292
out->sign = str[pos++];
9393
}
9494
// First run of digits
95-
pos = ParseDigitsRun(str, pos, &out->while_digits);
95+
pos = ParseDigitsRun(str, pos, &out->whole_digits);
9696
if (pos == str.size()) {
97-
return !out->while_digits.empty();
97+
return !out->whole_digits.empty();
9898
}
9999

100100
// Optional dot
101101
if (IsDot(str[pos])) {
102102
// Second run of digits after the dot
103103
pos = ParseDigitsRun(str, ++pos, &out->fractional_digits);
104104
}
105-
if (out->fractional_digits.empty() && out->while_digits.empty()) {
105+
if (out->fractional_digits.empty() && out->whole_digits.empty()) {
106106
// Need at least some digits (whole or fractional)
107107
return false;
108108
}
@@ -437,10 +437,10 @@ Result<Decimal> Decimal::FromString(std::string_view str, int32_t* precision,
437437
}
438438

439439
// Count number of significant digits (without leading zeros)
440-
size_t first_non_zero = dec.while_digits.find_first_not_of('0');
440+
size_t first_non_zero = dec.whole_digits.find_first_not_of('0');
441441
size_t significant_digits = dec.fractional_digits.size();
442442
if (first_non_zero != std::string_view::npos) {
443-
significant_digits += dec.while_digits.size() - first_non_zero;
443+
significant_digits += dec.whole_digits.size() - first_non_zero;
444444
}
445445

446446
auto parsed_precision = static_cast<int32_t>(significant_digits);
@@ -454,7 +454,7 @@ Result<Decimal> Decimal::FromString(std::string_view str, int32_t* precision,
454454
}
455455

456456
uint128_t value = 0;
457-
ShiftAndAdd(dec.while_digits, value);
457+
ShiftAndAdd(dec.whole_digits, value);
458458
ShiftAndAdd(dec.fractional_digits, value);
459459
Decimal result(static_cast<int128_t>(value));
460460

0 commit comments

Comments
 (0)