Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cpp/src/arrow/compute/cast.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ Result<const Kernel*> CastFunction::DispatchExact(
}
}

if (candidate_kernels.size() == 0) {
if (candidate_kernels.empty()) {
return Status::NotImplemented("Unsupported cast from ", types[0].type->ToString(),
" to ", ToTypeName(out_type_id_), " using function ",
this->name());
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/compute/exec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,7 @@ int64_t InferBatchLength(const std::vector<Datum>& values, bool* all_same) {
}
}

if (are_all_scalar && values.size() > 0) {
if (are_all_scalar && !values.empty()) {
length = 1;
} else if (length < 0) {
length = 0;
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/compute/kernels/scalar_nested.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ Result<TypeHolder> MakeStructResolve(KernelContext* ctx,
auto nullable = OptionsWrapper<MakeStructOptions>::Get(ctx).field_nullability;
auto metadata = OptionsWrapper<MakeStructOptions>::Get(ctx).field_metadata;

if (names.size() == 0) {
if (names.empty()) {
names.resize(types.size());
nullable.resize(types.size(), true);
metadata.resize(types.size(), nullptr);
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/compute/kernels/vector_replace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ struct FillNullBackwardChunked {
ArrayData* array_with_current =
values.chunk(/*first_chunk=*/chunks_length - 1)->data().get();
int64_t last_valid_value_offset = -1;
auto chunks = values.chunks();
const auto& chunks = values.chunks();
for (int i = chunks_length - 1; i >= 0; --i) {
const auto& chunk = chunks[i];
if (is_fixed_width(out->type()->id())) {
Expand Down
8 changes: 4 additions & 4 deletions cpp/src/arrow/compute/kernels/vector_select_k.cc
Original file line number Diff line number Diff line change
Expand Up @@ -481,12 +481,12 @@ class RecordBatchSelector {
first_remaining_sort_key.order,
output.non_null_like_range);
}
if (output.nan_range.size() > 0) {
if (!output.nan_range.empty()) {
// We have the last sort_key, can just copy over the null values
std::copy(p.nan_begin(), p.nan_begin() + output.nan_range.size(),
output.nan_begin());
}
if (output.null_range.size() > 0) {
if (!output.null_range.empty()) {
// We have the last sort_key, can just copy over the null values
std::copy(p.null_begin(), p.null_begin() + output.null_range.size(),
output.null_begin());
Expand All @@ -499,11 +499,11 @@ class RecordBatchSelector {
HeapSortNonNullsToOutput(p.non_null_like_range, cmp,
output.non_null_like_range);
}
if (output.nan_range.size() > 0) {
if (!output.nan_range.empty()) {
ARROW_RETURN_NOT_OK(selector_->DoSelectKForKey(start_sort_key_index_ + 1,
p.nan_range, output.nan_range));
}
if (output.null_range.size() > 0) {
if (!output.null_range.empty()) {
ARROW_RETURN_NOT_OK(selector_->DoSelectKForKey(
start_sort_key_index_ + 1, p.null_range, output.null_range));
}
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/pretty_print.cc
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class ArrayPrinter : public PrettyPrinter {
template <typename ArrayType, typename T = typename ArrayType::TypeClass>
enable_if_t<is_list_like_type<T>::value || is_list_view_type<T>::value, Status>
WriteDataValues(const ArrayType& array) {
const auto values = array.values();
const auto& values = array.values();
const auto child_options = ChildOptions();
ArrayPrinter values_printer(child_options, sink_);

Expand Down
4 changes: 2 additions & 2 deletions cpp/src/arrow/tensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ Tensor::Tensor(const std::shared_ptr<DataType>& type, const std::shared_ptr<Buff
const std::vector<std::string>& dim_names)
: type_(type), data_(data), shape_(shape), strides_(strides), dim_names_(dim_names) {
ARROW_CHECK(is_tensor_supported(type->id()));
if (shape.size() > 0 && strides.size() == 0) {
if (!shape.empty() && strides.empty()) {
ARROW_CHECK_OK(internal::ComputeRowMajorStrides(
checked_cast<const FixedWidthType&>(*type_), shape, &strides_));
}
Expand All @@ -542,7 +542,7 @@ Tensor::Tensor(const std::shared_ptr<DataType>& type, const std::shared_ptr<Buff

const std::string& Tensor::dim_name(int i) const {
static const std::string kEmpty = "";
if (dim_names_.size() == 0) {
if (dim_names_.empty()) {
return kEmpty;
} else {
ARROW_CHECK_LT(i, static_cast<int>(dim_names_.size()));
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/parquet/metadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2107,7 +2107,7 @@ class FileMetaDataBuilder::FileMetaDataBuilderImpl {
total_rows += row_group.num_rows;
}
metadata_->__set_num_rows(total_rows);
metadata_->__set_row_groups(row_groups_);
metadata_->row_groups = std::move(row_groups_);
Comment thread
Sumdiboii marked this conversation as resolved.
Resolved

if (key_value_metadata) {
ToThriftKeyValueMetadata(*key_value_metadata, metadata_.get());
Expand Down Expand Up @@ -2144,7 +2144,7 @@ class FileMetaDataBuilder::FileMetaDataBuilderImpl {
ToThrift(file_encryption_properties->algorithm()));
const std::string& footer_signing_key_metadata =
file_encryption_properties->footer_key_metadata();
if (footer_signing_key_metadata.size() > 0) {
if (!footer_signing_key_metadata.empty()) {
metadata_->__set_footer_signing_key_metadata(footer_signing_key_metadata);
}
}
Expand Down Expand Up @@ -2172,7 +2172,7 @@ class FileMetaDataBuilder::FileMetaDataBuilderImpl {

crypto_metadata_->__set_encryption_algorithm(
ToThrift(file_encryption_properties->algorithm()));
std::string key_metadata = file_encryption_properties->footer_key_metadata();
const std::string& key_metadata = file_encryption_properties->footer_key_metadata();

if (!key_metadata.empty()) {
crypto_metadata_->__set_key_metadata(key_metadata);
Expand Down
Loading