Skip to content

Commit

Permalink
GH-38966: [C++] Fix spelling (util) (#38967)
Browse files Browse the repository at this point in the history
### Rationale for this change

### What changes are included in this PR?

Spelling fixes to cpp/src/arrow/util/

### Are these changes tested?

### Are there any user-facing changes?

* Closes: #38966

Authored-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
  • Loading branch information
jsoref committed Dec 5, 2023
1 parent 2ea7f79 commit b3e607b
Show file tree
Hide file tree
Showing 24 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/align_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace util {
/// \brief Special alignment value to use data type-specific alignment
///
/// If this is passed as the `alignment` in one of the CheckAlignment or EnsureAlignment
/// functions, then the function will ensure ensure each buffer is suitably aligned
/// functions, then the function will ensure each buffer is suitably aligned
/// for the data type of the array. For example, given an int32 buffer the values
/// buffer's address must be a multiple of 4. Given a large_string buffer the offsets
/// buffer's address must be a multiple of 8.
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/arrow/util/async_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ AsyncGenerator<T> MakeSerialReadaheadGenerator(AsyncGenerator<T> source_generato
/// generator() once before it returns. The returned generator will otherwise
/// mirror the source.
///
/// This generator forwards aysnc-reentrant pressure to the source
/// This generator forwards async-reentrant pressure to the source
/// This generator buffers one item (the first result) until it is delivered.
template <typename T>
AsyncGenerator<T> MakeAutoStartingGenerator(AsyncGenerator<T> generator) {
Expand Down Expand Up @@ -1843,7 +1843,7 @@ constexpr int kDefaultBackgroundQRestart = 16;
/// active background thread task at any given time. You MUST transfer away from this
/// background generator. Otherwise there could be a race condition if a callback on the
/// background thread deletes the last consumer reference to the background generator. You
/// can transfer onto the same executor as the background thread, it is only neccesary to
/// can transfer onto the same executor as the background thread, it is only necessary to
/// create a new thread task, not to switch executors.
///
/// This generator is not async-reentrant
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/arrow/util/async_generator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ TEST_P(MergedGeneratorTestFixture, MergedStress) {
sources.push_back(source);
}
AsyncGenerator<AsyncGenerator<TestInt>> source_gen = util::AsyncVectorIt(sources);
auto outer_gaurd = ExpectNotAccessedReentrantly(&source_gen);
auto outer_guard = ExpectNotAccessedReentrantly(&source_gen);

auto merged = MakeMergedGenerator(source_gen, 4);
ASSERT_FINISHES_OK_AND_ASSIGN(auto items, CollectAsyncGenerator(merged));
Expand Down Expand Up @@ -1095,7 +1095,7 @@ TEST_P(BackgroundGeneratorTestFixture, BadResult) {
ASSERT_FINISHES_OK_AND_EQ(TestInt(1), generator());
// Next three results may or may not be valid.
// The typical case is the call for TestInt(2) restarts a full queue and then maybe
// TestInt(3) and TestInt(4) arrive quickly enough to not get pre-empted or maybe
// TestInt(3) and TestInt(4) arrive quickly enough to not get preempted or maybe
// they don't.
//
// A more bizarre, but possible, case is the checking thread falls behind the producer
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/benchmark_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class MemoryPoolMemoryManager : public benchmark::MemoryManager {
int64_t new_default_allocations =
default_pool->num_allocations() - global_allocations_start;

// Only record metrics metrics if (1) there were allocations and (2) we
// Only record metrics if (1) there were allocations and (2) we
// recorded at least one.
if (new_default_allocations > 0 && memory_pool->num_allocations() > 0) {
if (new_default_allocations > memory_pool->num_allocations()) {
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/bit_block_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class ARROW_EXPORT BitBlockCounter {
int64_t offset_;
};

/// \brief A tool to iterate through a possibly non-existent validity bitmap,
/// \brief A tool to iterate through a possibly nonexistent validity bitmap,
/// to allow us to write one code path for both the with-nulls and no-nulls
/// cases without giving up a lot of performance.
class ARROW_EXPORT OptionalBitBlockCounter {
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/bit_util_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ TEST(FirstTimeBitmapWriter, AppendWordOffsetOverwritesCorrectBitsOnExistingByte)
writer.Finish();
EXPECT_EQ(BitmapToString(valid_bits, kBitsAfterAppend), expected_bits);
};
// 0ffset zero would not be a valid mask.
// Offset zero would not be a valid mask.
check_with_set("11111111", 1);
check_with_set("10111111", 2);
check_with_set("10011111", 3);
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/bitmap_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class BitmapWordReader {
}
};

/// \brief Index into a possibly non-existent bitmap
/// \brief Index into a possibly nonexistent bitmap
struct OptionalBitIndexer {
const uint8_t* bitmap;
const int64_t offset;
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/arrow/util/byte_stream_split_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ void ByteStreamSplitEncodeAvx2(const uint8_t* raw_values, const size_t num_value
}

// Path for float.
// 1. Processed hierarchically to 32i blcok using the unpack intrinsics.
// 1. Processed hierarchically to 32i block using the unpack intrinsics.
// 2. Pack 128i block using _mm256_permutevar8x32_epi32.
// 3. Pack final 256i block with _mm256_permute2x128_si256.
constexpr size_t kNumUnpack = 3U;
Expand Down Expand Up @@ -534,7 +534,7 @@ void ByteStreamSplitEncodeAvx512(const uint8_t* raw_values, const size_t num_val
final_result[7] = _mm512_shuffle_i32x4(shuffle[6], shuffle[7], 0b11011101);
} else {
// Path for float.
// 1. Processed hierarchically to 32i blcok using the unpack intrinsics.
// 1. Processed hierarchically to 32i block using the unpack intrinsics.
// 2. Pack 128i block using _mm256_permutevar8x32_epi32.
// 3. Pack final 256i block with _mm256_permute2x128_si256.
for (size_t i = 0; i < kNumStreams; ++i)
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/arrow/util/byte_stream_split_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ struct NamedFunc {
};

// A simplistic reference implementation for validation
void RefererenceByteStreamSplitEncode(const uint8_t* src, int width,
const int64_t num_values, uint8_t* dest) {
void ReferenceByteStreamSplitEncode(const uint8_t* src, int width,
const int64_t num_values, uint8_t* dest) {
for (int64_t i = 0; i < num_values; ++i) {
for (int stream = 0; stream < width; ++stream) {
dest[stream * num_values + i] = *src++;
Expand Down Expand Up @@ -129,7 +129,7 @@ class TestByteStreamSplitSpecialized : public ::testing::Test {
protected:
static void ReferenceEncode(const uint8_t* raw_values, const int64_t num_values,
uint8_t* output_buffer_raw) {
RefererenceByteStreamSplitEncode(raw_values, kWidth, num_values, output_buffer_raw);
ReferenceByteStreamSplitEncode(raw_values, kWidth, num_values, output_buffer_raw);
}

static std::vector<T> MakeRandomInput(int64_t num_values) {
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/arrow/util/decimal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ struct Decimal128RealConversion
return x;
}

/// An appoximate conversion from Decimal128 to Real that guarantees:
/// An approximate conversion from Decimal128 to Real that guarantees:
/// 1. If the decimal is an integer, the conversion is exact.
/// 2. If the number of fractional digits is <= RealTraits<Real>::kMantissaDigits (e.g.
/// 8 for float and 16 for double), the conversion is within 1 ULP of the exact
Expand Down Expand Up @@ -1006,7 +1006,7 @@ struct Decimal256RealConversion
return x;
}

/// An appoximate conversion from Decimal256 to Real that guarantees:
/// An approximate conversion from Decimal256 to Real that guarantees:
/// 1. If the decimal is an integer, the conversion is exact.
/// 2. If the number of fractional digits is <= RealTraits<Real>::kMantissaDigits (e.g.
/// 8 for float and 16 for double), the conversion is within 1 ULP of the exact
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/arrow/util/future.h
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ class [[nodiscard]] Future {
return MakeFinished(E::ToResult(std::move(s)));
}

struct WrapResultyOnComplete {
struct WrapResultOnComplete {
template <typename OnComplete>
struct Callback {
void operator()(const FutureImpl& impl) && {
Expand All @@ -461,7 +461,7 @@ class [[nodiscard]] Future {
template <typename OnComplete>
using WrapOnComplete = typename std::conditional<
detail::first_arg_is_status<OnComplete>::value, WrapStatusyOnComplete,
WrapResultyOnComplete>::type::template Callback<OnComplete>;
WrapResultOnComplete>::type::template Callback<OnComplete>;

/// \brief Consumer API: Register a callback to run when this future completes
///
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/int_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Status CheckIntegersInRange(const ArraySpan& values, const Scalar& bound_lower,
ARROW_EXPORT
Status IntegersCanFit(const ArraySpan& values, const DataType& target_type);

/// \brief Convenience for boundschecking a single Scalar vlue
/// \brief Convenience for boundschecking a single Scalar value
ARROW_EXPORT
Status IntegersCanFit(const Scalar& value, const DataType& target_type);

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/io_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ Status MemoryMapRemap(void* addr, size_t old_size, size_t new_size, int fildes,
return StatusFromMmapErrno("ftruncate failed");
}
// we set READ / WRITE flags on the new map, since we could only have
// unlarged a RW map in the first place
// enlarged a RW map in the first place
*new_addr = mmap(NULL, new_size, PROT_READ | PROT_WRITE, MAP_SHARED, fildes, 0);
if (*new_addr == MAP_FAILED) {
return StatusFromMmapErrno("mmap failed");
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct IterationTraits {
static T End() { return T(NULLPTR); }

/// \brief Checks to see if the value is a terminal value.
/// A method is used here since T is not neccesarily comparable in many
/// A method is used here since T is not necessarily comparable in many
/// cases even though it has a distinct final value
static bool IsEnd(const T& val) { return val == End(); }
};
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/list_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ARROW_EXPORT Result<std::pair<int64_t, int64_t>> RangeOfValuesUsed(
///
/// This is usually the same as the length of the RangeOfValuesUsed() range, but
/// it can be:
/// - Smaller: when the child array constains many values that are not
/// - Smaller: when the child array contains many values that are not
/// referenced by the lists or list-views in the parent array
/// - Greater: when the list-views share child array ranges
///
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ void ArrowLog::StartArrowLog(const std::string& app_name,
#ifdef ARROW_USE_GLOG
int mapped_severity_threshold = GetMappedSeverity(severity_threshold_);
google::SetStderrLogging(mapped_severity_threshold);
// Enble log file if log_dir is not empty.
// Enable log file if log_dir is not empty.
if (!log_dir.empty()) {
auto dir_ends_with_slash = log_dir;
if (log_dir[log_dir.length() - 1] != '/') {
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/ree_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ int64_t FindPhysicalIndexImpl(PhysicalIndexFinder<RunEndCType>& self, int64_t i)
DCHECK_LT(i, self.array_span.length);
const int64_t run_ends_size = ree_util::RunEndsArray(self.array_span).length;
DCHECK_LT(self.last_physical_index, run_ends_size);
// This access to self.run_ends[last_physical_index] is alwas safe because:
// This access to self.run_ends[last_physical_index] is always safe because:
// 1. 0 <= i < array_span.length() implies there is at least one run and the initial
// value 0 will be safe to index with.
// 2. last_physical_index > 0 is always the result of a valid call to
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/arrow/util/ree_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ int64_t FindPhysicalIndex(const ArraySpan& span, int64_t i, int64_t absolute_off
/// run-ends) necessary to represent the logical range of values from
/// offset to length.
///
/// Avoid calling this function if the physical length can be estabilished in
/// Avoid calling this function if the physical length can be established in
/// some other way (e.g. when iterating over the runs sequentially until the
/// end). This function uses binary-search, so it has a O(log N) cost.
template <typename RunEndCType>
Expand Down Expand Up @@ -217,7 +217,7 @@ ARROW_EXPORT int64_t FindPhysicalIndex(const ArraySpan& span, int64_t i,
/// run-ends) necessary to represent the logical range of values from
/// offset to length.
///
/// Avoid calling this function if the physical length can be estabilished in
/// Avoid calling this function if the physical length can be established in
/// some other way (e.g. when iterating over the runs sequentially until the
/// end). This function uses binary-search, so it has a O(log N) cost.
ARROW_EXPORT int64_t FindPhysicalLength(const ArraySpan& span);
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/arrow/util/ree_util_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ TYPED_TEST_P(ReeUtilTest, PhysicalLength) {
ASSERT_EQ(internal::FindPhysicalLength(run_ends246, 4, 0, 7), 0);
}

TYPED_TEST_P(ReeUtilTest, MergedRunsInterator) {
TYPED_TEST_P(ReeUtilTest, MergedRunsIteratorTest) {
// Construct the following two test arrays with a lot of different offsets to test the
// REE iterator: left:
//
Expand Down Expand Up @@ -387,7 +387,7 @@ TYPED_TEST_P(ReeUtilTest, MergedRunsInterator) {
}

REGISTER_TYPED_TEST_SUITE_P(ReeUtilTest, PhysicalIndex, PhysicalLength,
MergedRunsInterator);
MergedRunsIteratorTest);

using RunEndsTypes = testing::Types<int16_t, int32_t, int64_t>;
INSTANTIATE_TYPED_TEST_SUITE_P(ReeUtilTest, ReeUtilTest, RunEndsTypes);
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/rle_encoding.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace util {
/// on a byte boundary without padding.
/// Given that we know it is a multiple of 8, we store the number of 8-groups rather than
/// the actual number of encoded ints. (This means that the total number of encoded values
/// can not be determined from the encoded data, since the number of values in the last
/// cannot be determined from the encoded data, since the number of values in the last
/// group may not be a multiple of 8). For the last group of literal runs, we pad
/// the group to 8 with zeros. This allows for 8 at a time decoding on the read side
/// without the need for additional checks.
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/string_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ TEST(SplitString, OuterLeftAndOuterRightDelimiter) {
EXPECT_EQ(parts[4], "");
}

TEST(SplitString, OnlyDemiliter) {
TEST(SplitString, OnlyDelimiter) {
std::string input = ":";
auto parts = SplitString(input, ':');
ASSERT_EQ(parts.size(), 2);
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/tdigest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ class TDigest::TDigestImpl {
double total_weight() const { return total_weight_; }

private:
// must be delcared before merger_, see constructor initialization list
// must be declared before merger_, see constructor initialization list
const uint32_t delta_;

TDigestMerger<> merger_;
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/tdigest_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ TEST(TDigestTest, SingleValue) {
TDigest td;
td.Add(value);
ASSERT_OK(td.Validate());
// all quantiles equal to same single vaue
// all quantiles equal to same single value
for (double q = 0; q <= 1; q += 0.1) {
EXPECT_EQ(td.Quantile(q), value);
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/util/thread_pool_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ TEST_F(TestThreadPool, SetCapacity) {
}
ASSERT_OK(gating_task->WaitForRunning(3));
SleepFor(0.001); // Sleep a bit just to make sure it isn't making any threads
ASSERT_EQ(pool->GetActualCapacity(), 3); // maxxed out
ASSERT_EQ(pool->GetActualCapacity(), 3); // maxed out

// The tasks have not finished yet, increasing the desired capacity
// should spawn threads immediately.
Expand Down

0 comments on commit b3e607b

Please sign in to comment.