comphead commented on code in PR #15329:
URL: https://github.com/apache/datafusion/pull/15329#discussion_r2006103754


##########
docs/source/library-user-guide/working-with-exprs.md:
##########
@@ -50,6 +50,29 @@ As another example, the SQL expression `a + b * c` would be 
represented as an `E
 
 As the writer of a library, you can use `Expr`s to represent computations that 
you want to perform. This guide will walk you through how to make your own 
scalar UDF as an `Expr` and how to rewrite `Expr`s to inline the simple UDF.
 
+## Arrow Schema and DataFusion DFSchema
+
+Schema and DFSchema are both exist in datafusion because `Schema` provides a 
lightweight structure for defining data, and `DFSchema` extends it with extra 
information. This makes the engine could handle both simple data definitions 
and complex query scenarios efficiently.
+
+### Difference between Schema and DFSchema
+
+- Schema: A fundamental component of Apache Arrow, `Schema` defines a 
dataset's structure, specifying column names and their data types.
+
+  > Please see [Struct 
Schema](https://docs.rs/arrow-schema/54.2.1/arrow_schema/struct.Schema.html) 
for a detailed document of Arrow Schema.
+
+- DFSchema: Extending `Schema`, `DFSchema` incorporates qualifiers such as 
table names, enabling it to carry additional context when required. This is 
particularly valuable for managing queries across multiple tables.
+  > Please see [Struct 
DFSchema](https://docs.rs/datafusion/latest/datafusion/common/struct.DFSchema.html)
 for a detailed document of DFSchema.
+
+### How to convert between Schema and DFSchema
+
+From Schema to DFSchema: Use `DFSchema::try_from_qualified_schema` with a 
table name and original schema. See example below:
+
+> let df_schema = DFSchema::try_from_qualified_schema("t1", 
&arrow_schema).unwrap();
+

Review Comment:
   For conversion it is worth to point to DFSchema link documentation 
https://docs.rs/datafusion/latest/datafusion/common/struct.DFSchema.html#converting-back-to-arrow-schema
   
   Other conversion methods which are suitable for users it is nice to document 
in the rust doc



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to