Skip to content

Commit

Permalink
unit test failure fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
manojVivek committed Dec 12, 2024
1 parent 115e0a8 commit 90435a0
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 76 deletions.
25 changes: 21 additions & 4 deletions pkg/parcacol/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -969,6 +969,20 @@ func (q *Querier) SymbolizeArrowRecord(
defer valuePerSecondColumn.Release()
}

indices = schema.FieldIndices(profile.ColumnTimestamp)
var timestampColumn *array.Int64
if len(indices) != 1 {
timestampColumn = arrowutils.MakeNullArray(q.pool, arrow.PrimitiveTypes.Int64, valueColumn.Len()).(*array.Int64)
defer timestampColumn.Release()
}

indices = schema.FieldIndices(profile.ColumnDuration)
var durationColumn *array.Int64
if len(indices) != 1 {
durationColumn = arrowutils.MakeNullArray(q.pool, arrow.PrimitiveTypes.Int64, valueColumn.Len()).(*array.Int64)
defer durationColumn.Release()
}

profileLabels := []arrow.Field{}
profileLabelColumns := []arrow.Array{}
for i, field := range schema.Fields() {
Expand All @@ -984,14 +998,17 @@ func (q *Querier) SymbolizeArrowRecord(
}
defer locationsRecord.Release()

columns := make([]arrow.Array, len(profileLabels)+3) // +3 for stacktrace locations, value and diff
columns := make([]arrow.Array, len(profileLabels)+5) // +5 for stacktrace locations, value, diff, timestamp and duration
copy(columns, profileLabelColumns)
columns[len(columns)-3] = locationsRecord.Column(0)
columns[len(columns)-2] = valueColumn
columns[len(columns)-5] = locationsRecord.Column(0)
columns[len(columns)-4] = valueColumn

diffColumn := CreateDiffColumn(q.pool, int(r.NumRows()))
defer diffColumn.Release()
columns[len(columns)-1] = diffColumn
columns[len(columns)-3] = diffColumn

columns[len(columns)-2] = timestampColumn
columns[len(columns)-1] = durationColumn

res[i] = array.NewRecord(profile.ArrowSchema(profileLabels), columns, r.NumRows())
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/profile/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func ArrowSamplesField(profileLabelFields []arrow.Field) []arrow.Field {
fields := make([]arrow.Field, numFields)
copy(fields, profileLabelFields)
fields[numFields-5] = LocationsField
fields[numFields-3] = arrow.Field{
fields[numFields-4] = arrow.Field{
Name: "value",
Type: arrow.PrimitiveTypes.Int64,
}
Expand Down
Loading

0 comments on commit 90435a0

Please sign in to comment.