Documentation
¶
Overview ¶
Copyright 2022 Matrix Origin
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func NewGroupConcat(arg *Argument, typs []types.Type) agg.Agg[any]
- func VectorToString(vec *vector.Vector, rowIndex int) (string, error)
- type Argument
- func (*Argument) Descriptor() ([]byte, []int)
- func (m *Argument) GetDist() bool
- func (m *Argument) GetGroupExpr() []*plan.Expr
- func (m *Argument) GetOrderByExpr() []*plan.Expr
- func (m *Argument) GetOrderId() int32
- func (m *Argument) GetSeparator() string
- func (m *Argument) Marshal() (dAtA []byte, err error)
- func (m *Argument) MarshalTo(dAtA []byte) (int, error)
- func (m *Argument) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Argument) ProtoMessage()
- func (m *Argument) ProtoSize() (n int)
- func (m *Argument) Reset()
- func (m *Argument) String() string
- func (m *Argument) Unmarshal(dAtA []byte) error
- func (m *Argument) XXX_DiscardUnknown()
- func (m *Argument) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Argument) XXX_Merge(src proto.Message)
- func (m *Argument) XXX_Size() int
- func (m *Argument) XXX_Unmarshal(b []byte) error
- type EncodeGroupConcat
- func (*EncodeGroupConcat) Descriptor() ([]byte, []int)
- func (m *EncodeGroupConcat) GetArg() *Argument
- func (m *EncodeGroupConcat) GetGroups() int
- func (m *EncodeGroupConcat) GetInsertsStrData() []byte
- func (m *EncodeGroupConcat) GetResStrData() []byte
- func (m *EncodeGroupConcat) Marshal() (dAtA []byte, err error)
- func (m *EncodeGroupConcat) MarshalBinary() ([]byte, error)
- func (m *EncodeGroupConcat) MarshalTo(dAtA []byte) (int, error)
- func (m *EncodeGroupConcat) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*EncodeGroupConcat) ProtoMessage()
- func (m *EncodeGroupConcat) ProtoSize() (n int)
- func (m *EncodeGroupConcat) Reset()
- func (m *EncodeGroupConcat) String() string
- func (m *EncodeGroupConcat) Unmarshal(dAtA []byte) error
- func (m *EncodeGroupConcat) UnmarshalBinary(data []byte) error
- func (m *EncodeGroupConcat) XXX_DiscardUnknown()
- func (m *EncodeGroupConcat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *EncodeGroupConcat) XXX_Merge(src proto.Message)
- func (m *EncodeGroupConcat) XXX_Size() int
- func (m *EncodeGroupConcat) XXX_Unmarshal(b []byte) error
- type GroupConcat
- func (gc *GroupConcat) BatchFill(offset int64, os []uint8, vps []uint64, vecs []*vector.Vector) error
- func (gc *GroupConcat) BatchMerge(agg2 agg.Agg[any], start int64, os []uint8, vps []uint64) error
- func (gc *GroupConcat) BulkFill(groupIndex int64, vecs []*vector.Vector) error
- func (gc *GroupConcat) Eval(m *mpool.MPool) (*vector.Vector, error)
- func (gc *GroupConcat) Fill(groupIndex int64, rowIndex int64, vecs []*vector.Vector) error
- func (gc *GroupConcat) Free(*mpool.MPool)
- func (gc *GroupConcat) GetInputTypes() []types.Type
- func (gc *GroupConcat) GetOperatorId() int
- func (gc *GroupConcat) Grows(n int, m *mpool.MPool) error
- func (gc *GroupConcat) InputTypes() []types.Type
- func (gc *GroupConcat) IsDistinct() bool
- func (gc *GroupConcat) MarshalBinary() (data []byte, err error)
- func (gc *GroupConcat) Merge(agg2 agg.Agg[any], groupIndex1 int64, groupIndex2 int64) error
- func (gc *GroupConcat) OutputType() types.Type
- func (gc *GroupConcat) UnmarshalBinary(data []byte) error
- func (gc *GroupConcat) WildAggReAlloc(m *mpool.MPool) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type Argument ¶
type Argument struct { Dist bool GroupExpr []*plan.Expr // group Expressions OrderByExpr []*plan.Expr // orderby Expressions, for now we don't care about it Separator string // because we store multiAgg and UnaryAgg separately. // we use this to record the order in sql. // like 'select group_concat(a),avg(a) from t;' // this orderId will be 0. // but for 'select avg(a), group_concat(a) from t;' // this orderId will be 1. OrderId int32 }
for example: group_concat(distinct a,b order by a seporator '|') dist: true groupExpr: a,b orderByExpr: a separator: "|"
func (*Argument) Descriptor ¶ added in v0.8.0
func (*Argument) GetGroupExpr ¶ added in v0.8.0
func (*Argument) GetOrderByExpr ¶ added in v0.8.0
func (*Argument) GetOrderId ¶ added in v0.8.0
func (*Argument) GetSeparator ¶ added in v0.8.0
func (*Argument) MarshalToSizedBuffer ¶ added in v0.8.0
func (*Argument) ProtoMessage ¶ added in v0.8.0
func (*Argument) ProtoMessage()
func (*Argument) XXX_DiscardUnknown ¶ added in v0.8.0
func (m *Argument) XXX_DiscardUnknown()
func (*Argument) XXX_Marshal ¶ added in v0.8.0
func (*Argument) XXX_Unmarshal ¶ added in v0.8.0
type EncodeGroupConcat ¶
type EncodeGroupConcat struct { ResStrData []byte InsertsStrData []byte Arg *Argument Ityp []types.Type Groups int }
func (*EncodeGroupConcat) Descriptor ¶ added in v0.8.0
func (*EncodeGroupConcat) Descriptor() ([]byte, []int)
func (*EncodeGroupConcat) GetArg ¶ added in v0.8.0
func (m *EncodeGroupConcat) GetArg() *Argument
func (*EncodeGroupConcat) GetGroups ¶ added in v0.8.0
func (m *EncodeGroupConcat) GetGroups() int
func (*EncodeGroupConcat) GetInsertsStrData ¶ added in v0.8.0
func (m *EncodeGroupConcat) GetInsertsStrData() []byte
func (*EncodeGroupConcat) GetResStrData ¶ added in v0.8.0
func (m *EncodeGroupConcat) GetResStrData() []byte
func (*EncodeGroupConcat) Marshal ¶ added in v0.8.0
func (m *EncodeGroupConcat) Marshal() (dAtA []byte, err error)
func (*EncodeGroupConcat) MarshalBinary ¶ added in v0.8.0
func (m *EncodeGroupConcat) MarshalBinary() ([]byte, error)
func (*EncodeGroupConcat) MarshalTo ¶ added in v0.8.0
func (m *EncodeGroupConcat) MarshalTo(dAtA []byte) (int, error)
func (*EncodeGroupConcat) MarshalToSizedBuffer ¶ added in v0.8.0
func (m *EncodeGroupConcat) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*EncodeGroupConcat) ProtoMessage ¶ added in v0.8.0
func (*EncodeGroupConcat) ProtoMessage()
func (*EncodeGroupConcat) ProtoSize ¶ added in v0.8.0
func (m *EncodeGroupConcat) ProtoSize() (n int)
func (*EncodeGroupConcat) Reset ¶ added in v0.8.0
func (m *EncodeGroupConcat) Reset()
func (*EncodeGroupConcat) String ¶ added in v0.8.0
func (m *EncodeGroupConcat) String() string
func (*EncodeGroupConcat) Unmarshal ¶ added in v0.8.0
func (m *EncodeGroupConcat) Unmarshal(dAtA []byte) error
func (*EncodeGroupConcat) UnmarshalBinary ¶ added in v0.8.0
func (m *EncodeGroupConcat) UnmarshalBinary(data []byte) error
func (*EncodeGroupConcat) XXX_DiscardUnknown ¶ added in v0.8.0
func (m *EncodeGroupConcat) XXX_DiscardUnknown()
func (*EncodeGroupConcat) XXX_Marshal ¶ added in v0.8.0
func (m *EncodeGroupConcat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*EncodeGroupConcat) XXX_Merge ¶ added in v0.8.0
func (m *EncodeGroupConcat) XXX_Merge(src proto.Message)
func (*EncodeGroupConcat) XXX_Size ¶ added in v0.8.0
func (m *EncodeGroupConcat) XXX_Size() int
func (*EncodeGroupConcat) XXX_Unmarshal ¶ added in v0.8.0
func (m *EncodeGroupConcat) XXX_Unmarshal(b []byte) error
type GroupConcat ¶
type GroupConcat struct {
// contains filtered or unexported fields
}
+------+------+------+ | a | b | c | +------+------+------+ | 1 | 2 | 3 | | 4 | 5 | 6 | +------+------+------+ select group_concat(a,b,c separator "|") from t; res[0] = "123|456" inserts = "encode(1,2,3)|encode(4,5,6) we need inserts to store the source keys, so we can use then where merge
func (*GroupConcat) BatchFill ¶
func (gc *GroupConcat) BatchFill(offset int64, os []uint8, vps []uint64, vecs []*vector.Vector) error
BatchFill use part of the vector to update the data of agg's group
os(origin-s) records information about which groups need to be updated if length of os is N, we use first N of vps to do update work. And if os[i] > 0, it means the agg's (vps[i]-1)th group is a new one (never been assigned a value), Maybe this feature can help us to do some optimization work. So we use the os as a parameter but not len(os). agg's (vps[i]-1)th group is related to vector's (offset+i)th row. rowCounts[i] is count number of the row[i]
For a more detailed introduction of rowCounts, please refer to comments of Function Fill.
func (*GroupConcat) BatchMerge ¶
BatchMerge merges multi groups of agg1 and agg2
agg1's (vps[i]-1)th group is related to agg2's (start+i)th group
For more introduction of os, please refer to comments of Function BatchFill.
func (*GroupConcat) BulkFill ¶
func (gc *GroupConcat) BulkFill(groupIndex int64, vecs []*vector.Vector) error
func (*GroupConcat) Eval ¶
Eval method calculates and returns the final result of the aggregate function.
func (*GroupConcat) Fill ¶
Fill use the rowIndex-rows of vector to update the data of groupIndex-group. rowCount indicates the number of times the rowIndex-row is repeated. for group_concat(distinct a,b,c separator '|'); vecs is: a,b,c remember that, we won't do evalExpr here, so the groupExpr is not used here
func (*GroupConcat) GetInputTypes ¶
func (gc *GroupConcat) GetInputTypes() []types.Type
GetInputTypes get types of aggregate's input arguments.
func (*GroupConcat) GetOperatorId ¶
func (gc *GroupConcat) GetOperatorId() int
GetOperatorId get types of aggregate's aggregate id. this is used to print log in group string();
func (*GroupConcat) Grows ¶
func (gc *GroupConcat) Grows(n int, m *mpool.MPool) error
Grows allocates n groups for the agg.
func (*GroupConcat) InputTypes ¶
func (gc *GroupConcat) InputTypes() []types.Type
group_concat is not a normal agg func, we don't need this func
func (*GroupConcat) IsDistinct ¶
func (gc *GroupConcat) IsDistinct() bool
func (*GroupConcat) MarshalBinary ¶
func (gc *GroupConcat) MarshalBinary() (data []byte, err error)
We need to implements the interface of Agg
func (*GroupConcat) Merge ¶
Merge will merge a couple of group between 2 aggregate function structures. It merges the groupIndex1-group of agg1 and groupIndex2-group of agg2
func (*GroupConcat) OutputType ¶
func (gc *GroupConcat) OutputType() types.Type
Type return the type of the agg's result.
func (*GroupConcat) UnmarshalBinary ¶
func (gc *GroupConcat) UnmarshalBinary(data []byte) error
encoding.BinaryUnmarshaler
func (*GroupConcat) WildAggReAlloc ¶
func (gc *GroupConcat) WildAggReAlloc(m *mpool.MPool) error
WildAggReAlloc reallocate for agg structure from memory pool.