Created
March 16, 2020 23:28
-
-
Save kou/6b04907878ac0f302888c85ede6bb94a to your computer and use it in GitHub Desktop.
Apache Arrow with clang-format-8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- /arrow/cpp/src/parquet/types.cc | |
+++ /arrow/cpp/src/parquet/types.cc (after clang format) | |
@@ -945,7 +945,9 @@ | |
case parquet::Type::BYTE_ARRAY: { | |
ok = true; | |
} break; | |
- default: { } break; } | |
+ default: { | |
+ } break; | |
+ } | |
return ok; | |
} | |
--- /arrow/cpp/src/gandiva/decimal_ir.cc | |
+++ /arrow/cpp/src/gandiva/decimal_ir.cc (after clang format) | |
@@ -308,9 +308,9 @@ | |
auto ret = AddWithOverflowCheck(x, y, out); | |
// if there is an overflow, switch to the AddLarge codepath. | |
- return BuildIfElse(ret.overflow(), types()->i128_type(), | |
- [&] { return AddLarge(x, y, out); }, | |
- [&] { return ret.value(); }); | |
+ return BuildIfElse( | |
+ ret.overflow(), types()->i128_type(), [&] { return AddLarge(x, y, out); }, | |
+ [&] { return ret.value(); }); | |
} else { | |
return AddLarge(x, y, out); | |
} | |
--- /arrow/cpp/src/arrow/util/hashing.h | |
+++ /arrow/cpp/src/arrow/util/hashing.h (after clang format) | |
@@ -426,7 +426,8 @@ | |
} | |
Status GetOrInsert(const Scalar& value, int32_t* out_memo_index) { | |
- return GetOrInsert(value, [](int32_t i) {}, [](int32_t i) {}, out_memo_index); | |
+ return GetOrInsert( | |
+ value, [](int32_t i) {}, [](int32_t i) {}, out_memo_index); | |
} | |
int32_t GetNull() const { return null_index_; } | |
@@ -535,7 +536,8 @@ | |
} | |
Status GetOrInsert(const Scalar value, int32_t* out_memo_index) { | |
- return GetOrInsert(value, [](int32_t i) {}, [](int32_t i) {}, out_memo_index); | |
+ return GetOrInsert( | |
+ value, [](int32_t i) {}, [](int32_t i) {}, out_memo_index); | |
} | |
int32_t GetNull() const { return value_to_index_[cardinality]; } | |
@@ -648,7 +650,8 @@ | |
Status GetOrInsert(const void* data, builder_offset_type length, | |
int32_t* out_memo_index) { | |
- return GetOrInsert(data, length, [](int32_t i) {}, [](int32_t i) {}, out_memo_index); | |
+ return GetOrInsert( | |
+ data, length, [](int32_t i) {}, [](int32_t i) {}, out_memo_index); | |
} | |
Status GetOrInsert(const util::string_view& value, int32_t* out_memo_index) { | |
--- /arrow/cpp/src/arrow/adapters/orc/adapter_util.cc | |
+++ /arrow/cpp/src/arrow/adapters/orc/adapter_util.cc (after clang format) | |
@@ -418,7 +418,9 @@ | |
*out = union_(fields, type_codes); | |
break; | |
} | |
- default: { return Status::Invalid("Unknown Orc type kind: ", kind); } | |
+ default: { | |
+ return Status::Invalid("Unknown Orc type kind: ", kind); | |
+ } | |
} | |
return Status::OK(); | |
} | |
--- /arrow/cpp/src/arrow/dbi/hiveserver2/thrift_internal.cc | |
+++ /arrow/cpp/src/arrow/dbi/hiveserver2/thrift_internal.cc (after clang format) | |
@@ -204,7 +204,9 @@ | |
return Status::IOError(tstatus.errorMessage); | |
case hs2::TStatusCode::INVALID_HANDLE_STATUS: | |
return Status::Invalid("Invalid handle"); | |
- default: { return Status::UnknownError("Unknown TStatusCode ", tstatus.statusCode); } | |
+ default: { | |
+ return Status::UnknownError("Unknown TStatusCode ", tstatus.statusCode); | |
+ } | |
} | |
} | |
--- /arrow/cpp/src/arrow/io/memory_benchmark.cc | |
+++ /arrow/cpp/src/arrow/io/memory_benchmark.cc (after clang format) | |
@@ -51,10 +51,10 @@ | |
#define VectorSet _mm512_set1_epi32 | |
#define VectorLoad _mm512_stream_load_si512 | |
#define VectorLoadAsm(SRC, DST) \ | |
- asm volatile("vmovaps %[src], %[dst]" : [dst] "=v"(DST) : [src] "m"(SRC) :) | |
+ asm volatile("vmovaps %[src], %[dst]" : [ dst ] "=v"(DST) : [ src ] "m"(SRC) :) | |
#define VectorStreamLoad _mm512_stream_load_si512 | |
#define VectorStreamLoadAsm(SRC, DST) \ | |
- asm volatile("vmovntdqa %[src], %[dst]" : [dst] "=v"(DST) : [src] "m"(SRC) :) | |
+ asm volatile("vmovntdqa %[src], %[dst]" : [ dst ] "=v"(DST) : [ src ] "m"(SRC) :) | |
#define VectorStreamWrite _mm512_stream_si512 | |
#else | |
@@ -65,10 +65,10 @@ | |
#define VectorSet _mm256_set1_epi32 | |
#define VectorLoad _mm256_stream_load_si256 | |
#define VectorLoadAsm(SRC, DST) \ | |
- asm volatile("vmovaps %[src], %[dst]" : [dst] "=v"(DST) : [src] "m"(SRC) :) | |
+ asm volatile("vmovaps %[src], %[dst]" : [ dst ] "=v"(DST) : [ src ] "m"(SRC) :) | |
#define VectorStreamLoad _mm256_stream_load_si256 | |
#define VectorStreamLoadAsm(SRC, DST) \ | |
- asm volatile("vmovntdqa %[src], %[dst]" : [dst] "=v"(DST) : [src] "m"(SRC) :) | |
+ asm volatile("vmovntdqa %[src], %[dst]" : [ dst ] "=v"(DST) : [ src ] "m"(SRC) :) | |
#define VectorStreamWrite _mm256_stream_si256 | |
#else // ARROW_AVX2 not set | |
@@ -77,10 +77,10 @@ | |
#define VectorSet _mm_set1_epi32 | |
#define VectorLoad _mm_stream_load_si128 | |
#define VectorLoadAsm(SRC, DST) \ | |
- asm volatile("movaps %[src], %[dst]" : [dst] "=x"(DST) : [src] "m"(SRC) :) | |
+ asm volatile("movaps %[src], %[dst]" : [ dst ] "=x"(DST) : [ src ] "m"(SRC) :) | |
#define VectorStreamLoad _mm_stream_load_si128 | |
#define VectorStreamLoadAsm(SRC, DST) \ | |
- asm volatile("movntdqa %[src], %[dst]" : [dst] "=x"(DST) : [src] "m"(SRC) :) | |
+ asm volatile("movntdqa %[src], %[dst]" : [ dst ] "=x"(DST) : [ src ] "m"(SRC) :) | |
#define VectorStreamWrite _mm_stream_si128 | |
#endif // ARROW_AVX2 | |
@@ -166,14 +166,14 @@ | |
static void armv8_stream_load_pair(VectorType* src, VectorType* dst) { | |
asm volatile("LDNP %[reg1], %[reg2], [%[from]]\n\t" | |
- : [reg1] "+r"(*dst), [reg2] "+r"(*(dst + 1)) | |
- : [from] "r"(src)); | |
+ : [ reg1 ] "+r"(*dst), [ reg2 ] "+r"(*(dst + 1)) | |
+ : [ from ] "r"(src)); | |
} | |
static void armv8_stream_store_pair(VectorType* src, VectorType* dst) { | |
asm volatile("STNP %[reg1], %[reg2], [%[to]]\n\t" | |
- : [to] "+r"(dst) | |
- : [reg1] "r"(*src), [reg2] "r"(*(src + 1)) | |
+ : [ to ] "+r"(dst) | |
+ : [ reg1 ] "r"(*src), [ reg2 ] "r"(*(src + 1)) | |
: "memory"); | |
} | |
@@ -181,7 +181,7 @@ | |
asm volatile( | |
"LDNP q1, q2, [%[from]]\n\t" | |
"STNP q1, q2, [%[to]]\n\t" | |
- : [from] "+r"(src), [to] "+r"(dst) | |
+ : [ from ] "+r"(src), [ to ] "+r"(dst) | |
: | |
: "memory", "v0", "v1", "v2", "v3"); | |
} | |
--- /arrow/cpp/src/arrow/ipc/test_common.cc | |
+++ /arrow/cpp/src/arrow/ipc/test_common.cc (after clang format) | |
@@ -103,9 +103,10 @@ | |
// Force invariants | |
const auto child_length = static_cast<offset_type>(child_array->length()); | |
offsets[0] = 0; | |
- std::replace_if(offsets.begin(), offsets.end(), | |
- [child_length](offset_type offset) { return offset > child_length; }, | |
- child_length); | |
+ std::replace_if( | |
+ offsets.begin(), offsets.end(), | |
+ [child_length](offset_type offset) { return offset > child_length; }, | |
+ child_length); | |
} | |
offsets[num_lists] = static_cast<offset_type>(child_array->length()); | |
--- /arrow/cpp/src/arrow/python/deserialize.cc | |
+++ /arrow/cpp/src/arrow/python/deserialize.cc (after clang format) | |
@@ -211,7 +211,9 @@ | |
*result = wrap_buffer(blobs.buffers[ref]); | |
return Status::OK(); | |
} | |
- default: { ARROW_CHECK(false) << "union tag " << type << "' not recognized"; } | |
+ default: { | |
+ ARROW_CHECK(false) << "union tag " << type << "' not recognized"; | |
+ } | |
} | |
return Status::OK(); | |
} | |
@@ -265,41 +267,44 @@ | |
Status DeserializeList(PyObject* context, const Array& array, int64_t start_idx, | |
int64_t stop_idx, PyObject* base, const SerializedPyObject& blobs, | |
PyObject** out) { | |
- return DeserializeSequence(context, array, start_idx, stop_idx, base, blobs, | |
- [](int64_t size) { return PyList_New(size); }, | |
- [](PyObject* seq, int64_t index, PyObject* item) { | |
- PyList_SET_ITEM(seq, index, item); | |
- return Status::OK(); | |
- }, | |
- out); | |
+ return DeserializeSequence( | |
+ context, array, start_idx, stop_idx, base, blobs, | |
+ [](int64_t size) { return PyList_New(size); }, | |
+ [](PyObject* seq, int64_t index, PyObject* item) { | |
+ PyList_SET_ITEM(seq, index, item); | |
+ return Status::OK(); | |
+ }, | |
+ out); | |
} | |
Status DeserializeTuple(PyObject* context, const Array& array, int64_t start_idx, | |
int64_t stop_idx, PyObject* base, const SerializedPyObject& blobs, | |
PyObject** out) { | |
- return DeserializeSequence(context, array, start_idx, stop_idx, base, blobs, | |
- [](int64_t size) { return PyTuple_New(size); }, | |
- [](PyObject* seq, int64_t index, PyObject* item) { | |
- PyTuple_SET_ITEM(seq, index, item); | |
- return Status::OK(); | |
- }, | |
- out); | |
+ return DeserializeSequence( | |
+ context, array, start_idx, stop_idx, base, blobs, | |
+ [](int64_t size) { return PyTuple_New(size); }, | |
+ [](PyObject* seq, int64_t index, PyObject* item) { | |
+ PyTuple_SET_ITEM(seq, index, item); | |
+ return Status::OK(); | |
+ }, | |
+ out); | |
} | |
Status DeserializeSet(PyObject* context, const Array& array, int64_t start_idx, | |
int64_t stop_idx, PyObject* base, const SerializedPyObject& blobs, | |
PyObject** out) { | |
- return DeserializeSequence(context, array, start_idx, stop_idx, base, blobs, | |
- [](int64_t size) { return PySet_New(nullptr); }, | |
- [](PyObject* seq, int64_t index, PyObject* item) { | |
- int err = PySet_Add(seq, item); | |
- Py_DECREF(item); | |
- if (err < 0) { | |
- RETURN_IF_PYERROR(); | |
- } | |
- return Status::OK(); | |
- }, | |
- out); | |
+ return DeserializeSequence( | |
+ context, array, start_idx, stop_idx, base, blobs, | |
+ [](int64_t size) { return PySet_New(nullptr); }, | |
+ [](PyObject* seq, int64_t index, PyObject* item) { | |
+ int err = PySet_Add(seq, item); | |
+ Py_DECREF(item); | |
+ if (err < 0) { | |
+ RETURN_IF_PYERROR(); | |
+ } | |
+ return Status::OK(); | |
+ }, | |
+ out); | |
} | |
Status ReadSerializedObject(io::RandomAccessFile* src, SerializedPyObject* out) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment