This is an automated email from the ASF dual-hosted git repository.

maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 4964f6468ed6104260e6486aea8b00f85f5a8f0c
Author: Xiaozhong Wang <[email protected]>
AuthorDate: Fri Jan 5 10:29:49 2024 +0800

    gp_sparse_vector: minor fixes to avoid unexpected issues
    
    The previous "type char" issue of gp_sparse_vector exposed two other
    issues: a variable is not initialized and an exit condition is too
    strict.
    
    Fix these two issues even they are likely safe after the commit "Build
    gp_sparse_vector with the type char signed".
---
 gpcontrib/gp_sparse_vector/SparseData.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gpcontrib/gp_sparse_vector/SparseData.h 
b/gpcontrib/gp_sparse_vector/SparseData.h
index 34dd8b0a8e..755cf83606 100644
--- a/gpcontrib/gp_sparse_vector/SparseData.h
+++ b/gpcontrib/gp_sparse_vector/SparseData.h
@@ -259,8 +259,11 @@ static inline int64 compword_to_int8(const char *entry)
                case 9:
                        memcpy(&num, &entry[1], sizeof(int64));
                        break;
+
                default:
-                       abort();
+                       ereport(ERROR,
+                               (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+                                errmsg("compword_to_int8 got an error size 
%d", size)));
        }
 
        return num;
@@ -736,7 +739,8 @@ static inline SparseData op_sdata_by_sdata(int 
operation,SparseData left,
                }
                tot_run_length += (nextpos-lastpos);
 //             printf("New_value,runlength = 
%f,%d\n",new_value,nextpos-lastpos);
-               if 
((left_nxt==right_nxt)&&(left_nxt==(left->total_value_count))) {
+               if ((left_nxt>=(left->total_value_count)) &&
+                       (right_nxt>=(right->total_value_count))) {
 //                     printf("STOPPING: 
i,j,left_nxt,right_nxt,nextpos=%d,%d,%d,%d,%d\n",i,j,nextpos,left_nxt,right_nxt);
                        break;
                } else if (left_nxt==right_nxt) {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to