| 58 | } |
| 59 | |
| 60 | bool RegexpRowInputFormat::readField(size_t index, MutableColumns & columns) |
| 61 | { |
| 62 | const auto & type = getPort().getHeader().getByPosition(index).type; |
| 63 | bool parse_as_nullable = format_settings.null_as_default && !type->isNullable(); |
| 64 | bool read = true; |
| 65 | ReadBuffer field_buf(const_cast<char *>(matched_fields[index].data()), matched_fields[index].size(), 0); |
| 66 | try |
| 67 | { |
| 68 | const auto & serialization = serializations[index]; |
| 69 | switch (field_format) |
| 70 | { |
| 71 | case ColumnFormat::Escaped: |
| 72 | if (parse_as_nullable) |
| 73 | read = SerializationNullable::deserializeTextEscapedImpl(*columns[index], field_buf, format_settings, serialization); |
| 74 | else |
| 75 | serialization->deserializeTextEscaped(*columns[index], field_buf, format_settings); |
| 76 | break; |
| 77 | case ColumnFormat::Quoted: |
| 78 | if (parse_as_nullable) |
| 79 | read = SerializationNullable::deserializeTextQuotedImpl(*columns[index], field_buf, format_settings, serialization); |
| 80 | else |
| 81 | serialization->deserializeTextQuoted(*columns[index], field_buf, format_settings); |
| 82 | break; |
| 83 | case ColumnFormat::Csv: |
| 84 | if (parse_as_nullable) |
| 85 | read = SerializationNullable::deserializeTextCSVImpl(*columns[index], field_buf, format_settings, serialization); |
| 86 | else |
| 87 | serialization->deserializeTextCSV(*columns[index], field_buf, format_settings); |
| 88 | break; |
| 89 | case ColumnFormat::Json: |
| 90 | if (parse_as_nullable) |
| 91 | read = SerializationNullable::deserializeTextJSONImpl(*columns[index], field_buf, format_settings, serialization); |
| 92 | else |
| 93 | serialization->deserializeTextJSON(*columns[index], field_buf, format_settings); |
| 94 | break; |
| 95 | case ColumnFormat::Raw: |
| 96 | if (parse_as_nullable) |
| 97 | read = SerializationNullable::deserializeWholeTextImpl(*columns[index], field_buf, format_settings, serialization); |
| 98 | else |
| 99 | serialization->deserializeWholeText(*columns[index], field_buf, format_settings); |
| 100 | break; |
| 101 | default: |
| 102 | break; |
| 103 | } |
| 104 | } |
| 105 | catch (Exception & e) |
| 106 | { |
| 107 | e.addMessage("(while reading the value of column " + getPort().getHeader().getByPosition(index).name + ")"); |
| 108 | throw; |
| 109 | } |
| 110 | return read; |
| 111 | } |
| 112 | |
| 113 | void RegexpRowInputFormat::readFieldsFromMatch(MutableColumns & columns, RowReadExtension & ext) |
| 114 | { |
nothing calls this directly
no test coverage detected