github.com/matrixorigin/matrixone@v1.2.0/pkg/testutil/util_debug.go (about)

     1  // Copyright 2021 Matrix Origin
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package testutil
    16  
    17  import (
    18  	"fmt"
    19  
    20  	"github.com/matrixorigin/matrixone/pkg/container/batch"
    21  )
    22  
    23  var _ = OperatorCatchBatch
    24  
    25  // OperatorCatchBatch return a string with format
    26  //
    27  //	`insert operator catch a batch, batch length is 100, [vec 0 : len is 100]`
    28  func OperatorCatchBatch(operatorName string, bat *batch.Batch) string {
    29  	if bat == nil {
    30  		return ""
    31  	}
    32  	str := fmt.Sprintf("`%s` operator catch a batch, batch length is %d\n", operatorName, bat.RowCount())
    33  	for i, vec := range bat.Vecs {
    34  		str += fmt.Sprintf("[vec-%d(%s)[type is %v, %p] : len is %d]\n", i,
    35  			bat.Attrs[i],
    36  			vec.GetType().Oid, vec,
    37  			vec.Length())
    38  	}
    39  	return str
    40  }