alamb commented on code in PR #11160:
URL: https://github.com/apache/datafusion/pull/11160#discussion_r1664110285


##########
datafusion-examples/examples/logical_type.rs:
##########
@@ -0,0 +1,108 @@
+use datafusion::datasource::TableProvider;
+use datafusion::execution::context::SessionState;
+use datafusion::physical_plan::ExecutionPlan;
+use datafusion_common::logical_type::schema::{LogicalSchema, LogicalSchemaRef};
+use datafusion::error::Result;
+use datafusion_expr::{Expr, TableType};
+use std::any::Any;
+use std::sync::Arc;
+use arrow::util::pretty::pretty_format_batches;
+use arrow_schema::{DataType, Field, TimeUnit};
+use datafusion::prelude::SessionContext;
+use datafusion_common::logical_type::{ExtensionType};
+use datafusion_common::logical_type::field::LogicalField;
+use datafusion_common::logical_type::signature::LogicalType;
+
+#[tokio::main]
+async fn main() -> Result<()> {
+    let ctx = SessionContext::new();
+    ctx.register_table("example", Arc::new(ExampleTableSource::default()))?;
+
+    let df = ctx.sql("SELECT * FROM example").await?;
+    let records = df.collect().await?;
+
+    println!("{}", pretty_format_batches(&records)?);

Review Comment:
   Is the primary usecase of the LogicalType so that we could write functions 
that take the logical type, or define custom behavior?
   
   Like I wonder is the idea that we could now create a `ScalarFunctionImpl` 
whose signature refers to LogicalType rather than PhysicalType 🤔 Or somehow 
plan a binary operation on logical types?
   
   BTW I think the work we are doing with @samuelcolvin @dharanad and 
@jayzhan211  in https://github.com/apache/datafusion/issues/11207 would make it 
straightforward to implement a custom comparsion (via a function) for this 
magical type
   
   That might be a good thing to show too



-- 
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]

Reply via email to