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

Method readImpl

src/DataStreams/NativeBlockInputStream.cpp:100–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98
99
100Block NativeBlockInputStream::readImpl()
101{
102 Block res;
103
104 const DataTypeFactory & data_type_factory = DataTypeFactory::instance();
105
106 if (use_index && index_block_it == index_block_end)
107 return res;
108
109 if (istr.eof())
110 {
111 if (use_index)
112 throw ParsingException("Input doesn't contain all data for index.", ErrorCodes::CANNOT_READ_ALL_DATA);
113
114 return res;
115 }
116
117 /// Additional information about the block.
118 if (server_revision > 0)
119 res.info.read(istr);
120
121 /// Dimensions
122 size_t columns = 0;
123 size_t rows = 0;
124
125 if (!use_index)
126 {
127 readVarUInt(columns, istr);
128 readVarUInt(rows, istr);
129 }
130 else
131 {
132 columns = index_block_it->num_columns;
133 rows = index_block_it->num_rows;
134 }
135
136 for (size_t i = 0; i < columns; ++i)
137 {
138 if (use_index)
139 {
140 /// If the current position is what is required, the real seek does not occur.
141 istr_concrete->seek(index_column_it->location.offset_in_compressed_file, index_column_it->location.offset_in_decompressed_block);
142 }
143
144 ColumnWithTypeAndName column;
145
146 /// Name
147 readBinary(column.name, istr);
148
149 /// Type
150 String type_name;
151 readBinary(type_name, istr);
152 column.type = data_type_factory.get(type_name);
153
154 if (use_index)
155 {
156 /// Index allows to do more checks.
157 if (index_column_it->name != column.name)

Callers

nothing calls this directly

Calls 15

ParsingExceptionClass · 0.85
readVarUIntFunction · 0.85
readDataFunction · 0.85
recursiveTypeConversionFunction · 0.85
getByNameMethod · 0.80
readBinaryFunction · 0.50
ExceptionClass · 0.50
eofMethod · 0.45
readMethod · 0.45
seekMethod · 0.45
getMethod · 0.45
createColumnMethod · 0.45

Tested by

no test coverage detected