You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "Qianyi951015 (via GitHub)" <gi...@apache.org> on 2023/02/13 08:00:46 UTC

[GitHub] [shardingsphere] Qianyi951015 commented on a diff in pull request #24134: Refactor `NoneYamlTupleProcessor`

Qianyi951015 commented on code in PR #24134:
URL: https://github.com/apache/shardingsphere/pull/24134#discussion_r1104107032


##########
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/yaml/engine/representer/processor/NoneYamlTupleProcessor.java:
##########
@@ -37,11 +37,11 @@ public String getTupleName() {
     
     @Override
     public NodeTuple process(final NodeTuple nodeTuple) {
-        return (isNullNode(nodeTuple.getValueNode()) || isEmptyMappingNode(nodeTuple.getValueNode())) ? null : processNoneTuple(nodeTuple);
+        return (isNullNode(nodeTuple.getKeyNode(), nodeTuple.getValueNode()) || isEmptyMappingNode(nodeTuple.getValueNode())) ? processNoneTuple(nodeTuple) : null;
     }
     
-    private boolean isNullNode(final Node valueNode) {
-        return Tag.NULL.equals(valueNode.getTag());
+    private boolean isNullNode(final Node keyNode, final Node valueNode) {
+        return !"none".equalsIgnoreCase(((ScalarNode) keyNode).getValue()) && Tag.NULL.equals(valueNode.getTag());

Review Comment:
   If yaml text contains `none: 'xxx'` , the node will still be `none`
   ![image](https://user-images.githubusercontent.com/57847965/218402232-3b2d0643-50bd-48eb-9f7c-503e3ad0b0d3.png)
   
   ![image](https://user-images.githubusercontent.com/57847965/218402173-fde6cb1a-a83b-463a-b3e1-30147ede0310.png)
   



-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org