337099 {
337100 auto op = ExpressionTypeToOperator(entry.GetExpressionType());
337101 if (!op.empty()) {
337102
337103 D_ASSERT(entry.children.size() == 2);
337104 return entry.children[0]->ToString() + " " + op + " " + entry.children[1]->ToString();
337105 }
337106 switch (entry.GetExpressionType()) {
337107 case ExpressionType::COMPARE_IN:
337108 case ExpressionType::COMPARE_NOT_IN: {
337109 string op_type = entry.GetExpressionType() == ExpressionType::COMPARE_IN ? " IN " : " NOT IN ";
337110 string in_child = entry.children[0]->ToString();
337111 string child_list = "(";
337112 for (
idx_t i = 1; i < entry.children.size(); i++) {
337113 if (i > 1) {
337114 child_list += ", ";
337115 }
337116 child_list += entry.children[i]->ToString();
337117 }
337118 child_list += ")";
337119 return "(" + in_child + op_type + child_list + ")";
337120 }
337121 case ExpressionType::OPERATOR_UNPACK: {
337123 }
337124 case ExpressionType::OPERATOR_TRY: {
337126 }
337127 case ExpressionType::OPERATOR_NOT: {
337128 string result = "(";
337129 result += ExpressionTypeToString(entry.GetExpressionType());
337130 result += " ";
337132 [](const unique_ptr<BASE> &child) { return child->ToString(); });
337133 result += ")";
337134 return result;
337135 }
337136 case ExpressionType::GROUPING_FUNCTION:
337137 case ExpressionType::OPERATOR_COALESCE: {
337138 string result = ExpressionTypeToString(entry.GetExpressionType());
337139 result += "(";
337141 [](const unique_ptr<BASE> &child) { return child->ToString(); });
337142 result += ")";
337143 return result;
337144 }
337145 case ExpressionType::OPERATOR_IS_NULL:
337146 return "(" + entry.children[0]->ToString() + " IS NULL)";
337147 case ExpressionType::OPERATOR_IS_NOT_NULL:
337148 return "(" + entry.children[0]->ToString() + " IS NOT NULL)";
337149 case ExpressionType::ARRAY_EXTRACT:
337150 return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + "]";
337151 case ExpressionType::ARRAY_SLICE: {
337152 string begin = entry.children[1]->ToString();
337153 if (begin == "[]") {
337154 begin = "";
337155 }
337156 string end = entry.children[2]->ToString();
337157 if (end == "[]") {
337158 if (entry.children.size() == 4) {
337159 end = "-";
337160 } else {
337161 end = "";
337162 }
337163 }
337164 if (entry.children.size() == 4) {
337165 return entry.children[0]->ToString() + "[" + begin + ":" + end + ":" + entry.children[3]->ToString() +
337166 "]";
337167 }
337168 return entry.children[0]->ToString() + "[" + begin + ":" + end + "]";
337169 }
337170 case ExpressionType::STRUCT_EXTRACT: {
337171 if (entry.children[1]->GetExpressionType() != ExpressionType::VALUE_CONSTANT) {
337172 return string();
337173 }
337174 auto child_string = entry.children[1]->ToString();
337175 D_ASSERT(child_string.size() >= 3);
337176 D_ASSERT(child_string[0] == '\'' && child_string[child_string.size() - 1] == '\'');
337178 SQLIdentifier(child_string.substr(1, child_string.size() - 2)));
337179 }
337180 case ExpressionType::ARRAY_CONSTRUCTOR: {
337181 string result = "(ARRAY[";
337183 [](const unique_ptr<BASE> &child) { return child->ToString(); });
337184 result += "])";
337185 return result;
337186 }
337187 default:
337188 throw InternalException("Unrecognized operator type");
337189 }
337190 }
static string Format(const string fmt_str, ARGS... params)
Format a string using printf semantics.
Definition duckdb.hpp:4002
static DUCKDB_API string Join(const vector< string > &input, const string &separator)
Join multiple strings into one string. Components are concatenated by the given separator.
Definition duckdb.cpp:109497