@@ -971,9 +971,12 @@ func (suite *testSelectDataframeSuite) TestSparseNumericColumnsWithEmptyColumnsD
971
971
suite .basicQueryTime + 3 * tsdbtest .MinuteInMillis ,
972
972
suite .basicQueryTime + 4 * tsdbtest .MinuteInMillis }
973
973
expectedColumns := map [string ][]interface {}{
974
- "cpu_0" : {math .NaN (), math .NaN (), math .NaN (), math .NaN (), math .NaN (), math .NaN (), math .NaN (), math .NaN (), math .NaN (), math .NaN ()},
975
- "cpu_1" : {10.0 , 20.0 , 30.0 , math .NaN (), 50.0 , math .NaN (), 22.0 , 33.0 , math .NaN (), 55.0 },
976
- "cpu_2" : {math .NaN (), math .NaN (), math .NaN (), 40.4 , 50.5 , 10.0 , 20.0 , math .NaN (), 40.0 , 50.0 },
974
+ "cpu_0-linux" : {math .NaN (), math .NaN (), math .NaN (), math .NaN (), math .NaN ()},
975
+ "cpu_0-windows" : {math .NaN (), math .NaN (), math .NaN (), math .NaN (), math .NaN ()},
976
+ "cpu_1-linux" : {10.0 , 20.0 , 30.0 , math .NaN (), 50.0 },
977
+ "cpu_1-windows" : {math .NaN (), 22.0 , 33.0 , math .NaN (), 55.0 },
978
+ "cpu_2-linux" : {math .NaN (), math .NaN (), math .NaN (), 40.4 , 50.5 },
979
+ "cpu_2-windows" : {10.0 , 20.0 , math .NaN (), 40.0 , 50.0 },
977
980
}
978
981
979
982
testParams := tsdbtest .NewTestParams (suite .T (),
@@ -1034,32 +1037,32 @@ func (suite *testSelectDataframeSuite) TestSparseNumericColumnsWithEmptyColumnsD
1034
1037
iter , err := querierV2 .SelectDataFrame (params )
1035
1038
requireCtx .NoError (err , "failed to execute query" )
1036
1039
1037
- rowId := - 1
1038
1040
var seriesCount int
1039
1041
for iter .NextFrame () {
1040
1042
seriesCount ++
1041
1043
frame , err := iter .GetFrame ()
1042
1044
requireCtx .NoError (err )
1043
1045
indexCol := frame .Indices ()[0 ]
1046
+ osLabel := frame .Labels ()["os" ]
1044
1047
1045
1048
nullValuesMap := frame .NullValuesMap ()
1046
1049
requireCtx .NotNil (nullValuesMap , "null value map should not be empty" )
1047
1050
1048
1051
for i := 0 ; i < indexCol .Len (); i ++ {
1049
- rowId ++
1050
1052
t , _ := indexCol .TimeAt (i )
1051
1053
timeMillis := t .UnixNano () / int64 (time .Millisecond )
1052
1054
requireCtx .Equal (expectedTimeColumn [i ], timeMillis , "time column does not match at index %v" , i )
1053
1055
for _ , columnName := range frame .Names () {
1054
1056
var v interface {}
1057
+ key := fmt .Sprintf ("%v-%v" , columnName , osLabel )
1055
1058
column , err := frame .Column (columnName )
1056
1059
requireCtx .NoError (err )
1057
1060
if column .DType () == frames .FloatType {
1058
1061
v , _ = column .FloatAt (i )
1059
1062
if v == math .NaN () {
1060
1063
requireCtx .True (nullValuesMap [i ].NullColumns [columnName ])
1061
1064
}
1062
- bothNaN := math .IsNaN (expectedColumns [column . Name () ][i ].(float64 )) && math .IsNaN (v .(float64 ))
1065
+ bothNaN := math .IsNaN (expectedColumns [key ][i ].(float64 )) && math .IsNaN (v .(float64 ))
1063
1066
if bothNaN {
1064
1067
continue
1065
1068
}
@@ -1072,9 +1075,9 @@ func (suite *testSelectDataframeSuite) TestSparseNumericColumnsWithEmptyColumnsD
1072
1075
suite .Fail (fmt .Sprintf ("column type is not as expected: %v" , column .DType ()))
1073
1076
}
1074
1077
1075
- expectedValue := expectedColumns [columnName ][ rowId ]
1078
+ expectedValue := expectedColumns [key ][ i ]
1076
1079
if ! math .IsNaN (expectedValue .(float64 )) || ! math .IsNaN (v .(float64 )) {
1077
- requireCtx .Equal (expectedValue , v , "column %v does not match at index %v" , columnName , rowId )
1080
+ requireCtx .Equal (expectedValue , v , "column %v does not match at index %v" , columnName , i )
1078
1081
}
1079
1082
}
1080
1083
}
@@ -1092,9 +1095,12 @@ func (suite *testSelectDataframeSuite) TestSparseNumericColumnsWithPartialLabels
1092
1095
suite .basicQueryTime + 3 * tsdbtest .MinuteInMillis ,
1093
1096
suite .basicQueryTime + 4 * tsdbtest .MinuteInMillis }
1094
1097
expectedColumns := map [string ][]interface {}{
1095
- "cpu_0" : {math .NaN (), math .NaN (), math .NaN (), math .NaN (), math .NaN (), math .NaN (), math .NaN (), math .NaN (), math .NaN (), math .NaN ()},
1096
- "cpu_1" : {10.0 , 20.0 , 30.0 , 40.0 , 50.0 , math .NaN (), 22.0 , 33.0 , math .NaN (), 55.0 },
1097
- "cpu_2" : {math .NaN (), math .NaN (), math .NaN (), math .NaN (), math .NaN (), 10.0 , 20.0 , math .NaN (), 40.0 , 50.0 },
1098
+ "cpu_0-linux" : {math .NaN (), math .NaN (), math .NaN (), math .NaN (), math .NaN ()},
1099
+ "cpu_0-windows" : {math .NaN (), math .NaN (), math .NaN (), math .NaN (), math .NaN ()},
1100
+ "cpu_1-linux" : {10.0 , 20.0 , 30.0 , 40.0 , 50.0 },
1101
+ "cpu_1-windows" : {math .NaN (), 22.0 , 33.0 , math .NaN (), 55.0 },
1102
+ "cpu_2-linux" : {math .NaN (), math .NaN (), math .NaN (), math .NaN (), math .NaN ()},
1103
+ "cpu_2-windows" : {10.0 , 20.0 , math .NaN (), 40.0 , 50.0 },
1098
1104
}
1099
1105
1100
1106
testParams := tsdbtest .NewTestParams (suite .T (),
@@ -1148,23 +1154,23 @@ func (suite *testSelectDataframeSuite) TestSparseNumericColumnsWithPartialLabels
1148
1154
iter , err := querierV2 .SelectDataFrame (params )
1149
1155
requireCtx .NoError (err , "failed to execute query" )
1150
1156
1151
- rowId := - 1
1152
1157
var seriesCount int
1153
1158
for iter .NextFrame () {
1154
1159
seriesCount ++
1155
1160
frame , err := iter .GetFrame ()
1156
1161
requireCtx .NoError (err )
1157
1162
indexCol := frame .Indices ()[0 ]
1163
+ osLabel := frame .Labels ()["os" ]
1158
1164
1159
1165
nullValuesMap := frame .NullValuesMap ()
1160
1166
requireCtx .NotNil (nullValuesMap , "null value map should not be empty" )
1161
1167
1162
1168
for i := 0 ; i < indexCol .Len (); i ++ {
1163
- rowId ++
1164
1169
t , _ := indexCol .TimeAt (i )
1165
1170
timeMillis := t .UnixNano () / int64 (time .Millisecond )
1166
1171
requireCtx .Equal (expectedTimeColumn [i ], timeMillis , "time column does not match at index %v" , i )
1167
1172
for _ , columnName := range frame .Names () {
1173
+ key := fmt .Sprintf ("%v-%v" , columnName , osLabel )
1168
1174
var v interface {}
1169
1175
column , err := frame .Column (columnName )
1170
1176
requireCtx .NoError (err )
@@ -1173,7 +1179,7 @@ func (suite *testSelectDataframeSuite) TestSparseNumericColumnsWithPartialLabels
1173
1179
if v == math .NaN () {
1174
1180
requireCtx .True (nullValuesMap [i ].NullColumns [columnName ])
1175
1181
}
1176
- bothNaN := math .IsNaN (expectedColumns [column . Name () ][i ].(float64 )) && math .IsNaN (v .(float64 ))
1182
+ bothNaN := math .IsNaN (expectedColumns [key ][i ].(float64 )) && math .IsNaN (v .(float64 ))
1177
1183
if bothNaN {
1178
1184
continue
1179
1185
}
@@ -1186,9 +1192,9 @@ func (suite *testSelectDataframeSuite) TestSparseNumericColumnsWithPartialLabels
1186
1192
suite .Fail (fmt .Sprintf ("column type is not as expected: %v" , column .DType ()))
1187
1193
}
1188
1194
1189
- expectedValue := expectedColumns [columnName ][ rowId ]
1195
+ expectedValue := expectedColumns [key ][ i ]
1190
1196
if ! math .IsNaN (expectedValue .(float64 )) || ! math .IsNaN (v .(float64 )) {
1191
- requireCtx .Equal (expectedValue , v , "column %v does not match at index %v" , columnName , rowId )
1197
+ requireCtx .Equal (expectedValue , v , "column %v does not match at index %v" , columnName , i )
1192
1198
}
1193
1199
}
1194
1200
}
0 commit comments