afedulov commented on code in PR #20127:
URL: https://github.com/apache/flink/pull/20127#discussion_r921120298
##########
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:
Nit:
Let's for consistency use the full property name, similar to the other
settings.
`setWriteBigDecimalInScientificNotation`
##########
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:
How about:
> Switches on the representation of BigDecimal data type to scientific
notation. When enabled, a BigDecimal number that is larger than 100000, is
represented as '1E+5'.
Btw, does that only apply starting from E+5? What about 1000?
##########
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:
Nit:
The test name should probably reflect the property name change.
Probably also testing the default path of seeing the "1e+5" should be added
to ensure that the setting actually changes the behavior (unless it is tested
elsewhere).
--
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]