You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2021/06/30 20:35:28 UTC
[arrow-datafusion] branch master updated: Improve error message and
comments (#641)
This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/master by this push:
new 466b7c5 Improve error message and comments (#641)
466b7c5 is described below
commit 466b7c5722b61f3328fb4ed91f4b11d050eb60ff
Author: Andrew Lamb <an...@nerdnetworks.org>
AuthorDate: Wed Jun 30 16:35:19 2021 -0400
Improve error message and comments (#641)
---
datafusion/src/logical_plan/dfschema.rs | 4 ++--
datafusion/src/logical_plan/expr.rs | 10 ++++++++--
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/datafusion/src/logical_plan/dfschema.rs b/datafusion/src/logical_plan/dfschema.rs
index b46e067..b4d864f 100644
--- a/datafusion/src/logical_plan/dfschema.rs
+++ b/datafusion/src/logical_plan/dfschema.rs
@@ -158,8 +158,8 @@ impl DFSchema {
}
}
Err(DataFusionError::Plan(format!(
- "No field matches column '{}'",
- col,
+ "No field matches column '{}'. Available fields: {}",
+ col, self
)))
}
diff --git a/datafusion/src/logical_plan/expr.rs b/datafusion/src/logical_plan/expr.rs
index 1bf3b65..1fab9bb 100644
--- a/datafusion/src/logical_plan/expr.rs
+++ b/datafusion/src/logical_plan/expr.rs
@@ -83,7 +83,12 @@ impl Column {
}
}
- /// Normalize Column with qualifier based on provided dataframe schemas.
+ /// Normalizes `self` if is unqualified (has no relation name)
+ /// with an explicit qualifier from the first matching input
+ /// schemas.
+ ///
+ /// For example, `foo` will be normalized to `t.foo` if there is a
+ /// column named `foo` in a relation named `t` found in `schemas`
pub fn normalize(self, schemas: &[&DFSchemaRef]) -> Result<Self> {
if self.relation.is_some() {
return Ok(self);
@@ -1113,7 +1118,8 @@ pub fn columnize_expr(e: Expr, input_schema: &DFSchema) -> Expr {
}
}
-/// Recursively normalize all Column expressions in a given expression tree
+/// Recursively call [`Column::normalize`] on all Column expressions
+/// in the `expr` expression tree.
pub fn normalize_col(e: Expr, schemas: &[&DFSchemaRef]) -> Result<Expr> {
struct ColumnNormalizer<'a, 'b> {
schemas: &'a [&'b DFSchemaRef],