Skip to content

Commit

Permalink
fix dictionary building
Browse files Browse the repository at this point in the history
If you ran with `-tags assert` the tests would panic
  • Loading branch information
thorfour committed Aug 30, 2023
1 parent 902c3f8 commit c2cff02
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions pkg/query/flamegraph_arrow.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,9 +478,7 @@ func transpositionFromDict(unifier array.DictionaryUnifier, dict *array.Binary)
0,
0,
)
defer data.Release()
indices := array.NewInt32Data(data)

return data, indices, nil
}

Expand Down Expand Up @@ -1365,8 +1363,9 @@ func (fb *flamegraphBuilder) trim(ctx context.Context, tracer trace.Tracer, thre
var err error
trimmedMappingBuildIDIndicesArray := trimmedMappingBuildIDIndices.NewArray()
releasers = append(releasers, trimmedMappingBuildIDIndicesArray)

fb.mappingBuildID, err = compactDictionary(fb.pool, array.NewDictionaryArray(
&arrow.DictionaryType{IndexType: trimmedMappingBuildIDIndicesArray.DataType(), ValueType: fb.mappingBuildID.DataType()},
fb.mappingBuildID.DataType(),
trimmedMappingBuildIDIndicesArray,
fb.mappingBuildID.Dictionary(),
))
Expand All @@ -1376,7 +1375,7 @@ func (fb *flamegraphBuilder) trim(ctx context.Context, tracer trace.Tracer, thre
trimmedMappingFileIndicesArray := trimmedMappingFileIndices.NewArray()
releasers = append(releasers, trimmedMappingFileIndicesArray)
fb.mappingFile, err = compactDictionary(fb.pool, array.NewDictionaryArray(
&arrow.DictionaryType{IndexType: trimmedMappingFileIndicesArray.DataType(), ValueType: fb.mappingFile.DataType()},
fb.mappingFile.DataType(),
trimmedMappingFileIndicesArray,
fb.mappingFile.Dictionary(),
))
Expand All @@ -1386,7 +1385,7 @@ func (fb *flamegraphBuilder) trim(ctx context.Context, tracer trace.Tracer, thre
trimmedFunctionNameIndicesArray := trimmedFunctionNameIndices.NewArray()
releasers = append(releasers, trimmedFunctionNameIndicesArray)
fb.functionName, err = compactDictionary(fb.pool, array.NewDictionaryArray(
&arrow.DictionaryType{IndexType: trimmedFunctionNameIndices.Type(), ValueType: fb.functionName.DataType()},
fb.functionName.DataType(),
trimmedFunctionNameIndicesArray,
fb.functionName.Dictionary(),
))
Expand All @@ -1396,7 +1395,7 @@ func (fb *flamegraphBuilder) trim(ctx context.Context, tracer trace.Tracer, thre
trimmedFunctionSystemNameIndicesArray := trimmedFunctionSystemNameIndices.NewArray()
releasers = append(releasers, trimmedFunctionSystemNameIndicesArray)
fb.functionSystemName, err = compactDictionary(fb.pool, array.NewDictionaryArray(
&arrow.DictionaryType{IndexType: trimmedFunctionSystemNameIndices.Type(), ValueType: fb.functionSystemName.DataType()},
fb.functionSystemName.DataType(),
trimmedFunctionSystemNameIndicesArray,
fb.functionSystemName.Dictionary(),
))
Expand All @@ -1406,7 +1405,7 @@ func (fb *flamegraphBuilder) trim(ctx context.Context, tracer trace.Tracer, thre
trimmedFunctionFilenameIndicesArray := trimmedFunctionFilenameIndices.NewArray()
releasers = append(releasers, trimmedFunctionFilenameIndicesArray)
fb.functionFilename, err = compactDictionary(fb.pool, array.NewDictionaryArray(
&arrow.DictionaryType{IndexType: trimmedFunctionFilenameIndices.Type(), ValueType: fb.functionFilename.DataType()},
fb.functionFilename.DataType(),
trimmedFunctionFilenameIndicesArray,
fb.functionFilename.Dictionary(),
))
Expand Down

0 comments on commit c2cff02

Please sign in to comment.