Skip to content
Closed
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
53 changes: 14 additions & 39 deletions cpp/apidoc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -833,50 +833,17 @@ INPUT_ENCODING = UTF-8
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf.

FILE_PATTERNS = *.c \
*.cc \
*.cxx \
*.cpp \
*.c++ \
*.java \
*.ii \
*.ixx \
*.ipp \
*.i++ \
*.inl \
*.idl \
*.ddl \
*.odl \
*.h \
FILE_PATTERNS = *.h \
*.hh \
*.hxx \
*.hpp \
*.h++ \
*.cs \
*.d \
*.php \
*.php4 \
*.php5 \
*.phtml \
*.inc \
*.m \
*.markdown \
*.md \
*.mm \
*.dox \
*.py \
*.pyw \
*.f90 \
*.f95 \
*.f03 \
*.f08 \
*.f \
*.for \
*.tcl \
*.vhd \
*.vhdl \
*.ucf \
*.qsf
*.py

# The RECURSIVE tag can be used to specify whether or not subdirectories should
# be searched for input files as well.
Expand Down Expand Up @@ -908,6 +875,7 @@ EXCLUDE_SYMLINKS = NO
# exclude all test directories for example use the pattern */test/*

EXCLUDE_PATTERNS = *-test.cc \
*test* \
*_generated.h \
*-benchmark.cc

Expand All @@ -920,7 +888,11 @@ EXCLUDE_PATTERNS = *-test.cc \
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories use the pattern */test/*

EXCLUDE_SYMBOLS =
EXCLUDE_SYMBOLS = detail
EXCLUDE_SYMBOLS += internal
EXCLUDE_SYMBOLS += _*
EXCLUDE_SYMBOLS += BitUtil
EXCLUDE_SYMBOLS += SSEUtil

# The EXAMPLE_PATH tag can be used to specify one or more files or directories
# that contain example code fragments that are included (see the \include
Expand Down Expand Up @@ -2060,15 +2032,15 @@ ENABLE_PREPROCESSING = YES
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

MACRO_EXPANSION = NO
MACRO_EXPANSION = YES

# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
# the macro expansion is limited to the macros specified with the PREDEFINED and
# EXPAND_AS_DEFINED tags.
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

EXPAND_ONLY_PREDEF = NO
EXPAND_ONLY_PREDEF = YES

# If the SEARCH_INCLUDES tag is set to YES, the include files in the
# INCLUDE_PATH will be searched if a #include is found.
Expand Down Expand Up @@ -2100,7 +2072,10 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.

PREDEFINED =
PREDEFINED = __attribute__(x)= \
__declspec(x)= \
ARROW_EXPORT= \
ARROW_EXTERN_TEMPLATE=

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
Expand Down
8 changes: 6 additions & 2 deletions cpp/build-support/run_clang_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,9 @@
# exit 1
# fi

subprocess.check_output([CLANG_FORMAT, '-i'] + files_to_format,
stderr=subprocess.STDOUT)
try:
subprocess.check_output([CLANG_FORMAT, '-i'] + files_to_format,
stderr=subprocess.STDOUT)
except Exception as e:
print(e)
raise
3 changes: 3 additions & 0 deletions cpp/src/arrow/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,7 @@
#include "arrow/type.h"
#include "arrow/visitor.h"

/// \brief Top-level namespace for Apache Arrow C++ API
namespace arrow {}

#endif // ARROW_API_H
8 changes: 4 additions & 4 deletions cpp/src/arrow/array-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2042,9 +2042,9 @@ class TestStructBuilder : public TestBuilder {
auto list_type = list(char_type);

vector<std::shared_ptr<DataType>> types = {list_type, int32_type};
vector<FieldPtr> fields;
fields.push_back(FieldPtr(new Field("list", list_type)));
fields.push_back(FieldPtr(new Field("int", int32_type)));
vector<std::shared_ptr<Field>> fields;
fields.push_back(field("list", list_type));
fields.push_back(field("int", int32_type));

type_ = struct_(fields);
value_fields_ = fields;
Expand All @@ -2062,7 +2062,7 @@ class TestStructBuilder : public TestBuilder {
}

protected:
vector<FieldPtr> value_fields_;
vector<std::shared_ptr<Field>> value_fields_;
std::shared_ptr<DataType> type_;

std::shared_ptr<StructBuilder> builder_;
Expand Down
6 changes: 5 additions & 1 deletion cpp/src/arrow/array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,8 @@ Status Array::Accept(ArrayVisitor* visitor) const {
// ----------------------------------------------------------------------
// Implement Array::Validate as inline visitor

namespace internal {

struct ValidateVisitor {
Status Visit(const NullArray& array) { return Status::OK(); }

Expand Down Expand Up @@ -658,8 +660,10 @@ struct ValidateVisitor {
}
};

} // namespace internal

Status ValidateArray(const Array& array) {
ValidateVisitor validate_visitor;
internal::ValidateVisitor validate_visitor;
return VisitArrayInline(array, &validate_visitor);
}

Expand Down
102 changes: 52 additions & 50 deletions cpp/src/arrow/builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@

namespace arrow {

using internal::AdaptiveIntBuilderBase;
using internal::ArrayData;
using internal::WrappedBinary;

Status ArrayBuilder::AppendToBitmap(bool is_valid) {
if (length_ == capacity_) {
// If the capacity was not already a multiple of 2, do so here
Expand Down Expand Up @@ -338,7 +342,7 @@ Status AdaptiveIntBuilder::Append(const int64_t* values, int64_t length,
uint8_t new_int_size = int_size_;
for (int64_t i = 0; i < length; i++) {
if (valid_bytes == nullptr || valid_bytes[i]) {
new_int_size = expanded_int_size(values[i], new_int_size);
new_int_size = internal::ExpandedIntSize(values[i], new_int_size);
}
}
if (new_int_size != int_size_) {
Expand Down Expand Up @@ -495,7 +499,7 @@ Status AdaptiveUIntBuilder::Append(const uint64_t* values, int64_t length,
uint8_t new_int_size = int_size_;
for (int64_t i = 0; i < length; i++) {
if (valid_bytes == nullptr || valid_bytes[i]) {
new_int_size = expanded_uint_size(values[i], new_int_size);
new_int_size = internal::ExpandedUIntSize(values[i], new_int_size);
}
}
if (new_int_size != int_size_) {
Expand Down Expand Up @@ -861,48 +865,47 @@ Status DictionaryBuilder<T>::AppendDictionary(const Scalar& value) {
return dict_builder_.Append(value);
}

#define BINARY_DICTIONARY_SPECIALIZATIONS(Type) \
template <> \
internal::WrappedBinary DictionaryBuilder<Type>::GetDictionaryValue(int64_t index) { \
int32_t v_len; \
const uint8_t* v = dict_builder_.GetValue(static_cast<int64_t>(index), &v_len); \
return internal::WrappedBinary(v, v_len); \
} \
\
template <> \
Status DictionaryBuilder<Type>::AppendDictionary( \
const internal::WrappedBinary& value) { \
return dict_builder_.Append(value.ptr_, value.length_); \
} \
\
template <> \
Status DictionaryBuilder<Type>::AppendArray(const Array& array) { \
const BinaryArray& binary_array = static_cast<const BinaryArray&>(array); \
internal::WrappedBinary value(nullptr, 0); \
for (int64_t i = 0; i < array.length(); i++) { \
if (array.IsNull(i)) { \
RETURN_NOT_OK(AppendNull()); \
} else { \
value.ptr_ = binary_array.GetValue(i, &value.length_); \
RETURN_NOT_OK(Append(value)); \
} \
} \
return Status::OK(); \
} \
\
template <> \
int DictionaryBuilder<Type>::HashValue(const internal::WrappedBinary& value) { \
return HashUtil::Hash(value.ptr_, value.length_, 0); \
} \
\
template <> \
bool DictionaryBuilder<Type>::SlotDifferent(hash_slot_t index, \
const internal::WrappedBinary& value) { \
int32_t other_length; \
const uint8_t* other_value = \
dict_builder_.GetValue(static_cast<int64_t>(index), &other_length); \
return !(other_length == value.length_ && \
0 == memcmp(other_value, value.ptr_, value.length_)); \
#define BINARY_DICTIONARY_SPECIALIZATIONS(Type) \
template <> \
WrappedBinary DictionaryBuilder<Type>::GetDictionaryValue(int64_t index) { \
int32_t v_len; \
const uint8_t* v = dict_builder_.GetValue(static_cast<int64_t>(index), &v_len); \
return WrappedBinary(v, v_len); \
} \
\
template <> \
Status DictionaryBuilder<Type>::AppendDictionary(const WrappedBinary& value) { \
return dict_builder_.Append(value.ptr_, value.length_); \
} \
\
template <> \
Status DictionaryBuilder<Type>::AppendArray(const Array& array) { \
const BinaryArray& binary_array = static_cast<const BinaryArray&>(array); \
WrappedBinary value(nullptr, 0); \
for (int64_t i = 0; i < array.length(); i++) { \
if (array.IsNull(i)) { \
RETURN_NOT_OK(AppendNull()); \
} else { \
value.ptr_ = binary_array.GetValue(i, &value.length_); \
RETURN_NOT_OK(Append(value)); \
} \
} \
return Status::OK(); \
} \
\
template <> \
int DictionaryBuilder<Type>::HashValue(const WrappedBinary& value) { \
return HashUtil::Hash(value.ptr_, value.length_, 0); \
} \
\
template <> \
bool DictionaryBuilder<Type>::SlotDifferent(hash_slot_t index, \
const WrappedBinary& value) { \
int32_t other_length; \
const uint8_t* other_value = \
dict_builder_.GetValue(static_cast<int64_t>(index), &other_length); \
return !(other_length == value.length_ && \
0 == memcmp(other_value, value.ptr_, value.length_)); \
}

BINARY_DICTIONARY_SPECIALIZATIONS(StringType);
Expand Down Expand Up @@ -1132,7 +1135,7 @@ Status BinaryBuilder::AppendNull() {
return Status::OK();
}

Status BinaryBuilder::FinishInternal(std::shared_ptr<internal::ArrayData>* out) {
Status BinaryBuilder::FinishInternal(std::shared_ptr<ArrayData>* out) {
// Write final offset (values length)
RETURN_NOT_OK(AppendNextOffset());
std::shared_ptr<Buffer> offsets, value_data;
Expand All @@ -1141,13 +1144,12 @@ Status BinaryBuilder::FinishInternal(std::shared_ptr<internal::ArrayData>* out)
RETURN_NOT_OK(value_data_builder_.Finish(&value_data));

BufferVector buffers = {null_bitmap_, offsets, value_data};
*out = std::make_shared<internal::ArrayData>(type_, length_, std::move(buffers),
null_count_, 0);
*out = std::make_shared<ArrayData>(type_, length_, std::move(buffers), null_count_, 0);
return Status::OK();
}

Status BinaryBuilder::Finish(std::shared_ptr<Array>* out) {
std::shared_ptr<internal::ArrayData> data;
std::shared_ptr<ArrayData> data;
RETURN_NOT_OK(FinishInternal(&data));
*out = std::make_shared<BinaryArray>(data);
Reset();
Expand All @@ -1174,7 +1176,7 @@ const uint8_t* BinaryBuilder::GetValue(int64_t i, int32_t* out_length) const {
StringBuilder::StringBuilder(MemoryPool* pool) : BinaryBuilder(pool, utf8()) {}

Status StringBuilder::Finish(std::shared_ptr<Array>* out) {
std::shared_ptr<internal::ArrayData> data;
std::shared_ptr<ArrayData> data;
RETURN_NOT_OK(FinishInternal(&data));
*out = std::make_shared<StringArray>(data);
Reset();
Expand Down Expand Up @@ -1299,7 +1301,7 @@ Status MakeBuilder(MemoryPool* pool, const std::shared_ptr<DataType>& type,
}

case Type::STRUCT: {
const std::vector<FieldPtr>& fields = type->children();
const std::vector<std::shared_ptr<Field>>& fields = type->children();
std::vector<std::unique_ptr<ArrayBuilder>> values_builder;

for (auto it : fields) {
Expand Down
Loading