FangYongs commented on code in PR #23087:
URL: https://github.com/apache/flink/pull/23087#discussion_r1278734685


##########
flink-formats/flink-csv/src/main/java/org/apache/flink/formats/csv/CsvToRowDataConverters.java:
##########
@@ -185,48 +187,57 @@ private CsvToRowDataConverter createConverter(LogicalType 
type) {
         }
     }
 
-    private boolean convertToBoolean(JsonNode jsonNode) {
+    private <V> V convertStringToValue(JsonNode jsonNode, Function<String, V> 
function) {

Review Comment:
   I try the option `null-literal` and it works. But I think there're some 
improvement points about csv format here. Currently when I create a csv format 
table with nullable fields such as table ( a int, b int). There are no 
additional options for the table and I can successfully insert null data to the 
field a and b. When I try to select results from the table, it throw exception 
that empty string('') cannot be parsed as int value. I think there may be two 
solutions for this, and we can pick one:
   1. Throw an exception and tell users to configure `null-literal` for their 
csv table if they try to insert a null value.
   2. Give the option `null-literal` a default value such as empty string('')
   
   @libenchao What do you think of it?
   
   



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

Reply via email to