wiedld commented on code in PR #13866:
URL: https://github.com/apache/datafusion/pull/13866#discussion_r1898655480


##########
datafusion/common/src/file_options/parquet_writer.rs:
##########
@@ -51,38 +58,53 @@ impl ParquetWriterOptions {
     }
 }
 
-impl TryFrom<&TableParquetOptions> for ParquetWriterOptions {
-    type Error = DataFusionError;
-
-    fn try_from(parquet_table_options: &TableParquetOptions) -> Result<Self> {
+impl TableParquetOptions {
+    #[deprecated(
+        since = "44.0.0",
+        note = "Please use 
`TableParquetOptions::into_writer_properties_builder` and 
`TableParquetOptions::into_writer_properties_builder_with_arrow_schema`"
+    )]
+    pub fn try_from(table_opts: &TableParquetOptions) -> 
Result<ParquetWriterOptions> {
         // ParquetWriterOptions will have defaults for the remaining fields 
(e.g. sorting_columns)
         Ok(ParquetWriterOptions {
-            writer_options: 
WriterPropertiesBuilder::try_from(parquet_table_options)?
-                .build(),
+            writer_options: 
table_opts.into_writer_properties_builder()?.build(),
         })
     }
-}
-
-impl TryFrom<&TableParquetOptions> for WriterPropertiesBuilder {
-    type Error = DataFusionError;
 
     /// Convert the session's [`TableParquetOptions`] into a single write 
action's [`WriterPropertiesBuilder`].
     ///
     /// The returned [`WriterPropertiesBuilder`] includes customizations 
applicable per column.
-    fn try_from(table_parquet_options: &TableParquetOptions) -> Result<Self> {
+    pub fn into_writer_properties_builder(&self) -> 
Result<WriterPropertiesBuilder> {
+        self.into_writer_properties_builder_with_arrow_schema(None)
+    }
+
+    /// Convert the session's [`TableParquetOptions`] into a single write 
action's [`WriterPropertiesBuilder`].
+    ///
+    /// The returned [`WriterPropertiesBuilder`] includes customizations 
applicable per column,
+    /// as well as the arrow schema encoded into the kv_meta at 
[`ARROW_SCHEMA_META_KEY`].
+    pub fn into_writer_properties_builder_with_arrow_schema(

Review Comment:
   Here is the change: 
https://github.com/apache/datafusion/pull/13866/commits/f2f9b00abd9e783fdbc32e8b167251423f483fbc
   
   I also made another change to prevent the user errors I was worried about: 
https://github.com/apache/datafusion/pull/13866/commits/c5ad794bb9652e84e9ad7a66f15bef964fb2a4dc



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