afedulov commented on a change in pull request #17598:
URL: https://github.com/apache/flink/pull/17598#discussion_r770169936



##########
File path: 
flink-formats/flink-csv/src/main/java/org/apache/flink/formats/csv/CsvBulkWriter.java
##########
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.formats.csv;
+
+import org.apache.flink.annotation.PublicEvolving;
+import org.apache.flink.api.common.serialization.BulkWriter;
+import org.apache.flink.core.fs.FSDataOutputStream;
+import org.apache.flink.formats.common.Converter;
+import 
org.apache.flink.formats.csv.RowDataToCsvConverters.RowDataToCsvConverter.RowDataToCsvFormatConverterContext;
+
+import 
org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.JsonGenerator;
+import 
org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonNode;
+import 
org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectWriter;
+import 
org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ObjectNode;
+import 
org.apache.flink.shaded.jackson2.com.fasterxml.jackson.dataformat.csv.CsvMapper;
+import 
org.apache.flink.shaded.jackson2.com.fasterxml.jackson.dataformat.csv.CsvSchema;
+
+import java.io.IOException;
+
+/** A simple {@link BulkWriter} implementation based on Jackson CSV 
transformations. */
+@PublicEvolving
+public class CsvBulkWriter<T> implements BulkWriter<T> {
+
+    private final FSDataOutputStream stream;
+    private final CsvMapper mapper;
+    private final Converter<T, JsonNode, RowDataToCsvFormatConverterContext> 
converter;
+    private final ObjectWriter csvWriter;
+    /** Reusable within the converter. * */
+    private final transient ObjectNode container;

Review comment:
       This is in accordance with the design choice explicitly made in a 
similar situation in the recent addition:
   
   
https://github.com/apache/flink/commit/b1e436a109c6473b794f02ec0a853d1ae6df6c83#diff-58a105b8d92eadfb0af487ba6b2bce5a00955fceb2077e6b7f2d1fa01592a50bR84
   
   One could argue that as it is a throw-away object that does not itself 
contain any configuration there is no strict necessity to ship it to the 
executors. Let me know what you think and if there are general guidelines for 
similar cases in Flink.




-- 
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: issues-unsubscr...@flink.apache.org

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


Reply via email to