sunshineJK commented on code in PR #20127:
URL: https://github.com/apache/flink/pull/20127#discussion_r916412976


##########
flink-formats/flink-csv/src/main/java/org/apache/flink/formats/csv/CsvFormatOptions.java:
##########
@@ -87,5 +87,12 @@ public class CsvFormatOptions {
                             "Optional null literal string that is interpreted 
as a\n"
                                     + "null value (disabled by default)");
 
+    public static final ConfigOption<Boolean> 
DISABLE_WRITE_BIGDECIMAL_AS_SCIENTIFIC_NOTATION =
+            
ConfigOptions.key("disable-write-bigdecimal-as-scientific-notation")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription(
+                            "Disabled representation of data of type 
Bigdecimal as scientific notation (default is false, which requires conversion 
to scientific notation), e.g. A Bigdecimal number of 100000, If false the 
result is '1E+5', if true the result is 100000.");
+
     private CsvFormatOptions() {}

Review Comment:
   hi,@afedulov I've changed this parameter and now the default is false.And 
change the parameter name to disable-write-bigdecimal-as-scientific-notation



##########
flink-formats/flink-csv/src/main/java/org/apache/flink/formats/csv/CsvRowDataSerializationSchema.java:
##########
@@ -128,8 +132,13 @@ public Builder setNullLiteral(String s) {
             return this;
         }
 
+        public void setBigDecimalInScientificNotation(boolean 
isScientificNotation) {

Review Comment:
   Yes, you are right



##########
flink-formats/flink-csv/src/main/java/org/apache/flink/formats/csv/CsvFormatOptions.java:
##########
@@ -87,5 +87,11 @@ public class CsvFormatOptions {
                             "Optional null literal string that is interpreted 
as a\n"
                                     + "null value (disabled by default)");
 
+    public static final ConfigOption<Boolean> WRITE_BIGDECIMAL_AS_PLAIN =
+            ConfigOptions.key("write-bigdecimal-as-plain")
+                    .booleanType()
+                    .defaultValue(true)

Review Comment:
   Thank you, I understand what you mean, but I think the current description 
is easier for users to understand.



##########
flink-formats/flink-csv/src/main/java/org/apache/flink/formats/csv/CsvFormatOptions.java:
##########
@@ -87,11 +87,12 @@ public class CsvFormatOptions {
                             "Optional null literal string that is interpreted 
as a\n"
                                     + "null value (disabled by default)");
 
-    public static final ConfigOption<Boolean> WRITE_BIGDECIMAL_AS_PLAIN =
-            ConfigOptions.key("write-bigdecimal-as-plain")
+    public static final ConfigOption<Boolean> 
DISABLE_WRITE_BIGDECIMAL_AS_SCIENTIFIC_NOTATION =
+            
ConfigOptions.key("disable-write-bigdecimal-as-scientific-notation")
                     .booleanType()
-                    .defaultValue(true)
-                    .withDescription("Optional whether write bigdecimal using 
scientific notation");
+                    .defaultValue(false)
+                    .withDescription(
+                            "Disabled representation of data of type 
Bigdecimal as scientific notation (default is false, which requires conversion 
to scientific notation), e.g. A Bigdecimal number of 100000, If false the 
result is '1E+5', if true the result is 100000.");

Review Comment:
   Thank you for your advice. I will try to improve it



##########
flink-formats/flink-csv/src/test/java/org/apache/flink/formats/csv/CsvFormatFactoryTest.java:
##########
@@ -230,6 +235,33 @@ public void testInvalidIgnoreParseError() {
         createTableSink(SCHEMA, options);
     }
 
+    @Test
+    public void testSerializationWithWriteBigdecimalAsPlain() {

Review Comment:
   Roger that. Next commit added



##########
flink-formats/flink-csv/src/main/java/org/apache/flink/formats/csv/CsvFormatOptions.java:
##########
@@ -87,5 +87,12 @@ public class CsvFormatOptions {
                             "Optional null literal string that is interpreted 
as a\n"
                                     + "null value (disabled by default)");
 
+    public static final ConfigOption<Boolean> 
WRITE_BIGDECIMAL_IN_SCIENTIFIC_NOTATION =
+            ConfigOptions.key("write-bigdecimal-in-scientific-notation")
+                    .booleanType()
+                    .defaultValue(true)
+                    .withDescription(
+                            "enabled representation of data of type Bigdecimal 
as scientific notation (default is true, which requires conversion to 
scientific notation), e.g. A Bigdecimal number of 100000, If true the result is 
'1E+5', if false the result is 100000.");

Review Comment:
   Only when the value is not 0 and a multiple of 10 is converted to scientific 
notation



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