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

Method parse

src/Interpreters/DDLTask.cpp:116–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116void DDLLogEntry::parse(const String & data)
117{
118 ReadBufferFromString rb(data);
119
120 rb >> "version: " >> version >> "\n";
121 assertVersion();
122
123 Strings host_id_strings;
124 rb >> "query: " >> escape >> query >> "\n";
125 if (version == 1)
126 {
127 rb >> "hosts: " >> host_id_strings >> "\n";
128
129 if (!rb.eof())
130 rb >> "initiator: " >> initiator >> "\n";
131 else
132 initiator.clear();
133 }
134 else if (version == 2)
135 {
136
137 if (!rb.eof() && *rb.position() == 'h')
138 rb >> "hosts: " >> host_id_strings >> "\n";
139 if (!rb.eof() && *rb.position() == 'i')
140 rb >> "initiator: " >> initiator >> "\n";
141 if (!rb.eof() && *rb.position() == 's')
142 {
143 String settings_str;
144 rb >> "settings: " >> settings_str >> "\n";
145 ParserSetQuery parser{true};
146 constexpr UInt64 max_size = 4096;
147 constexpr UInt64 max_depth = 16;
148 ASTPtr settings_ast = parseQuery(parser, settings_str, max_size, max_depth);
149 settings.emplace(std::move(settings_ast->as<ASTSetQuery>()->changes));
150 }
151 }
152
153 assertEOF(rb);
154
155 if (!host_id_strings.empty())
156 {
157 hosts.resize(host_id_strings.size());
158 std::transform(host_id_strings.begin(), host_id_strings.end(), hosts.begin(), HostID::fromString);
159 }
160}
161
162
163void DDLTaskBase::parseQueryFromEntry(ContextPtr context)

Callers 3

initAndCheckTaskMethod · 0.45
resetConsumeOffsetMethod · 0.45
parseStorageIDMethod · 0.45

Calls 12

parseQueryFunction · 0.85
assertEOFFunction · 0.85
transformFunction · 0.85
eofMethod · 0.45
clearMethod · 0.45
positionMethod · 0.45
emplaceMethod · 0.45
emptyMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected