Returns the string representation of the node at indentation level.
155064 {
155065 auto indent = [](
string &str,
const idx_t n) {
155066 str.append(n, ' ');
155067 };
155068
155069 auto format_byte = [&](
uint8_t byte) {
155070 if (!options.inside_gate && options.display_ascii && byte >= 32 && byte <= 126) {
155071 return string(1, static_cast<char>(byte));
155072 }
155074 };
155077 bool propagate_gate = options.inside_gate || is_gate;
155078
155079 bool print_full_tree = propagate_gate || !options.key_path || options.depth_remaining == 0;
155080
155081 switch (type) {
155082 case NType::LEAF_INLINED: {
155083 string str = "";
155084 indent(str, options.indent_level);
155086 }
155087 case NType::LEAF: {
155088 ToStringOptions leaf_options = options;
155090 }
155091 case NType::PREFIX: {
155092 ToStringOptions prefix_options = options;
155093 prefix_options.inside_gate = propagate_gate;
155095 if (is_gate) {
155096 string s = "";
155097 indent(s, options.indent_level);
155098 s += "Gate\n";
155099 return s + str;
155100 }
155101 string s = "";
155102 return s + str;
155103 }
155104 default:
155105 break;
155106 }
155107 string str = "";
155108 indent(str, options.indent_level);
155109 str = str +
"Node" +
to_string(GetCapacity(type)) +=
"\n";
155111
155113 indent(str, options.indent_level);
155114 str += "Leaf |";
155116 while (has_byte) {
155117 str += format_byte(byte) + "|";
155118 if (byte == NumericLimits<uint8_t>::Maximum()) {
155119 break;
155120 }
155121 byte++;
155123 }
155124 str += "\n";
155125 } else {
155127 bool has_expected_byte = false;
155128 if (options.key_path && !print_full_tree && options.key_depth < options.key_path->len) {
155129 expected_byte = (*options.key_path)[options.key_depth];
155130 has_expected_byte = true;
155131 }
155132
155135 while (child) {
155136
155137
155138
155139 bool on_path = !has_expected_byte || (has_expected_byte && byte == expected_byte);
155140 if (on_path) {
155141 ToStringOptions child_options = options;
155142 child_options.indent_level = options.indent_level + options.indent_amount;
155143 child_options.inside_gate = propagate_gate;
155144 child_options.key_depth = has_expected_byte ? options.key_depth + 1 : options.key_depth;
155145 child_options.depth_remaining = (options.depth_remaining > 0) ? options.depth_remaining - 1 : 0;
155146 string c = child->ToString(art, child_options);
155147 indent(str, options.indent_level);
155148 str = str + format_byte(byte) + ",\n" + c;
155149 } else {
155150
155151
155152
155153 if (!options.structure_only) {
155154 indent(str, options.indent_level);
155155 str = str + format_byte(byte) + ", [not printed]\n";
155156 }
155157 }
155158 byte++;
155160 if (byte == NumericLimits<uint8_t>::Maximum()) {
155161 break;
155162 }
155163 }
155164 }
155165
155166 if (is_gate) {
155167 string s = "";
155168 indent(s, options.indent_level + options.indent_amount);
155169 str = "Gate\n" + s + str;
155170 }
155171 return str;
155172}
static string ToString(ART &art, const Node &node, const ToStringOptions &options)
Returns the string representation of the node using ToStringOptions.
Definition duckdb.cpp:153897
static string DeprecatedToString(ART &art, const Node &node, const ToStringOptions &options)
Definition duckdb.cpp:154464
bool GetNextByte(ART &art, uint8_t &byte) const
Get the first byte greater than or equal to the byte.
Definition duckdb.cpp:154838
row_t GetRowId() const
Get the row ID (8th to 63rd bit).
Definition duckdb.cpp:12037
GateStatus GetGateStatus() const
Returns the gate status of a node.
Definition duckdb.cpp:12046
std::string to_string(const T &value)
Definition duckdb.cpp:19425
uint64_t idx_t
a saner size_t for loop indices etc
Definition duckdb.hpp:237