Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
korowa committed Mar 3, 2024
1 parent d12a355 commit 4a13168
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ impl FileScanConfig {

/// Projects only file schema, ignoring partition columns
pub(crate) fn projected_file_schema(&self) -> SchemaRef {
let fields = self.projection.as_ref().map(|proj| {
proj.iter()
.filter(|col_idx| **col_idx < self.file_schema.fields().len())
let fields = self.file_column_projection_indices().map(|indices| {
indices
.iter()
.map(|col_idx| self.file_schema.field(*col_idx))
.cloned()
.collect::<Vec<_>>()
Expand Down
12 changes: 2 additions & 10 deletions datafusion/sqllogictest/test_files/ddl.slt
Original file line number Diff line number Diff line change
Expand Up @@ -490,28 +490,20 @@ DROP TABLE csv_with_timestamps

statement ok
CREATE EXTERNAL TABLE csv_with_timestamps (
c_date DATE,
name VARCHAR,
ts TIMESTAMP
ts TIMESTAMP,
c_date DATE
)
STORED AS CSV
PARTITIONED BY (c_date)
LOCATION '../core/tests/data/partitioned_table';

# select wildcard always returns partition columns as the last ones
query TPD
SELECT * from csv_with_timestamps where c_date='2018-11-13'
----
Jorge 2018-12-13T12:12:10.011 2018-11-13
Andrew 2018-11-13T17:11:10.011 2018-11-13

# select all fields explicitly
query DTP
SELECT c_date, name, ts from csv_with_timestamps where c_date='2018-11-13'
----
2018-11-13 Jorge 2018-12-13T12:12:10.011
2018-11-13 Andrew 2018-11-13T17:11:10.011

statement ok
DROP TABLE csv_with_timestamps

Expand Down

0 comments on commit 4a13168

Please sign in to comment.