MCPcopy Create free account
hub / github.com/ByConity/ByConity / executeImpl

Method executeImpl

src/Functions/formatRow.cpp:51–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49 ColumnNumbers getArgumentsThatAreAlwaysConstant() const override { return {0}; }
50
51 ColumnPtr executeImpl(const ColumnsWithTypeAndName & arguments, const DataTypePtr &, size_t input_rows_count) const override
52 {
53 auto col_str = ColumnString::create();
54 ColumnString::Chars & vec = col_str->getChars();
55 WriteBufferFromVector buffer(vec);
56 ColumnString::Offsets & offsets = col_str->getOffsets();
57 offsets.resize(input_rows_count);
58 Block arg_columns;
59 for (auto i = 1u; i < arguments.size(); ++i)
60 arg_columns.insert(arguments[i]);
61 materializeBlockInplace(arg_columns);
62 auto out = FormatFactory::instance().getOutputFormat(format_name, buffer, arg_columns, context, [&](const Columns &, size_t row)
63 {
64 if constexpr (no_newline)
65 {
66 // replace '\n' with '\0'
67 if (buffer.position() != buffer.buffer().begin() && buffer.position()[-1] == '\n')
68 buffer.position()[-1] = '\0';
69 }
70 else
71 writeChar('\0', buffer);
72 offsets[row] = buffer.count();
73 });
74 out->write(arg_columns);
75 return col_str;
76 }
77
78private:
79 String format_name;

Callers

nothing calls this directly

Calls 13

materializeBlockInplaceFunction · 0.85
writeCharFunction · 0.85
bufferMethod · 0.80
createFunction · 0.70
getOffsetsMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45
insertMethod · 0.45
getOutputFormatMethod · 0.45
positionMethod · 0.45
beginMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected