MCPcopy Create free account
hub / github.com/activeloopai/deeplake / printExpression

Function printExpression

cpp/3rd_party/sql-parser/src/util/sqlhelper.cpp:127–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127void printExpression(std::ostream& s, const Expr* expr, uintmax_t numIndent)
128{
129 if (!expr) {
130 return;
131 }
132 switch (expr->type) {
133 case kExprStar:
134 inprint(s, "*", numIndent);
135 break;
136 case kExprColumnRef:
137 inprint(s, expr->name, numIndent);
138 if (expr->table) {
139 inprint(s, "Table:", numIndent + 1);
140 inprint(s, expr->table, numIndent + 2);
141 }
142 break;
143 // case kExprTableColumnRef: inprint(expr->table, expr->name, numIndent); break;
144 case kExprLiteralFloat:
145 inprint(s, expr->fval, numIndent);
146 break;
147 case kExprLiteralInt:
148 inprint(s, expr->ival, numIndent);
149 break;
150 case kExprLiteralString:
151 inprint(s, expr->name, numIndent);
152 break;
153 case kExprLiteralDate:
154 inprint(s, expr->name, numIndent);
155 break;
156 case kExprLiteralNull:
157 inprint(s, "NULL", numIndent);
158 break;
159 case kExprLiteralInterval:
160 inprint(s, "INTERVAL", numIndent);
161 inprint(s, expr->ival, numIndent + 1);
162 inprint(s, expr->datetimeField, numIndent + 1);
163 break;
164 case kExprFunctionRef:
165 inprint(s, expr->name, numIndent);
166 for (Expr* e : *expr->exprList)
167 printExpression(s, e, numIndent + 1);
168 break;
169 case kExprExtract:
170 inprint(s, "EXTRACT", numIndent);
171 inprint(s, expr->datetimeField, numIndent + 1);
172 printExpression(s, expr->expr, numIndent + 1);
173 break;
174 case kExprCast:
175 inprint(s, "CAST", numIndent);
176 inprint(s, expr->columnType, numIndent + 1);
177 printExpression(s, expr->expr, numIndent + 1);
178 break;
179 case kExprOperator:
180 printOperatorExpression(s, expr, numIndent);
181 break;
182 case kExprSelect:
183 printSelectStatementInfo(s, expr->select, numIndent);
184 break;

Callers 6

printTableRefInfoFunction · 0.85
printOperatorExpressionFunction · 0.85
printOrderByFunction · 0.85
printSelectStatementInfoFunction · 0.85
printInsertStatementInfoFunction · 0.85
expression_to_stringFunction · 0.85

Calls 3

inprintFunction · 0.85
printOperatorExpressionFunction · 0.85
printSelectStatementInfoFunction · 0.85

Tested by

no test coverage detected