File tree Expand file tree Collapse file tree 2 files changed +35
-2
lines changed
docs/source/library-user-guide Expand file tree Collapse file tree 2 files changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -1606,8 +1606,10 @@ impl Expr {
1606
1606
/// # Example
1607
1607
/// ```
1608
1608
/// # use datafusion_expr::col;
1609
- /// use std::collections::HashMap;
1609
+ /// # use std::collections::HashMap;
1610
+ /// # use datafusion_expr::expr::FieldMetadata;
1610
1611
/// let metadata = HashMap::from([("key".to_string(), "value".to_string())]);
1612
+ /// let metadata = FieldMetadata::from(metadata);
1611
1613
/// let expr = col("foo").alias_with_metadata("bar", Some(metadata));
1612
1614
/// ```
1613
1615
///
@@ -1636,8 +1638,10 @@ impl Expr {
1636
1638
/// # Example
1637
1639
/// ```
1638
1640
/// # use datafusion_expr::col;
1639
- /// use std::collections::HashMap;
1641
+ /// # use std::collections::HashMap;
1642
+ /// # use datafusion_expr::expr::FieldMetadata;
1640
1643
/// let metadata = HashMap::from([("key".to_string(), "value".to_string())]);
1644
+ /// let metadata = FieldMetadata::from(metadata);
1641
1645
/// let expr = col("foo").alias_qualified_with_metadata(Some("tbl"), "bar", Some(metadata));
1642
1646
/// ```
1643
1647
///
Original file line number Diff line number Diff line change 19
19
20
20
# Upgrade Guides
21
21
22
+ ## DataFusion ` 49.0.0 `
23
+
24
+ ### Metadata is now represented by ` FieldMetadata `
25
+
26
+ Metadata from the Arrow ` Field ` is now stored using the ` FieldMetadata `
27
+ structure. In prior versions it was stored as both a ` HashMap<String, String> `
28
+ and a ` BTreeMap<String, String> ` . ` FieldMetadata ` is a easier to work with and
29
+ is more efficient.
30
+
31
+ To create ` FieldMetadata ` from a ` Field ` :
32
+
33
+ ``` rust
34
+ # /* comment to avoid running
35
+ let metadata = FieldMetadata::from(&field);
36
+ # */
37
+ ```
38
+
39
+ To add metadata to a ` Field ` , use the ` add_to_field ` method:
40
+
41
+ ``` rust
42
+ # /* comment to avoid running
43
+ let updated_field = metadata.add_to_field(field);
44
+ # */
45
+ ```
46
+
47
+ See [ #16317 ] for details.
48
+
49
+ [ #16317 ] : https://github.com/apache/datafusion/pull/16317
50
+
22
51
## DataFusion ` 48.0.0 `
23
52
24
53
### The ` VARCHAR ` SQL type is now represented as ` Utf8View ` in Arrow.
You can’t perform that action at this time.
0 commit comments