Myracle commented on code in PR #27578:
URL: https://github.com/apache/flink/pull/27578#discussion_r2910036677


##########
flink-formats/flink-csv/src/main/java/org/apache/flink/formats/csv/CsvFormatOptions.java:
##########
@@ -94,5 +94,50 @@ public class CsvFormatOptions {
                     .withDescription(
                             "Enables representation of BigDecimal data type in 
scientific notation (default is true). For example, 100000 is encoded as 1E+5 
by default, and will be written as 100000 if set this option to false. Note: 
Only when the value is not 0 and a multiple of 10 is converted to scientific 
notation.");
 
+    public static final ConfigOption<Boolean> TRIM_SPACES =
+            ConfigOptions.key("trim-spaces")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription(
+                            "Optional flag to trim leading/trailing spaces 
from "
+                                    + "unquoted field values (disabled by 
default). "
+                                    + "Only affects deserialization.");
+
+    public static final ConfigOption<Boolean> IGNORE_TRAILING_UNMAPPABLE =
+            ConfigOptions.key("ignore-trailing-unmappable")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription(
+                            "Optional flag to ignore extra trailing fields 
that "
+                                    + "cannot be mapped to the schema 
(disabled by default). "
+                                    + "Only affects deserialization.");
+
+    public static final ConfigOption<Boolean> ALLOW_TRAILING_COMMA =
+            ConfigOptions.key("allow-trailing-comma")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription(
+                            "Optional flag to allow a trailing comma after the 
"
+                                    + "last field value (disabled by default). 
"
+                                    + "Only affects deserialization.");
+
+    public static final ConfigOption<Boolean> FAIL_ON_MISSING_COLUMNS =
+            ConfigOptions.key("fail-on-missing-columns")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription(
+                            "Optional flag to fail when a row has fewer 
columns "
+                                    + "than the schema expects (disabled by 
default). "
+                                    + "Only affects deserialization.");
+
+    public static final ConfigOption<Boolean> EMPTY_STRING_AS_NULL =
+            ConfigOptions.key("empty-string-as-null")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription(
+                            "Optional flag to treat empty string values as 
null "
+                                    + "(disabled by default). "
+                                    + "Only affects deserialization.");
+

Review Comment:
   Thanks for the review comment! I've done a thorough verification of all 
default values in CsvFormatOptions against their actual runtime behavior in the 
Builder classes and Jackson defaults.
   
   **Found 1 inconsistency:** write-bigdecimal-in-scientific-notation is 
declared with defaultValue(true) in CsvFormatOptions, but 
CsvRowDataSerializationSchema.Builder.isScientificNotation defaults to false 
(Java primitive default). Since CsvFormatFactory uses getOptional() which does 
NOT return the ConfigOption's default value, when a user doesn't set this 
option explicitly, the Builder's internal default of false takes effect — which 
contradicts the documented behavior.
   
   **Fix:** Set isScientificNotation = true as the initial value in the Builder 
to align with the declared default.
   All other 13 options are verified to be consistent between CsvFormatOptions, 
Jackson CsvSchema defaults, and CsvParser.Feature defaults.



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