Skip to content

Commit

Permalink
Merge branch '2.0-dev' into cp-20611-to-2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Dec 11, 2024
2 parents 0efa0ed + 880d78c commit 807769e
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 26 deletions.
12 changes: 0 additions & 12 deletions pkg/sql/compile/analyze_module.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,21 +427,9 @@ func (c *Compile) GenPhyPlan(runC *Compile) {
}
}

// record the number of local cn s3 requests
c.anal.phyPlan.S3IOInputCount += runC.counterSet.FileService.S3.Put.Load()
c.anal.phyPlan.S3IOInputCount += runC.counterSet.FileService.S3.List.Load()

c.anal.phyPlan.S3IOOutputCount += runC.counterSet.FileService.S3.Head.Load()
c.anal.phyPlan.S3IOOutputCount += runC.counterSet.FileService.S3.Get.Load()
c.anal.phyPlan.S3IOOutputCount += runC.counterSet.FileService.S3.Delete.Load()
c.anal.phyPlan.S3IOOutputCount += runC.counterSet.FileService.S3.DeleteMulti.Load()
//-------------------------------------------------------------------------------------------

// record the number of remote cn s3 requests
for _, remotePhy := range runC.anal.remotePhyPlans {
c.anal.phyPlan.RemoteScope = append(c.anal.phyPlan.RemoteScope, remotePhy.LocalScope[0])
c.anal.phyPlan.S3IOInputCount += remotePhy.S3IOInputCount
c.anal.phyPlan.S3IOOutputCount += remotePhy.S3IOOutputCount
}
}

Expand Down
10 changes: 4 additions & 6 deletions pkg/sql/models/phy_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ import (
)

type PhyPlan struct {
Version string `json:"version"`
RetryTime int `json:"retryTime,omitempty"`
LocalScope []PhyScope `json:"scope,omitempty"`
RemoteScope []PhyScope `json:"RemoteScope,omitempty"`
S3IOInputCount int64 `json:"S3IOInputCount,omitempty"`
S3IOOutputCount int64 `json:"S3IOOutputCount,omitempty"`
Version string `json:"version"`
RetryTime int `json:"retryTime,omitempty"`
LocalScope []PhyScope `json:"scope,omitempty"`
RemoteScope []PhyScope `json:"RemoteScope,omitempty"`
}

type PhyScope struct {
Expand Down
8 changes: 3 additions & 5 deletions pkg/sql/models/phy_plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,9 @@ func TestPhyPlanJSON(t *testing.T) {
//------------------------------------------------------------------------------------------------------------------

phyPlan := &PhyPlan{
Version: "1.0.0",
LocalScope: []PhyScope{phyScope1},
RemoteScope: []PhyScope{phyScope1},
S3IOInputCount: 5,
S3IOOutputCount: 0,
Version: "1.0.0",
LocalScope: []PhyScope{phyScope1},
RemoteScope: []PhyScope{phyScope1},
}

// Convert to JSON
Expand Down
2 changes: 0 additions & 2 deletions pkg/sql/models/show_phyplan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ func TestExplainPhyPlan(t *testing.T) {
phyPlan := NewPhyPlan()
phyPlan.LocalScope = []PhyScope{phyScope1}
phyPlan.RemoteScope = []PhyScope{phyScope1}
phyPlan.S3IOInputCount = 5
phyPlan.S3IOOutputCount = 0

statsInfo := new(statistic.StatsInfo)
statsInfo.ParseStage.ParseDuration = 72872
Expand Down
6 changes: 5 additions & 1 deletion pkg/sql/plan/runtime_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,11 @@ func (builder *QueryBuilder) generateRuntimeFilters(nodeID int32) {
sortOrder := GetSortOrder(tableDef, probeCol.ColPos)
if node.JoinType != plan.Node_INDEX {
probeNdv := getExprNdv(probeExprs[0], builder)
if probeNdv == -1 || node.Stats.HashmapStats.HashmapSize/probeNdv >= 0.1 {
if probeNdv <= 1 {
//maybe not flushed yet, set at least 100 to continue calculation
probeNdv = 100
}
if node.Stats.HashmapStats.HashmapSize/probeNdv >= 0.1 {
return
}
if sortOrder != 0 {
Expand Down
2 changes: 2 additions & 0 deletions pkg/vm/process/operator_analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ func (opAlyzr *operatorAnalyzer) InputBlock() {
opAlyzr.opStats.InputBlocks += 1
}

// If the operator input batch is First, then the InputSize and InputRows will be counted
func (opAlyzr *operatorAnalyzer) Input(bat *batch.Batch) {
if opAlyzr.opStats == nil {
panic("operatorAnalyzer.Input: operatorAnalyzer.opStats is nil")
Expand All @@ -171,6 +172,7 @@ func (opAlyzr *operatorAnalyzer) Input(bat *batch.Batch) {
}
}

// If the operator input batch is Last, then the OutputSize and OutputRows will be counted
func (opAlyzr *operatorAnalyzer) Output(bat *batch.Batch) {
if opAlyzr.opStats == nil {
panic("operatorAnalyzer.Output: operatorAnalyzer.opStats is nil")
Expand Down

0 comments on commit 807769e

Please sign in to comment.