liurenjie1024 commented on code in PR #245: URL: https://github.com/apache/iceberg-rust/pull/245#discussion_r1545534908
########## crates/iceberg/src/scan.rs: ########## @@ -187,6 +190,46 @@ impl TableScan { let mut arrow_reader_builder = ArrowReaderBuilder::new(self.file_io.clone(), self.schema.clone()); + let mut field_ids = vec![]; + for column_name in &self.column_names { + let field_id = self.schema.field_id_by_name(column_name).ok_or_else(|| { + Error::new( + ErrorKind::DataInvalid, + format!( + "Column {} not found in table. Schema: {}", + column_name, self.schema + ), + ) + })?; + + let field = self.schema + .as_struct() + .field_by_id(field_id) + .ok_or_else(|| { + Error::new( + ErrorKind::DataInvalid, + format!( + "Column {} is not a direct child of schema but a nested field. Schema: {}", + column_name, self.schema Review Comment: ```suggestion ErrorKind::FeatureNotSupported, format!( "Column {} is not a direct child of schema but a nested field, which is not supported now. Schema: {}", column_name, self.schema ``` ########## crates/iceberg/src/scan.rs: ########## @@ -187,6 +190,46 @@ impl TableScan { let mut arrow_reader_builder = ArrowReaderBuilder::new(self.file_io.clone(), self.schema.clone()); + let mut field_ids = vec![]; + for column_name in &self.column_names { + let field_id = self.schema.field_id_by_name(column_name).ok_or_else(|| { + Error::new( + ErrorKind::DataInvalid, + format!( + "Column {} not found in table. Schema: {}", + column_name, self.schema + ), + ) + })?; + + let field = self.schema + .as_struct() + .field_by_id(field_id) + .ok_or_else(|| { + Error::new( + ErrorKind::DataInvalid, + format!( + "Column {} is not a direct child of schema but a nested field. Schema: {}", + column_name, self.schema + ), + ) + })?; + + if !field.field_type.is_primitive() { + return Err(Error::new( + ErrorKind::DataInvalid, + format!( + "Column {} is not a primitive type. Schema: {}", + column_name, self.schema Review Comment: Ditto, returning a feature not supported error would be more user friendly. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org