comphead commented on code in PR #12135:
URL: https://github.com/apache/datafusion/pull/12135#discussion_r1761572859
##########
datafusion/core/src/datasource/listing/table.rs:
##########
@@ -789,19 +792,22 @@ impl TableProvider for ListingTable {
.map(|col| Ok(self.table_schema.field_with_name(&col.0)?.clone()))
.collect::<Result<Vec<_>>>()?;
- let filters = if let Some(expr) = conjunction(filters.to_vec()) {
- // NOTE: Use the table schema (NOT file schema) here because
`expr` may contain references to partition columns.
- let table_df_schema =
self.table_schema.as_ref().clone().to_dfschema()?;
- let filters =
- create_physical_expr(&expr, &table_df_schema,
state.execution_props())?;
- Some(filters)
- } else {
- None
- };
+ let filters = conjunction(filters.to_vec())
+ .map(|expr| -> Result<_> {
+ // NOTE: Use the table schema (NOT file schema) here because
`expr` may contain references to partition columns.
+ let table_df_schema =
self.table_schema.as_ref().clone().to_dfschema()?;
+ let filters = create_physical_expr(
+ &expr,
+ &table_df_schema,
+ state.execution_props(),
+ )?;
+ Ok(Some(filters))
+ })
+ .unwrap_or(Ok(None))?;
- let object_store_url = if let Some(url) = self.table_paths.first() {
- url.object_store()
- } else {
+ let Some(object_store_url) =
+ self.table_paths.first().map(ListingTableUrl::object_store)
Review Comment:
👍
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]