Skip to content

Commit

Permalink
Use returned tuple slot attr information for populating output vector
Browse files Browse the repository at this point in the history
  • Loading branch information
mkaruza committed Dec 23, 2024
1 parent dfd3dad commit f8bca89
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/pgduckdb_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1311,18 +1311,17 @@ InsertTupleIntoChunk(duckdb::DataChunk &output, PostgresScanLocalState &scan_loc
return;
}
/* Write tuple columns in output vector. */
int duckdb_output_index = 0;
for (auto const &attr_num : scan_global_state->output_columns) {
for (int duckdb_output_index = 0; duckdb_output_index < slot->tts_tupleDescriptor->natts; duckdb_output_index++) {
auto &result = output.data[duckdb_output_index];
if (slot->tts_isnull[duckdb_output_index]) {
auto &array_mask = duckdb::FlatVector::Validity(result);
array_mask.SetInvalid(scan_local_state.output_vector_size);
} else {
auto attr = slot->tts_tupleDescriptor->attrs[attr_num - 1];
/* Use ruturned tuple slot attr information. */
auto attr = slot->tts_tupleDescriptor->attrs[duckdb_output_index];
ConvertPostgresToDuckValue(attr.atttypid, slot->tts_values[duckdb_output_index], result,
scan_local_state.output_vector_size);
}
duckdb_output_index++;
}

scan_local_state.output_vector_size++;
Expand Down

0 comments on commit f8bca89

Please sign in to comment.