You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/09/14 08:44:04 UTC

[GitHub] [doris] yinzhijian opened a new pull request, #12601: [fix](vstream load) Fix the default value insertion problem when importing json

yinzhijian opened a new pull request, #12601:
URL: https://github.com/apache/doris/pull/12601

   # Proposed changes
   
   Issue Number: close #xxx
   
   ## Problem summary
   
   ### table schema
   +-------+---------+------+-------+---------+-------+
   | Field | Type | Null | Key | Default | Extra |
   +-------+---------+------+-------+---------+-------+
   | k1 | CHAR(1) | Yes | true | NULL | |
   | v1 | CHAR(1) | Yes | false | NULL | NONE |
   +-------+---------+------+-------+---------+-------+
   
   ### load data
   [
   {"k1": "h", "v1": "h"},
   {"xxx": "hello", "yyy": "hello"}
   ]
   ### special param
   max_filter_ratio:1
   
   ### actual result
       "TxnId": 9021,
       "Label": "08d050ff-20ca-42a4-bc0f-3bb49f3688ec",
       "TwoPhaseCommit": "false",
       "Status": "Success",
       "Message": "OK",
       "NumberTotalRows": 2,
       "NumberLoadedRows": 2,
       "NumberFilteredRows": 1,
       "NumberUnselectedRows": 0,
   
   ### expect result
   NumberLoadedRows should be 1
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: 
       - [x] Yes
       - [ ] No
       - [ ] I don't know
   2. Has unit tests been added:
       - [x] Yes
       - [ ] No
       - [ ] No Need
   3. Has document been added or modified:
       - [ ] Yes
       - [ ] No
       - [x] No Need
   4. Does it need to update dependencies:
       - [ ] Yes
       - [x] No
   5. Are there any changes that cannot be rolled back:
       - [ ] Yes (If Yes, please explain WHY)
       - [x] No
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #12601: [fix](vstream load) Fix the default value insertion problem when importing json

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #12601:
URL: https://github.com/apache/doris/pull/12601#issuecomment-1247817994

   PR approved by anyone and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #12601: [fix](vstream load) Fix the default value insertion problem when importing json

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #12601:
URL: https://github.com/apache/doris/pull/12601#issuecomment-1247817943

   PR approved by at least one committer and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] yangzhg merged pull request #12601: [fix](vstream load) Fix the default value insertion problem when importing json

Posted by GitBox <gi...@apache.org>.
yangzhg merged PR #12601:
URL: https://github.com/apache/doris/pull/12601


-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] yangzhg commented on a diff in pull request #12601: [fix](vstream load) Fix the default value insertion problem when importing json

Posted by GitBox <gi...@apache.org>.
yangzhg commented on code in PR #12601:
URL: https://github.com/apache/doris/pull/12601#discussion_r970709479


##########
be/src/vec/exec/vjson_scanner.cpp:
##########
@@ -273,12 +273,29 @@ Status VJsonReader::_set_column_value(rapidjson::Value& objectValue,
             }
         }
     }
-
-    if (nullcount == slot_descs.size()) {
+    if (!has_valid_value) {
         RETURN_IF_ERROR(_append_error_msg(objectValue, "All fields is null, this is a invalid row.",
                                           "", valid));
         return Status::OK();
     }
+    ctx_idx = 0;
+    int nullcount = 0;
+    // fill missing slot
+    for (auto slot_desc : slot_descs) {
+        if (!slot_desc->is_materialized()) {
+            continue;
+        }
+        int dest_index = ctx_idx++;
+        auto* column_ptr = columns[dest_index].get();
+        if (column_ptr->size() < cur_row_count + 1) {
+            assert(column_ptr->size() == cur_row_count);
+            column_ptr->assume_mutable()->insert_default();
+            ++nullcount;
+        }
+        assert(column_ptr->size() == cur_row_count + 1);
+    }
+    // There is at least one valid value here
+    assert(nullcount < columns.size());

Review Comment:
   not use assert



-- 
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: commits-unsubscribe@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org