Skip to content

Commit

Permalink
move the check outside of the loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Tishj committed Jan 3, 2025
1 parent fb5dbb9 commit e3e44ea
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions extension/parquet/parquet_extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,19 +268,25 @@ static MultiFileReaderBindData BindSchema(ClientContext &context, vector<Logical
MultiFileReaderBindData bind_data;
schema_col_names.reserve(options.schema.size());
schema_col_types.reserve(options.schema.size());
bool match_by_field_id = false;
bool match_by_field_id;
if (!options.schema.empty()) {
auto &column = options.schema[0];
if (column.identifier.type().id() == LogicalTypeId::INTEGER) {
match_by_field_id = true;
} else {
match_by_field_id = false;
}
} else {
match_by_field_id = false;
}

for (idx_t i = 0; i < options.schema.size(); i++) {
const auto &column = options.schema[i];
schema_col_names.push_back(column.name);
schema_col_types.push_back(column.type);

auto res = MultiFileReaderColumnDefinition(column.name, column.type);
res.identifier = column.identifier;
if (!i) {
if (res.identifier.type().id() == LogicalTypeId::INTEGER) {
match_by_field_id = true;
}
}
#ifdef DEBUG
if (match_by_field_id) {
D_ASSERT(res.identifier.type().id() == LogicalTypeId::INTEGER);
Expand Down

0 comments on commit e3e44ea

Please sign in to comment.