Skip to content

Commit

Permalink
Revert some unnecessary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kontinuation committed Oct 30, 2024
1 parent 9aca79d commit 8a50947
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
5 changes: 2 additions & 3 deletions cpp/src/parquet/metadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,15 @@ static std::shared_ptr<Statistics> MakeTypedColumnStats(
metadata.statistics.null_count, metadata.statistics.distinct_count,
metadata.statistics.__isset.max_value && metadata.statistics.__isset.min_value,
metadata.statistics.__isset.null_count,
metadata.statistics.__isset.distinct_count, ::arrow::default_memory_pool());
metadata.statistics.__isset.distinct_count);
}
// Default behavior
return MakeStatistics<DType>(
descr, metadata.statistics.min, metadata.statistics.max,
metadata.num_values - metadata.statistics.null_count,
metadata.statistics.null_count, metadata.statistics.distinct_count,
metadata.statistics.__isset.max && metadata.statistics.__isset.min,
metadata.statistics.__isset.null_count, metadata.statistics.__isset.distinct_count,
::arrow::default_memory_pool());
metadata.statistics.__isset.null_count, metadata.statistics.__isset.distinct_count);
}

static std::shared_ptr<GeometryStatistics> MakeColumnGeometryStats(
Expand Down
10 changes: 5 additions & 5 deletions cpp/src/parquet/reader_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ TEST(TestFileReader, GetRecordReader) {
}

TEST(TestFileReader, RecordReaderWithExposingDictionary) {
const int kNumRows = 1000;
const int num_rows = 1000;

// Make schema
schema::NodeVector fields;
Expand All @@ -655,11 +655,11 @@ TEST(TestFileReader, RecordReaderWithExposingDictionary) {
ByteArrayWriter* writer = static_cast<ByteArrayWriter*>(rg_writer->NextColumn());
std::vector<std::string> raw_unique_data = {"a", "bc", "defg"};
std::vector<ByteArray> col_typed;
for (int i = 0; i < kNumRows; i++) {
for (int i = 0; i < num_rows; i++) {
std::string_view chosed_data = raw_unique_data[i % raw_unique_data.size()];
col_typed.emplace_back(chosed_data);
}
writer->WriteBatch(kNumRows, nullptr, nullptr, col_typed.data());
writer->WriteBatch(num_rows, nullptr, nullptr, col_typed.data());
rg_writer->Close();
file_writer->Close();

Expand All @@ -684,7 +684,7 @@ TEST(TestFileReader, RecordReaderWithExposingDictionary) {
reinterpret_cast<const ByteArray*>(record_reader->ReadDictionary(&dict_len));
ASSERT_NE(dict, nullptr);
ASSERT_EQ(dict_len, raw_unique_data.size());
ASSERT_EQ(record_reader->ReadRecords(kNumRows), kNumRows);
ASSERT_EQ(record_reader->ReadRecords(num_rows), num_rows);
std::shared_ptr<::arrow::ChunkedArray> result_array = record_reader->GetResult();
ASSERT_EQ(result_array->num_chunks(), 1);
const std::shared_ptr<::arrow::Array> chunk = result_array->chunk(0);
Expand All @@ -695,7 +695,7 @@ TEST(TestFileReader, RecordReaderWithExposingDictionary) {

// Verify values based on the dictionary from ReadDictionary().
int64_t indices_read = chunk->length();
ASSERT_EQ(indices_read, kNumRows);
ASSERT_EQ(indices_read, num_rows);
for (int i = 0; i < indices_read; ++i) {
ASSERT_LT(indices[i], dict_len);
ASSERT_EQ(std::string_view(reinterpret_cast<const char* const>(dict[indices[i]].ptr),
Expand Down
4 changes: 0 additions & 4 deletions cpp/src/parquet/statistics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ using arrow::util::SafeCopy;
using arrow::util::SafeLoad;

namespace parquet {

namespace {

// ----------------------------------------------------------------------
Expand Down Expand Up @@ -867,7 +866,6 @@ void TypedStatisticsImpl<DType>::Update(const T* values, int64_t num_values,
IncrementNumValues(num_values);

if (num_values == 0) return;

SetMinMaxPair(comparator_->GetMinMax(values, num_values));
}

Expand All @@ -883,7 +881,6 @@ void TypedStatisticsImpl<DType>::UpdateSpaced(const T* values, const uint8_t* va
IncrementNumValues(num_values);

if (num_values == 0) return;

SetMinMaxPair(comparator_->GetMinMaxSpaced(values, num_spaced_values, valid_bits,
valid_bits_offset));
}
Expand Down Expand Up @@ -1038,7 +1035,6 @@ std::shared_ptr<Statistics> Statistics::Make(const ColumnDescriptor* descr,
int64_t num_values,
::arrow::MemoryPool* pool) {
DCHECK(encoded_stats != nullptr);

return Make(descr, encoded_stats->min(), encoded_stats->max(), num_values,
encoded_stats->null_count, encoded_stats->distinct_count,
encoded_stats->has_min && encoded_stats->has_max,
Expand Down

0 comments on commit 8a50947

Please sign in to comment.