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

Method readField

src/Processors/Formats/Impl/JSONEachRowRowInputFormat.cpp:134–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132}
133
134void JSONEachRowRowInputFormat::readField(size_t index, MutableColumns & columns)
135{
136 if (seen_columns[index])
137 throw Exception("Duplicate field found while parsing JSONEachRow format: " + columnName(index), ErrorCodes::INCORRECT_DATA);
138
139 try
140 {
141 seen_columns[index] = read_columns[index] = true;
142 const auto & type = getPort().getHeader().getByPosition(index).type;
143 const auto & serialization = serializations[index];
144
145 if (yield_strings)
146 {
147 String str;
148 readJSONString(str, in);
149
150 ReadBufferFromString buf(str);
151
152 if (format_settings.null_as_default && !type->isNullable())
153 read_columns[index] = SerializationNullable::deserializeWholeTextImpl(*columns[index], buf, format_settings, serialization);
154 else
155 serialization->deserializeWholeText(*columns[index], buf, format_settings);
156 }
157 else
158 {
159 if (format_settings.null_as_default && !type->isNullable())
160 read_columns[index] = SerializationNullable::deserializeTextJSONImpl(*columns[index], in, format_settings, serialization);
161 else
162 serialization->deserializeTextJSON(*columns[index], in, format_settings);
163 }
164 }
165 catch (Exception & e)
166 {
167 e.addMessage("(while reading the value of key " + columnName(index) + ")");
168 throw;
169 }
170}
171
172inline bool JSONEachRowRowInputFormat::advanceToNextKey(size_t key_index)
173{

Callers

nothing calls this directly

Calls 7

readJSONStringFunction · 0.85
addMessageMethod · 0.80
ExceptionClass · 0.50
getHeaderMethod · 0.45
isNullableMethod · 0.45
deserializeWholeTextMethod · 0.45
deserializeTextJSONMethod · 0.45

Tested by

no test coverage detected