MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / formatConstant

Function formatConstant

src/Processors/QueryPlan/QueryPlanFormat.cpp:202–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

200 }
201
202 String formatConstant(const ActionsDAG::Node * node)
203 {
204 if (!node->column)
205 return node->result_name;
206
207 if (node->result_type && WhichDataType(node->result_type).isSet())
208 return node->result_name;
209
210 /// node->column is a size-0 ColumnConst; read the value from its data column.
211 const auto & data_col = node->column->getDataColumnPtr();
212 WhichDataType data_type(node->result_type);
213
214 if (data_type.isDateOrDate32OrTimeOrTime64OrDateTimeOrDateTime64())
215 {
216 WriteBufferFromOwnString buf;
217 writeChar('\'', buf);
218 node->result_type->getDefaultSerialization()->serializeText(*data_col, 0, buf, {});
219 writeChar('\'', buf);
220 return buf.str();
221 }
222
223 Field value;
224 data_col->get(0, value);
225 return applyVisitor(FieldVisitorToString(), value);
226 }
227
228 String getRuntimeFilterId(const ActionsDAG::Node * node)
229 {

Callers 1

formatNodePrettyFunction · 0.85

Calls 10

WhichDataTypeClass · 0.85
writeCharFunction · 0.85
applyVisitorFunction · 0.85
isSetMethod · 0.45
serializeTextMethod · 0.45
strMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected