yashrb24 commented on code in PR #25469:
URL: https://github.com/apache/datafusion/pull/25469#discussion_r4046713099


##########
datafusion/functions/src/core/struct.rs:
##########
@@ -150,4 +152,16 @@ impl ScalarUDFImpl for StructFunc {
     fn documentation(&self) -> Option<&Documentation> {
         self.doc()
     }
+
+    fn struct_field_mapping(
+        &self,
+        literal_args: &[Option<ScalarValue>],
+    ) -> Option<StructFieldMapping> {
+        Some(StructFieldMapping {
+            field_accessor: Arc::new(ScalarUDF::from(GetFieldFunc::new())),
+            fields: (0..literal_args.len())
+                .map(|i| (vec![ScalarValue::Utf8(Some(format!("c{i}")))], i))
+                .collect(),
+        })
+    }

Review Comment:
   `StructFunc` from datafusion-functions crate already provides support for 
this, but instead of adding another dependency I thought it might be a better 
idea to have it defined separately here instead



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