cj-zhukov commented on code in PR #18862:
URL: https://github.com/apache/datafusion/pull/18862#discussion_r2552263952
##########
datafusion-examples/examples/dataframe/default_column_values.rs:
##########
@@ -52,25 +54,23 @@ use object_store::{ObjectStore, PutPayload};
// Metadata key for storing default values in field metadata
const DEFAULT_VALUE_METADATA_KEY: &str = "example.default_value";
-// Example showing how to implement custom default value handling for missing
columns
-// using field metadata and PhysicalExprAdapter.
-//
-// This example demonstrates how to:
-// 1. Store default values in field metadata using a constant key
-// 2. Create a custom PhysicalExprAdapter that reads these defaults
-// 3. Inject default values for missing columns in filter predicates
-// 4. Use the DefaultPhysicalExprAdapter as a fallback for standard schema
adaptation
-// 5. Wrap string default values in cast expressions for proper type conversion
-//
-// Important: PhysicalExprAdapter is specifically designed for rewriting
filter predicates
-// that get pushed down to file scans. For handling missing columns in
projections,
-// other mechanisms in DataFusion are used (like SchemaAdapter).
-//
-// The metadata-based approach provides a flexible way to store default values
as strings
-// and cast them to the appropriate types at query time.
-
-#[tokio::main]
-async fn main() -> Result<()> {
+/// Example showing how to implement custom default value handling for missing
columns
+/// using field metadata and PhysicalExprAdapter.
+///
+/// This example demonstrates how to:
+/// 1. Store default values in field metadata using a constant key
+/// 2. Create a custom PhysicalExprAdapter that reads these defaults
+/// 3. Inject default values for missing columns in filter predicates
+/// 4. Use the DefaultPhysicalExprAdapter as a fallback for standard schema
adaptation
+/// 5. Wrap string default values in cast expressions for proper type
conversion
+///
+/// Important: PhysicalExprAdapter is specifically designed for rewriting
filter predicates
+/// that get pushed down to file scans. For handling missing columns in
projections,
+/// other mechanisms in DataFusion are used (like SchemaAdapter).
+///
+/// The metadata-based approach provides a flexible way to store default
values as strings
+/// and cast them to the appropriate types at query time.
+pub async fn default_column_values() -> Result<()> {
Review Comment:
Agree with you, let's move the example
--
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]