| 132 | } |
| 133 | |
| 134 | void 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 | |
| 172 | inline bool JSONEachRowRowInputFormat::advanceToNextKey(size_t key_index) |
| 173 | { |
nothing calls this directly
no test coverage detected