@@ -164,11 +164,11 @@ impl From<sqlparser::ast::NullTreatment> for NullTreatment {
164164/// # use datafusion_expr::{lit, col, Operator, Expr};
165165/// // Use the `+` operator to add two columns together
166166/// let expr = col("c1") + col("c2");
167- /// assert!(matches!(expr, Expr::BinaryExpr { ..} ));
167+ /// assert!(matches!(expr, Expr::BinaryExpr { .. } ));
168168/// if let Expr::BinaryExpr(binary_expr) = expr {
169- /// assert_eq!(*binary_expr.left, col("c1"));
170- /// assert_eq!(*binary_expr.right, col("c2"));
171- /// assert_eq!(binary_expr.op, Operator::Plus);
169+ /// assert_eq!(*binary_expr.left, col("c1"));
170+ /// assert_eq!(*binary_expr.right, col("c2"));
171+ /// assert_eq!(binary_expr.op, Operator::Plus);
172172/// }
173173/// ```
174174///
@@ -179,12 +179,12 @@ impl From<sqlparser::ast::NullTreatment> for NullTreatment {
179179/// # use datafusion_common::ScalarValue;
180180/// # use datafusion_expr::{lit, col, Operator, Expr};
181181/// let expr = col("c1").eq(lit(42_i32));
182- /// assert!(matches!(expr, Expr::BinaryExpr { .. } ));
182+ /// assert!(matches!(expr, Expr::BinaryExpr { .. }));
183183/// if let Expr::BinaryExpr(binary_expr) = expr {
184- /// assert_eq!(*binary_expr.left, col("c1"));
185- /// let scalar = ScalarValue::Int32(Some(42));
186- /// assert_eq!(*binary_expr.right, Expr::Literal(scalar, None));
187- /// assert_eq!(binary_expr.op, Operator::Eq);
184+ /// assert_eq!(*binary_expr.left, col("c1"));
185+ /// let scalar = ScalarValue::Int32(Some(42));
186+ /// assert_eq!(*binary_expr.right, Expr::Literal(scalar, None));
187+ /// assert_eq!(binary_expr.op, Operator::Eq);
188188/// }
189189/// ```
190190///
@@ -197,22 +197,22 @@ impl From<sqlparser::ast::NullTreatment> for NullTreatment {
197197/// # use datafusion_expr::Expr;
198198/// // Create a schema c1(int, c2 float)
199199/// let arrow_schema = Schema::new(vec![
200- /// Field::new("c1", DataType::Int32, false),
201- /// Field::new("c2", DataType::Float64, false),
200+ /// Field::new("c1", DataType::Int32, false),
201+ /// Field::new("c2", DataType::Float64, false),
202202/// ]);
203203/// // DFSchema is a an Arrow schema with optional relation name
204- /// let df_schema = DFSchema::try_from_qualified_schema("t1", &arrow_schema)
205- /// .unwrap();
204+ /// let df_schema = DFSchema::try_from_qualified_schema("t1", &arrow_schema).unwrap();
206205///
207206/// // Form Vec<Expr> with an expression for each column in the schema
208- /// let exprs: Vec<_> = df_schema.iter()
209- /// .map(Expr::from)
210- /// .collect();
211- ///
212- /// assert_eq!(exprs, vec![
213- /// Expr::from(Column::from_qualified_name("t1.c1")),
214- /// Expr::from(Column::from_qualified_name("t1.c2")),
215- /// ]);
207+ /// let exprs: Vec<_> = df_schema.iter().map(Expr::from).collect();
208+ ///
209+ /// assert_eq!(
210+ /// exprs,
211+ /// vec![
212+ /// Expr::from(Column::from_qualified_name("t1.c1")),
213+ /// Expr::from(Column::from_qualified_name("t1.c2")),
214+ /// ]
215+ /// );
216216/// ```
217217///
218218/// # Examples: Displaying `Exprs`
@@ -273,12 +273,13 @@ impl From<sqlparser::ast::NullTreatment> for NullTreatment {
273273/// let mut scalars = HashSet::new();
274274/// // apply recursively visits all nodes in the expression tree
275275/// expr.apply(|e| {
276- /// if let Expr::Literal(scalar, _) = e {
277- /// scalars.insert(scalar);
278- /// }
279- /// // The return value controls whether to continue visiting the tree
280- /// Ok(TreeNodeRecursion::Continue)
281- /// }).unwrap();
276+ /// if let Expr::Literal(scalar, _) = e {
277+ /// scalars.insert(scalar);
278+ /// }
279+ /// // The return value controls whether to continue visiting the tree
280+ /// Ok(TreeNodeRecursion::Continue)
281+ /// })
282+ /// .unwrap();
282283/// // All subtrees have been visited and literals found
283284/// assert_eq!(scalars.len(), 2);
284285/// assert!(scalars.contains(&ScalarValue::Int32(Some(5))));
@@ -1640,7 +1641,6 @@ impl Expr {
16401641 /// let metadata = FieldMetadata::from(metadata);
16411642 /// let expr = col("foo").alias_with_metadata("bar", Some(metadata));
16421643 /// ```
1643- ///
16441644 pub fn alias_with_metadata (
16451645 self ,
16461646 name : impl Into < String > ,
@@ -1670,9 +1670,9 @@ impl Expr {
16701670 /// # use datafusion_common::metadata::FieldMetadata;
16711671 /// let metadata = HashMap::from([("key".to_string(), "value".to_string())]);
16721672 /// let metadata = FieldMetadata::from(metadata);
1673- /// let expr = col("foo").alias_qualified_with_metadata(Some("tbl"), "bar", Some(metadata));
1673+ /// let expr =
1674+ /// col("foo").alias_qualified_with_metadata(Some("tbl"), "bar", Some(metadata));
16741675 /// ```
1675- ///
16761676 pub fn alias_qualified_with_metadata (
16771677 self ,
16781678 relation : Option < impl Into < TableReference > > ,
0 commit comments