From bed15fa6571b57f3a35eebd2fa96e884c1aa9316 Mon Sep 17 00:00:00 2001 From: shuwenwei Date: Mon, 14 Apr 2025 11:45:16 +0800 Subject: [PATCH 1/2] add ExecuteGroupByQueryIntervalQuery --- client/session.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/client/session.go b/client/session.go index 34ff5dd..ef65721 100644 --- a/client/session.go +++ b/client/session.go @@ -541,6 +541,33 @@ func (s *Session) ExecuteAggregationQueryWithLegalNodes(paths []string, aggregat } } +func (s *Session) ExecuteGroupByQueryIntervalQuery(database *string, device, measurement string, aggregationType common.TAggregationType, + dataType int32, startTime *int64, endTime *int64, interval *int64, timeoutMs *int64, isAligned *bool) (*SessionDataSet, error) { + + request := rpc.TSGroupByQueryIntervalReq{SessionId: s.sessionId, StatementId: s.requestStatementId, + Database: database, Device: device, Measurement: measurement, AggregationType: aggregationType, DataType: dataType, + StartTime: startTime, EndTime: endTime, Interval: interval, FetchSize: &s.config.FetchSize, + Timeout: timeoutMs, IsAligned: isAligned} + if resp, err := s.client.ExecuteGroupByQueryIntervalQuery(context.Background(), &request); err == nil { + if statusErr := VerifySuccess(resp.Status); statusErr == nil { + return NewSessionDataSet("", resp.Columns, resp.DataTypeList, resp.ColumnNameIndexMap, *resp.QueryId, s.client, s.sessionId, resp.QueryDataSet, resp.IgnoreTimeStamp != nil && *resp.IgnoreTimeStamp, s.config.FetchSize, timeoutMs), err + } else { + return nil, statusErr + } + } else { + if s.reconnect() { + request.SessionId = s.sessionId + resp, err = s.client.ExecuteGroupByQueryIntervalQuery(context.Background(), &request) + if statusErr := VerifySuccess(resp.Status); statusErr == nil { + return NewSessionDataSet("", resp.Columns, resp.DataTypeList, resp.ColumnNameIndexMap, *resp.QueryId, s.client, s.sessionId, resp.QueryDataSet, resp.IgnoreTimeStamp != nil && *resp.IgnoreTimeStamp, s.config.FetchSize, timeoutMs), err + } else { + return nil, statusErr + } + } + return nil, err + } +} + func (s *Session) genTSInsertRecordReq(deviceId string, time int64, measurements []string, types []TSDataType, From 77e2d3b2f75fd22060039d4d10d7cf7fda582f8f Mon Sep 17 00:00:00 2001 From: shuwenwei Date: Mon, 14 Apr 2025 11:46:05 +0800 Subject: [PATCH 2/2] update generated files --- common/common.go | 802 +++++++++++++++++++++++++++++++++++++++++++---- rpc/client.go | 51 +++ 2 files changed, 792 insertions(+), 61 deletions(-) diff --git a/common/common.go b/common/common.go index 983a00d..6de89dd 100644 --- a/common/common.go +++ b/common/common.go @@ -439,6 +439,68 @@ func (p * TAggregationType) Value() (driver.Value, error) { } return int64(*p), nil } +type TrainingState int64 +const ( + TrainingState_PENDING TrainingState = 0 + TrainingState_RUNNING TrainingState = 1 + TrainingState_FINISHED TrainingState = 2 + TrainingState_FAILED TrainingState = 3 + TrainingState_DROPPING TrainingState = 4 +) + +func (p TrainingState) String() string { + switch p { + case TrainingState_PENDING: return "PENDING" + case TrainingState_RUNNING: return "RUNNING" + case TrainingState_FINISHED: return "FINISHED" + case TrainingState_FAILED: return "FAILED" + case TrainingState_DROPPING: return "DROPPING" + } + return "" +} + +func TrainingStateFromString(s string) (TrainingState, error) { + switch s { + case "PENDING": return TrainingState_PENDING, nil + case "RUNNING": return TrainingState_RUNNING, nil + case "FINISHED": return TrainingState_FINISHED, nil + case "FAILED": return TrainingState_FAILED, nil + case "DROPPING": return TrainingState_DROPPING, nil + } + return TrainingState(0), fmt.Errorf("not a valid TrainingState string") +} + + +func TrainingStatePtr(v TrainingState) *TrainingState { return &v } + +func (p TrainingState) MarshalText() ([]byte, error) { +return []byte(p.String()), nil +} + +func (p *TrainingState) UnmarshalText(text []byte) error { +q, err := TrainingStateFromString(string(text)) +if (err != nil) { +return err +} +*p = q +return nil +} + +func (p *TrainingState) Scan(value interface{}) error { +v, ok := value.(int64) +if !ok { +return errors.New("Scan value is not int64") +} +*p = TrainingState(v) +return nil +} + +func (p * TrainingState) Value() (driver.Value, error) { + if p == nil { + return nil, nil + } +return int64(*p), nil +} // Attributes: // - IP // - Port @@ -2152,6 +2214,161 @@ func (p *TDataNodeLocation) String() string { return fmt.Sprintf("TDataNodeLocation(%+v)", *p) } +// Attributes: +// - AiNodeId +// - InternalEndPoint +type TAINodeLocation struct { + AiNodeId int32 `thrift:"aiNodeId,1,required" db:"aiNodeId" json:"aiNodeId"` + InternalEndPoint *TEndPoint `thrift:"internalEndPoint,2,required" db:"internalEndPoint" json:"internalEndPoint"` +} + +func NewTAINodeLocation() *TAINodeLocation { + return &TAINodeLocation{} +} + + +func (p *TAINodeLocation) GetAiNodeId() int32 { + return p.AiNodeId +} +var TAINodeLocation_InternalEndPoint_DEFAULT *TEndPoint +func (p *TAINodeLocation) GetInternalEndPoint() *TEndPoint { + if !p.IsSetInternalEndPoint() { + return TAINodeLocation_InternalEndPoint_DEFAULT + } +return p.InternalEndPoint +} +func (p *TAINodeLocation) IsSetInternalEndPoint() bool { + return p.InternalEndPoint != nil +} + +func (p *TAINodeLocation) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + var issetAiNodeId bool = false; + var issetInternalEndPoint bool = false; + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.I32 { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + issetAiNodeId = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 2: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField2(ctx, iprot); err != nil { + return err + } + issetInternalEndPoint = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + if !issetAiNodeId{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field AiNodeId is not set")); + } + if !issetInternalEndPoint{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field InternalEndPoint is not set")); + } + return nil +} + +func (p *TAINodeLocation) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadI32(ctx); err != nil { + return thrift.PrependError("error reading field 1: ", err) +} else { + p.AiNodeId = v +} + return nil +} + +func (p *TAINodeLocation) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + p.InternalEndPoint = &TEndPoint{} + if err := p.InternalEndPoint.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.InternalEndPoint), err) + } + return nil +} + +func (p *TAINodeLocation) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TAINodeLocation"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *TAINodeLocation) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "aiNodeId", thrift.I32, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:aiNodeId: ", p), err) } + if err := oprot.WriteI32(ctx, int32(p.AiNodeId)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.aiNodeId (1) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:aiNodeId: ", p), err) } + return err +} + +func (p *TAINodeLocation) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "internalEndPoint", thrift.STRUCT, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:internalEndPoint: ", p), err) } + if err := p.InternalEndPoint.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.InternalEndPoint), err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:internalEndPoint: ", p), err) } + return err +} + +func (p *TAINodeLocation) Equals(other *TAINodeLocation) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.AiNodeId != other.AiNodeId { return false } + if !p.InternalEndPoint.Equals(other.InternalEndPoint) { return false } + return true +} + +func (p *TAINodeLocation) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TAINodeLocation(%+v)", *p) +} + // Attributes: // - Location // - Resource @@ -2314,12 +2531,176 @@ func (p *TDataNodeConfiguration) String() string { return fmt.Sprintf("TDataNodeConfiguration(%+v)", *p) } +// Attributes: +// - Location +// - Resource +type TAINodeConfiguration struct { + Location *TAINodeLocation `thrift:"location,1,required" db:"location" json:"location"` + Resource *TNodeResource `thrift:"resource,2,required" db:"resource" json:"resource"` +} + +func NewTAINodeConfiguration() *TAINodeConfiguration { + return &TAINodeConfiguration{} +} + +var TAINodeConfiguration_Location_DEFAULT *TAINodeLocation +func (p *TAINodeConfiguration) GetLocation() *TAINodeLocation { + if !p.IsSetLocation() { + return TAINodeConfiguration_Location_DEFAULT + } +return p.Location +} +var TAINodeConfiguration_Resource_DEFAULT *TNodeResource +func (p *TAINodeConfiguration) GetResource() *TNodeResource { + if !p.IsSetResource() { + return TAINodeConfiguration_Resource_DEFAULT + } +return p.Resource +} +func (p *TAINodeConfiguration) IsSetLocation() bool { + return p.Location != nil +} + +func (p *TAINodeConfiguration) IsSetResource() bool { + return p.Resource != nil +} + +func (p *TAINodeConfiguration) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + var issetLocation bool = false; + var issetResource bool = false; + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + issetLocation = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 2: + if fieldTypeId == thrift.STRUCT { + if err := p.ReadField2(ctx, iprot); err != nil { + return err + } + issetResource = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + if !issetLocation{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Location is not set")); + } + if !issetResource{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field Resource is not set")); + } + return nil +} + +func (p *TAINodeConfiguration) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + p.Location = &TAINodeLocation{} + if err := p.Location.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Location), err) + } + return nil +} + +func (p *TAINodeConfiguration) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + p.Resource = &TNodeResource{} + if err := p.Resource.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Resource), err) + } + return nil +} + +func (p *TAINodeConfiguration) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TAINodeConfiguration"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *TAINodeConfiguration) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "location", thrift.STRUCT, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:location: ", p), err) } + if err := p.Location.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Location), err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:location: ", p), err) } + return err +} + +func (p *TAINodeConfiguration) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "resource", thrift.STRUCT, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:resource: ", p), err) } + if err := p.Resource.Write(ctx, oprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Resource), err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:resource: ", p), err) } + return err +} + +func (p *TAINodeConfiguration) Equals(other *TAINodeConfiguration) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if !p.Location.Equals(other.Location) { return false } + if !p.Resource.Equals(other.Resource) { return false } + return true +} + +func (p *TAINodeConfiguration) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TAINodeConfiguration(%+v)", *p) +} + // Attributes: // - IsSeq // - StorageGroups +// - RegionIds type TFlushReq struct { IsSeq *string `thrift:"isSeq,1" db:"isSeq" json:"isSeq,omitempty"` StorageGroups []string `thrift:"storageGroups,2" db:"storageGroups" json:"storageGroups,omitempty"` + RegionIds []string `thrift:"regionIds,3" db:"regionIds" json:"regionIds,omitempty"` } func NewTFlushReq() *TFlushReq { @@ -2338,6 +2719,11 @@ var TFlushReq_StorageGroups_DEFAULT []string func (p *TFlushReq) GetStorageGroups() []string { return p.StorageGroups } +var TFlushReq_RegionIds_DEFAULT []string + +func (p *TFlushReq) GetRegionIds() []string { + return p.RegionIds +} func (p *TFlushReq) IsSetIsSeq() bool { return p.IsSeq != nil } @@ -2346,6 +2732,10 @@ func (p *TFlushReq) IsSetStorageGroups() bool { return p.StorageGroups != nil } +func (p *TFlushReq) IsSetRegionIds() bool { + return p.RegionIds != nil +} + func (p *TFlushReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) @@ -2379,6 +2769,16 @@ func (p *TFlushReq) Read(ctx context.Context, iprot thrift.TProtocol) error { return err } } + case 3: + if fieldTypeId == thrift.LIST { + if err := p.ReadField3(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } default: if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -2425,12 +2825,35 @@ var _elem4 string return nil } +func (p *TFlushReq) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + _, size, err := iprot.ReadListBegin(ctx) + if err != nil { + return thrift.PrependError("error reading list begin: ", err) + } + tSlice := make([]string, 0, size) + p.RegionIds = tSlice + for i := 0; i < size; i ++ { +var _elem5 string + if v, err := iprot.ReadString(ctx); err != nil { + return thrift.PrependError("error reading field 0: ", err) +} else { + _elem5 = v +} + p.RegionIds = append(p.RegionIds, _elem5) + } + if err := iprot.ReadListEnd(ctx); err != nil { + return thrift.PrependError("error reading list end: ", err) + } + return nil +} + func (p *TFlushReq) Write(ctx context.Context, oprot thrift.TProtocol) error { if err := oprot.WriteStructBegin(ctx, "TFlushReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } if p != nil { if err := p.writeField1(ctx, oprot); err != nil { return err } if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -2471,6 +2894,26 @@ func (p *TFlushReq) writeField2(ctx context.Context, oprot thrift.TProtocol) (er return err } +func (p *TFlushReq) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetRegionIds() { + if err := oprot.WriteFieldBegin(ctx, "regionIds", thrift.LIST, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:regionIds: ", p), err) } + if err := oprot.WriteListBegin(ctx, thrift.STRING, len(p.RegionIds)); err != nil { + return thrift.PrependError("error writing list begin: ", err) + } + for _, v := range p.RegionIds { + if err := oprot.WriteString(ctx, string(v)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T. (0) field write error: ", p), err) } + } + if err := oprot.WriteListEnd(ctx); err != nil { + return thrift.PrependError("error writing list end: ", err) + } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:regionIds: ", p), err) } + } + return err +} + func (p *TFlushReq) Equals(other *TFlushReq) bool { if p == other { return true @@ -2485,8 +2928,13 @@ func (p *TFlushReq) Equals(other *TFlushReq) bool { } if len(p.StorageGroups) != len(other.StorageGroups) { return false } for i, _tgt := range p.StorageGroups { - _src5 := other.StorageGroups[i] - if _tgt != _src5 { return false } + _src6 := other.StorageGroups[i] + if _tgt != _src6 { return false } + } + if len(p.RegionIds) != len(other.RegionIds) { return false } + for i, _tgt := range p.RegionIds { + _src7 := other.RegionIds[i] + if _tgt != _src7 { return false } } return true } @@ -2563,13 +3011,13 @@ func (p *TSettleReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) er tSlice := make([]string, 0, size) p.Paths = tSlice for i := 0; i < size; i ++ { -var _elem6 string +var _elem8 string if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem6 = v + _elem8 = v } - p.Paths = append(p.Paths, _elem6) + p.Paths = append(p.Paths, _elem8) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -2616,8 +3064,8 @@ func (p *TSettleReq) Equals(other *TSettleReq) bool { } if len(p.Paths) != len(other.Paths) { return false } for i, _tgt := range p.Paths { - _src7 := other.Paths[i] - if _tgt != _src7 { return false } + _src9 := other.Paths[i] + if _tgt != _src9 { return false } } return true } @@ -2864,19 +3312,19 @@ func (p *TSetConfigurationReq) ReadField1(ctx context.Context, iprot thrift.TPr tMap := make(map[string]string, size) p.Configs = tMap for i := 0; i < size; i ++ { -var _key8 string +var _key10 string if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _key8 = v + _key10 = v } -var _val9 string +var _val11 string if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _val9 = v + _val11 = v } - p.Configs[_key8] = _val9 + p.Configs[_key10] = _val11 } if err := iprot.ReadMapEnd(ctx); err != nil { return thrift.PrependError("error reading map end: ", err) @@ -2945,8 +3393,8 @@ func (p *TSetConfigurationReq) Equals(other *TSetConfigurationReq) bool { } if len(p.Configs) != len(other.Configs) { return false } for k, _tgt := range p.Configs { - _src10 := other.Configs[k] - if _tgt != _src10 { return false } + _src12 := other.Configs[k] + if _tgt != _src12 { return false } } if p.NodeId != other.NodeId { return false } return true @@ -3066,13 +3514,13 @@ func (p *TSetTTLReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) er tSlice := make([]string, 0, size) p.PathPattern = tSlice for i := 0; i < size; i ++ { -var _elem11 string +var _elem13 string if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem11 = v + _elem13 = v } - p.PathPattern = append(p.PathPattern, _elem11) + p.PathPattern = append(p.PathPattern, _elem13) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -3159,8 +3607,8 @@ func (p *TSetTTLReq) Equals(other *TSetTTLReq) bool { } if len(p.PathPattern) != len(other.PathPattern) { return false } for i, _tgt := range p.PathPattern { - _src12 := other.PathPattern[i] - if _tgt != _src12 { return false } + _src14 := other.PathPattern[i] + if _tgt != _src14 { return false } } if p.TTL != other.TTL { return false } if p.IsDataBase != other.IsDataBase { return false } @@ -3239,13 +3687,13 @@ func (p *TShowTTLReq) ReadField1(ctx context.Context, iprot thrift.TProtocol) e tSlice := make([]string, 0, size) p.PathPattern = tSlice for i := 0; i < size; i ++ { -var _elem13 string +var _elem15 string if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem13 = v + _elem15 = v } - p.PathPattern = append(p.PathPattern, _elem13) + p.PathPattern = append(p.PathPattern, _elem15) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -3292,8 +3740,8 @@ func (p *TShowTTLReq) Equals(other *TShowTTLReq) bool { } if len(p.PathPattern) != len(other.PathPattern) { return false } for i, _tgt := range p.PathPattern { - _src14 := other.PathPattern[i] - if _tgt != _src14 { return false } + _src16 := other.PathPattern[i] + if _tgt != _src16 { return false } } return true } @@ -3554,11 +4002,11 @@ func (p *TFilesResp) ReadField2(ctx context.Context, iprot thrift.TProtocol) er tSlice := make([]*TFile, 0, size) p.Files = tSlice for i := 0; i < size; i ++ { - _elem15 := &TFile{} - if err := _elem15.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem15), err) + _elem17 := &TFile{} + if err := _elem17.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem17), err) } - p.Files = append(p.Files, _elem15) + p.Files = append(p.Files, _elem17) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -3619,8 +4067,8 @@ func (p *TFilesResp) Equals(other *TFilesResp) bool { if !p.Status.Equals(other.Status) { return false } if len(p.Files) != len(other.Files) { return false } for i, _tgt := range p.Files { - _src16 := other.Files[i] - if !_tgt.Equals(_src16) { return false } + _src18 := other.Files[i] + if !_tgt.Equals(_src18) { return false } } return true } @@ -4108,18 +4556,18 @@ func (p *TThrottleQuota) ReadField1(ctx context.Context, iprot thrift.TProtocol tMap := make(map[ThrottleType]*TTimedQuota, size) p.ThrottleLimit = tMap for i := 0; i < size; i ++ { -var _key17 ThrottleType +var _key19 ThrottleType if v, err := iprot.ReadI32(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { temp := ThrottleType(v) - _key17 = temp + _key19 = temp } - _val18 := &TTimedQuota{} - if err := _val18.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _val18), err) + _val20 := &TTimedQuota{} + if err := _val20.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _val20), err) } - p.ThrottleLimit[_key17] = _val18 + p.ThrottleLimit[_key19] = _val20 } if err := iprot.ReadMapEnd(ctx); err != nil { return thrift.PrependError("error reading map end: ", err) @@ -4215,8 +4663,8 @@ func (p *TThrottleQuota) Equals(other *TThrottleQuota) bool { } if len(p.ThrottleLimit) != len(other.ThrottleLimit) { return false } for k, _tgt := range p.ThrottleLimit { - _src19 := other.ThrottleLimit[k] - if !_tgt.Equals(_src19) { return false } + _src21 := other.ThrottleLimit[k] + if !_tgt.Equals(_src21) { return false } } if p.MemLimit != other.MemLimit { if p.MemLimit == nil || other.MemLimit == nil { @@ -4333,13 +4781,13 @@ func (p *TSetSpaceQuotaReq) ReadField1(ctx context.Context, iprot thrift.TProto tSlice := make([]string, 0, size) p.Database = tSlice for i := 0; i < size; i ++ { -var _elem20 string +var _elem22 string if v, err := iprot.ReadString(ctx); err != nil { return thrift.PrependError("error reading field 0: ", err) } else { - _elem20 = v + _elem22 = v } - p.Database = append(p.Database, _elem20) + p.Database = append(p.Database, _elem22) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -4406,8 +4854,8 @@ func (p *TSetSpaceQuotaReq) Equals(other *TSetSpaceQuotaReq) bool { } if len(p.Database) != len(other.Database) { return false } for i, _tgt := range p.Database { - _src21 := other.Database[i] - if _tgt != _src21 { return false } + _src23 := other.Database[i] + if _tgt != _src23 { return false } } if !p.SpaceLimit.Equals(other.SpaceLimit) { return false } return true @@ -4976,6 +5424,238 @@ func (p *TLicense) String() string { return fmt.Sprintf("TLicense(%+v)", *p) } +// Attributes: +// - CpuUsageRate +// - MemoryUsageRate +// - DiskUsageRate +// - FreeDiskSpace +type TLoadSample struct { + CpuUsageRate float64 `thrift:"cpuUsageRate,1,required" db:"cpuUsageRate" json:"cpuUsageRate"` + MemoryUsageRate float64 `thrift:"memoryUsageRate,2,required" db:"memoryUsageRate" json:"memoryUsageRate"` + DiskUsageRate float64 `thrift:"diskUsageRate,3,required" db:"diskUsageRate" json:"diskUsageRate"` + FreeDiskSpace float64 `thrift:"freeDiskSpace,4,required" db:"freeDiskSpace" json:"freeDiskSpace"` +} + +func NewTLoadSample() *TLoadSample { + return &TLoadSample{} +} + + +func (p *TLoadSample) GetCpuUsageRate() float64 { + return p.CpuUsageRate +} + +func (p *TLoadSample) GetMemoryUsageRate() float64 { + return p.MemoryUsageRate +} + +func (p *TLoadSample) GetDiskUsageRate() float64 { + return p.DiskUsageRate +} + +func (p *TLoadSample) GetFreeDiskSpace() float64 { + return p.FreeDiskSpace +} +func (p *TLoadSample) Read(ctx context.Context, iprot thrift.TProtocol) error { + if _, err := iprot.ReadStructBegin(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) + } + + var issetCpuUsageRate bool = false; + var issetMemoryUsageRate bool = false; + var issetDiskUsageRate bool = false; + var issetFreeDiskSpace bool = false; + + for { + _, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(ctx) + if err != nil { + return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err) + } + if fieldTypeId == thrift.STOP { break; } + switch fieldId { + case 1: + if fieldTypeId == thrift.DOUBLE { + if err := p.ReadField1(ctx, iprot); err != nil { + return err + } + issetCpuUsageRate = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 2: + if fieldTypeId == thrift.DOUBLE { + if err := p.ReadField2(ctx, iprot); err != nil { + return err + } + issetMemoryUsageRate = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 3: + if fieldTypeId == thrift.DOUBLE { + if err := p.ReadField3(ctx, iprot); err != nil { + return err + } + issetDiskUsageRate = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + case 4: + if fieldTypeId == thrift.DOUBLE { + if err := p.ReadField4(ctx, iprot); err != nil { + return err + } + issetFreeDiskSpace = true + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + default: + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } + if err := iprot.ReadFieldEnd(ctx); err != nil { + return err + } + } + if err := iprot.ReadStructEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err) + } + if !issetCpuUsageRate{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field CpuUsageRate is not set")); + } + if !issetMemoryUsageRate{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field MemoryUsageRate is not set")); + } + if !issetDiskUsageRate{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field DiskUsageRate is not set")); + } + if !issetFreeDiskSpace{ + return thrift.NewTProtocolExceptionWithType(thrift.INVALID_DATA, fmt.Errorf("Required field FreeDiskSpace is not set")); + } + return nil +} + +func (p *TLoadSample) ReadField1(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadDouble(ctx); err != nil { + return thrift.PrependError("error reading field 1: ", err) +} else { + p.CpuUsageRate = v +} + return nil +} + +func (p *TLoadSample) ReadField2(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadDouble(ctx); err != nil { + return thrift.PrependError("error reading field 2: ", err) +} else { + p.MemoryUsageRate = v +} + return nil +} + +func (p *TLoadSample) ReadField3(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadDouble(ctx); err != nil { + return thrift.PrependError("error reading field 3: ", err) +} else { + p.DiskUsageRate = v +} + return nil +} + +func (p *TLoadSample) ReadField4(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadDouble(ctx); err != nil { + return thrift.PrependError("error reading field 4: ", err) +} else { + p.FreeDiskSpace = v +} + return nil +} + +func (p *TLoadSample) Write(ctx context.Context, oprot thrift.TProtocol) error { + if err := oprot.WriteStructBegin(ctx, "TLoadSample"); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } + if p != nil { + if err := p.writeField1(ctx, oprot); err != nil { return err } + if err := p.writeField2(ctx, oprot); err != nil { return err } + if err := p.writeField3(ctx, oprot); err != nil { return err } + if err := p.writeField4(ctx, oprot); err != nil { return err } + } + if err := oprot.WriteFieldStop(ctx); err != nil { + return thrift.PrependError("write field stop error: ", err) } + if err := oprot.WriteStructEnd(ctx); err != nil { + return thrift.PrependError("write struct stop error: ", err) } + return nil +} + +func (p *TLoadSample) writeField1(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "cpuUsageRate", thrift.DOUBLE, 1); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:cpuUsageRate: ", p), err) } + if err := oprot.WriteDouble(ctx, float64(p.CpuUsageRate)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.cpuUsageRate (1) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 1:cpuUsageRate: ", p), err) } + return err +} + +func (p *TLoadSample) writeField2(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "memoryUsageRate", thrift.DOUBLE, 2); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 2:memoryUsageRate: ", p), err) } + if err := oprot.WriteDouble(ctx, float64(p.MemoryUsageRate)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.memoryUsageRate (2) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 2:memoryUsageRate: ", p), err) } + return err +} + +func (p *TLoadSample) writeField3(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "diskUsageRate", thrift.DOUBLE, 3); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 3:diskUsageRate: ", p), err) } + if err := oprot.WriteDouble(ctx, float64(p.DiskUsageRate)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.diskUsageRate (3) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 3:diskUsageRate: ", p), err) } + return err +} + +func (p *TLoadSample) writeField4(ctx context.Context, oprot thrift.TProtocol) (err error) { + if err := oprot.WriteFieldBegin(ctx, "freeDiskSpace", thrift.DOUBLE, 4); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 4:freeDiskSpace: ", p), err) } + if err := oprot.WriteDouble(ctx, float64(p.FreeDiskSpace)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.freeDiskSpace (4) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 4:freeDiskSpace: ", p), err) } + return err +} + +func (p *TLoadSample) Equals(other *TLoadSample) bool { + if p == other { + return true + } else if p == nil || other == nil { + return false + } + if p.CpuUsageRate != other.CpuUsageRate { return false } + if p.MemoryUsageRate != other.MemoryUsageRate { return false } + if p.DiskUsageRate != other.DiskUsageRate { return false } + if p.FreeDiskSpace != other.FreeDiskSpace { return false } + return true +} + +func (p *TLoadSample) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TLoadSample(%+v)", *p) +} + // Attributes: // - EndPoint // - ServiceType @@ -5644,11 +6324,11 @@ func (p *TTestConnectionResp) ReadField2(ctx context.Context, iprot thrift.TPro tSlice := make([]*TTestConnectionResult_, 0, size) p.ResultList = tSlice for i := 0; i < size; i ++ { - _elem22 := &TTestConnectionResult_{} - if err := _elem22.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem22), err) + _elem24 := &TTestConnectionResult_{} + if err := _elem24.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem24), err) } - p.ResultList = append(p.ResultList, _elem22) + p.ResultList = append(p.ResultList, _elem24) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -5709,8 +6389,8 @@ func (p *TTestConnectionResp) Equals(other *TTestConnectionResp) bool { if !p.Status.Equals(other.Status) { return false } if len(p.ResultList) != len(other.ResultList) { return false } for i, _tgt := range p.ResultList { - _src23 := other.ResultList[i] - if !_tgt.Equals(_src23) { return false } + _src25 := other.ResultList[i] + if !_tgt.Equals(_src25) { return false } } return true } @@ -5808,11 +6488,11 @@ func (p *TNodeLocations) ReadField1(ctx context.Context, iprot thrift.TProtocol tSlice := make([]*TConfigNodeLocation, 0, size) p.ConfigNodeLocations = tSlice for i := 0; i < size; i ++ { - _elem24 := &TConfigNodeLocation{} - if err := _elem24.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem24), err) + _elem26 := &TConfigNodeLocation{} + if err := _elem26.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem26), err) } - p.ConfigNodeLocations = append(p.ConfigNodeLocations, _elem24) + p.ConfigNodeLocations = append(p.ConfigNodeLocations, _elem26) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -5828,11 +6508,11 @@ func (p *TNodeLocations) ReadField2(ctx context.Context, iprot thrift.TProtocol tSlice := make([]*TDataNodeLocation, 0, size) p.DataNodeLocations = tSlice for i := 0; i < size; i ++ { - _elem25 := &TDataNodeLocation{} - if err := _elem25.Read(ctx, iprot); err != nil { - return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem25), err) + _elem27 := &TDataNodeLocation{} + if err := _elem27.Read(ctx, iprot); err != nil { + return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", _elem27), err) } - p.DataNodeLocations = append(p.DataNodeLocations, _elem25) + p.DataNodeLocations = append(p.DataNodeLocations, _elem27) } if err := iprot.ReadListEnd(ctx); err != nil { return thrift.PrependError("error reading list end: ", err) @@ -5904,13 +6584,13 @@ func (p *TNodeLocations) Equals(other *TNodeLocations) bool { } if len(p.ConfigNodeLocations) != len(other.ConfigNodeLocations) { return false } for i, _tgt := range p.ConfigNodeLocations { - _src26 := other.ConfigNodeLocations[i] - if !_tgt.Equals(_src26) { return false } + _src28 := other.ConfigNodeLocations[i] + if !_tgt.Equals(_src28) { return false } } if len(p.DataNodeLocations) != len(other.DataNodeLocations) { return false } for i, _tgt := range p.DataNodeLocations { - _src27 := other.DataNodeLocations[i] - if !_tgt.Equals(_src27) { return false } + _src29 := other.DataNodeLocations[i] + if !_tgt.Equals(_src29) { return false } } return true } diff --git a/rpc/client.go b/rpc/client.go index f9d6ca6..88c4519 100644 --- a/rpc/client.go +++ b/rpc/client.go @@ -12823,6 +12823,7 @@ func (p *TSAggregationQueryReq) String() string { // - Interval // - FetchSize // - Timeout +// - IsAligned type TSGroupByQueryIntervalReq struct { SessionId int64 `thrift:"sessionId,1,required" db:"sessionId" json:"sessionId"` StatementId int64 `thrift:"statementId,2,required" db:"statementId" json:"statementId"` @@ -12836,6 +12837,7 @@ type TSGroupByQueryIntervalReq struct { Interval *int64 `thrift:"interval,10" db:"interval" json:"interval,omitempty"` FetchSize *int32 `thrift:"fetchSize,11" db:"fetchSize" json:"fetchSize,omitempty"` Timeout *int64 `thrift:"timeout,12" db:"timeout" json:"timeout,omitempty"` + IsAligned *bool `thrift:"isAligned,13" db:"isAligned" json:"isAligned,omitempty"` } func NewTSGroupByQueryIntervalReq() *TSGroupByQueryIntervalReq { @@ -12908,6 +12910,13 @@ func (p *TSGroupByQueryIntervalReq) GetTimeout() int64 { } return *p.Timeout } +var TSGroupByQueryIntervalReq_IsAligned_DEFAULT bool +func (p *TSGroupByQueryIntervalReq) GetIsAligned() bool { + if !p.IsSetIsAligned() { + return TSGroupByQueryIntervalReq_IsAligned_DEFAULT + } +return *p.IsAligned +} func (p *TSGroupByQueryIntervalReq) IsSetDatabase() bool { return p.Database != nil } @@ -12932,6 +12941,10 @@ func (p *TSGroupByQueryIntervalReq) IsSetTimeout() bool { return p.Timeout != nil } +func (p *TSGroupByQueryIntervalReq) IsSetIsAligned() bool { + return p.IsAligned != nil +} + func (p *TSGroupByQueryIntervalReq) Read(ctx context.Context, iprot thrift.TProtocol) error { if _, err := iprot.ReadStructBegin(ctx); err != nil { return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err) @@ -13077,6 +13090,16 @@ func (p *TSGroupByQueryIntervalReq) Read(ctx context.Context, iprot thrift.TProt return err } } + case 13: + if fieldTypeId == thrift.BOOL { + if err := p.ReadField13(ctx, iprot); err != nil { + return err + } + } else { + if err := iprot.Skip(ctx, fieldTypeId); err != nil { + return err + } + } default: if err := iprot.Skip(ctx, fieldTypeId); err != nil { return err @@ -13219,6 +13242,15 @@ func (p *TSGroupByQueryIntervalReq) ReadField12(ctx context.Context, iprot thri return nil } +func (p *TSGroupByQueryIntervalReq) ReadField13(ctx context.Context, iprot thrift.TProtocol) error { + if v, err := iprot.ReadBool(ctx); err != nil { + return thrift.PrependError("error reading field 13: ", err) +} else { + p.IsAligned = &v +} + return nil +} + func (p *TSGroupByQueryIntervalReq) Write(ctx context.Context, oprot thrift.TProtocol) error { if err := oprot.WriteStructBegin(ctx, "TSGroupByQueryIntervalReq"); err != nil { return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err) } @@ -13235,6 +13267,7 @@ func (p *TSGroupByQueryIntervalReq) Write(ctx context.Context, oprot thrift.TPro if err := p.writeField10(ctx, oprot); err != nil { return err } if err := p.writeField11(ctx, oprot); err != nil { return err } if err := p.writeField12(ctx, oprot); err != nil { return err } + if err := p.writeField13(ctx, oprot); err != nil { return err } } if err := oprot.WriteFieldStop(ctx); err != nil { return thrift.PrependError("write field stop error: ", err) } @@ -13375,6 +13408,18 @@ func (p *TSGroupByQueryIntervalReq) writeField12(ctx context.Context, oprot thri return err } +func (p *TSGroupByQueryIntervalReq) writeField13(ctx context.Context, oprot thrift.TProtocol) (err error) { + if p.IsSetIsAligned() { + if err := oprot.WriteFieldBegin(ctx, "isAligned", thrift.BOOL, 13); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field begin error 13:isAligned: ", p), err) } + if err := oprot.WriteBool(ctx, bool(*p.IsAligned)); err != nil { + return thrift.PrependError(fmt.Sprintf("%T.isAligned (13) field write error: ", p), err) } + if err := oprot.WriteFieldEnd(ctx); err != nil { + return thrift.PrependError(fmt.Sprintf("%T write field end error 13:isAligned: ", p), err) } + } + return err +} + func (p *TSGroupByQueryIntervalReq) Equals(other *TSGroupByQueryIntervalReq) bool { if p == other { return true @@ -13423,6 +13468,12 @@ func (p *TSGroupByQueryIntervalReq) Equals(other *TSGroupByQueryIntervalReq) boo } if (*p.Timeout) != (*other.Timeout) { return false } } + if p.IsAligned != other.IsAligned { + if p.IsAligned == nil || other.IsAligned == nil { + return false + } + if (*p.IsAligned) != (*other.IsAligned) { return false } + } return true }