MCPcopy Create free account
hub / github.com/apache/impala / _buildCols

Function _buildCols

be/src/catalog/workload-management-init.cc:156–187  ·  view source on GitHub ↗

Loops through all workload management columns definied in FIELD_DEFINITIONS and builds a TColumn object for each column if the provided function returns true for that column returning a vector of all columns that were included.

Source from the content-addressed store, hash-verified

154/// a TColumn object for each column if the provided function returns true for that column
155/// returning a vector of all columns that were included.
156static vector<TColumn> _buildCols(
157 const function<bool(const FieldDefinition& item)>& shouldIncludeCol) {
158 vector<TColumn> cols;
159
160 for (const auto& field : FIELD_DEFINITIONS) {
161 if (shouldIncludeCol(field.second)) {
162 TScalarType t_scalar_type;
163 TTypeNode t_type_node;
164 TColumnType t_col_type;
165 TColumn t_col;
166
167 t_scalar_type.__set_type(field.second.db_column_type);
168 t_scalar_type.__set_precision(field.second.precision);
169 t_scalar_type.__set_scale(field.second.scale);
170
171 t_type_node.__set_type(TTypeNodeType::SCALAR);
172 t_type_node.__set_scalar_type(t_scalar_type);
173
174 t_col_type.__set_types({t_type_node});
175
176 t_col.__set_columnName(to_lower_copy(to_string(field.first)));
177 t_col.__set_columnType(t_col_type);
178 t_col.__set_is_nullable(true);
179
180 cols.push_back(t_col);
181 }
182 }
183
184 DCHECK(cols.size() > 0);
185
186 return cols;
187} // function _buildCols
188
189/// Sets up the query table by generating and executing the necessary DML statements.
190/// System tables are external. The columns on the table will be all columns with a

Callers 2

_createTableFunction · 0.85
_upgradeTableFunction · 0.85

Calls 2

push_backMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected