You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/08/13 11:22:51 UTC
[GitHub] [flink] Airblader commented on a change in pull request #16813: [FLINK-23595][formats / json] JSON format support deserialize non-numeric numbe fields
Airblader commented on a change in pull request #16813:
URL: https://github.com/apache/flink/pull/16813#discussion_r688437613
##########
File path: docs/content.zh/docs/connectors/table/formats/json.md
##########
@@ -55,7 +55,8 @@ CREATE TABLE user_behavior (
'properties.group.id' = 'testGroup',
'format' = 'json',
'json.fail-on-missing-field' = 'false',
- 'json.ignore-parse-errors' = 'true'
+ 'json.ignore-parse-errors' = 'true',
+ 'json.allow-non-numeric-numbers' = 'true'
Review comment:
The indentation here seems to be wrong.
##########
File path: flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/canal/CanalJsonFormatFactory.java
##########
@@ -43,6 +43,7 @@
import java.util.HashSet;
import java.util.Set;
+import static org.apache.flink.formats.json.JsonFormatOptions.ALLOW_NON_NUMERIC_NUMBERS;
Review comment:
Canal / Maxwell / Debezium shouldn't be importing from `JsonFormatOptions`, those options should be redirected through `CanalJsonFormatOptions` etc. This is already wrong for `ENCODE_DECIMAL_AS_PLAIN_NUMBER`. Can you please fix these (and in the other locations)?
##########
File path: flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/JsonFormatOptions.java
##########
@@ -73,6 +73,13 @@
.withDescription(
"Optional flag to specify whether to encode all decimals as plain numbers instead of possible scientific notations, false by default.");
+ public static final ConfigOption<Boolean> ALLOW_NON_NUMERIC_NUMBERS =
+ ConfigOptions.key("allow-non-numeric-numbers")
+ .booleanType()
+ .defaultValue(false)
+ .withDescription(
+ "Optional flag to specify whether to deserialize non-numeric number instead of failing, false by default.");
Review comment:
Can we remove "optional" and "false by default" here? Both of those information are defined elsewhere (`defaultValue` and `optionalOptions`) and thus create duplication.
--
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-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org