MCPcopy Create free account
hub / github.com/apache/arrow / TestSession

Function TestSession

python/pyarrow/src/arrow/python/gdb.cc:74–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72} // namespace
73
74void TestSession() {
75 // We define local variables for all types for which we want to test
76 // pretty-printing.
77 // Then, at the end of this function, we trap to the debugger, so that
78 // test instrumentation can print values from this frame by interacting
79 // with the debugger.
80 // The test instrumentation is in pyarrow/tests/test_gdb.py
81
82#ifdef __clang__
83 _Pragma("clang diagnostic push");
84 _Pragma("clang diagnostic ignored \"-Wunused-variable\"");
85#elif defined(__GNUC__)
86 _Pragma("GCC diagnostic push");
87 _Pragma("GCC diagnostic ignored \"-Wunused-variable\"");
88#endif
89
90 arrow::DummyFunction();
91
92 // Status & Result
93 auto ok_status = Status::OK();
94 auto error_status = Status::IOError("This is an error");
95 auto error_detail_status =
96 error_status.WithDetail(std::make_shared<CustomStatusDetail>());
97 auto ok_result = Result<int>(42);
98 auto error_result = Result<int>(error_status);
99 auto error_detail_result = Result<int>(error_detail_status);
100
101 // String views
102 std::string_view string_view_abc{"abc"};
103 std::string special_chars = std::string("foo\"bar") + '\x00' + "\r\n\t\x1f";
104 std::string_view string_view_special_chars(special_chars);
105
106 // Buffers
107 Buffer buffer_null{nullptr, 0};
108 Buffer buffer_abc{string_view_abc};
109 Buffer buffer_special_chars{string_view_special_chars};
110 char mutable_array[3] = {'a', 'b', 'c'};
111 MutableBuffer buffer_mutable{reinterpret_cast<uint8_t*>(mutable_array), 3};
112 auto heap_buffer = std::make_shared<Buffer>(string_view_abc);
113 auto heap_buffer_mutable = *AllocateBuffer(buffer_abc.size());
114 memcpy(heap_buffer_mutable->mutable_data(), buffer_abc.data(), buffer_abc.size());
115
116 // KeyValueMetadata
117 auto empty_metadata = key_value_metadata({}, {});
118 auto metadata = key_value_metadata(
119 {"key_text", "key_binary"}, {"some value", std::string("z") + '\x00' + "\x1f\xff"});
120
121 // Decimals
122 Decimal128 decimal128_zero{};
123 Decimal128 decimal128_pos{"98765432109876543210987654321098765432"};
124 Decimal128 decimal128_neg{"-98765432109876543210987654321098765432"};
125 BasicDecimal128 basic_decimal128_zero{};
126 BasicDecimal128 basic_decimal128_pos{decimal128_pos.native_endian_array()};
127 BasicDecimal128 basic_decimal128_neg{decimal128_neg.native_endian_array()};
128 Decimal256 decimal256_zero{};
129 Decimal256 decimal256_pos{
130 "9876543210987654321098765432109876543210987654321098765432109876543210987654"};
131 Decimal256 decimal256_neg{

Callers

nothing calls this directly

Calls 15

DummyFunctionFunction · 0.85
IOErrorFunction · 0.85
key_value_metadataFunction · 0.85
fixed_size_binaryFunction · 0.85
listFunction · 0.85
large_listFunction · 0.85
fixed_size_listFunction · 0.85
mapFunction · 0.85
struct_Function · 0.85
MakeNullScalarFunction · 0.85
MakeScalarFunction · 0.85
decimal256Function · 0.85

Tested by

no test coverage detected