{"record":{"id":"13ec04fd0d157314","repo":"dotnet/machinelearning","slug":"tkey","errorCode":null,"errorMessage":"TKey","messagePattern":"TKey","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.Data.Analysis/DataFrameColumns/ArrowStringDataFrameColumn.cs","lineNumber":519,"sourceCode":"                        if (containsKey)\n                        {\n                            values.Add(i);\n                        }\n                        else\n                        {\n                            multimap.Add(str, new List<long>() { i });\n                        }\n                    }\n                    else\n                    {\n                        nullIndices.Add(i);\n                    }\n                }\n                return multimap as Dictionary<TKey, ICollection<long>>;\n            }\n            else\n            {\n                throw new NotSupportedException(nameof(TKey));\n            }\n        }\n\n        /// <inheritdoc/>\n        public ArrowStringDataFrameColumn FillNulls(string value, bool inPlace = false)\n        {\n            if (value == null)\n            {\n                throw new ArgumentException(nameof(value));\n            }\n            if (inPlace)\n            {\n                /* For now throw an exception if inPlace = true. Need to investigate if Apache Arrow\n                 * format supports filling nulls for variable length arrays\n                 */\n                throw new NotSupportedException();\n            }\n","sourceCodeStart":501,"sourceCodeEnd":537,"githubUrl":"https://github.com/dotnet/machinelearning/blob/7b76e69cf964daeca3f1377af6bc5543284d56c6/src/Microsoft.Data.Analysis/DataFrameColumns/ArrowStringDataFrameColumn.cs#L501-L537","documentation":"GetGroupedOccurrences/multimap indexing only supports grouping keys (TKey) of type string or byte[]; any other key type reaches a fallthrough that throws NotSupportedException(nameof(TKey)). The message is literally 'TKey', telling you the generic key type argument is not supported.","triggerScenarios":"Calling GetGroupedOccurrences<TKey>(other) with TKey = int, Guid, DateTime, etc. — anything besides string or byte[].","commonSituations":"Grouping rows by a numeric or date key column; generic helper code forwarding an arbitrary key type into GetGroupedOccurrences.","solutions":["Use TKey = string and convert your key values with ToString().","Use TKey = byte[] if your keys are binary.","Hash/encode the key into a string yourself before grouping.","Add a runtime check that TKey is string or byte[] before calling."],"exampleFix":"// before\ncol.GetGroupedOccurrences<int>(other);\n// after\ncol.GetGroupedOccurrences<string>(other); // keys converted to strings first","handlingStrategy":"type-guard","validationCode":"if (typeof(TKey) != typeof(string) && typeof(TKey) != typeof(byte[]))\n    throw new NotSupportedException(\"GetGroupedOccurrences only supports TKey of string or byte[]\");","typeGuard":"bool IsValidGroupKey<TKey>() => typeof(TKey) == typeof(string) || typeof(TKey) == typeof(byte[]);","tryCatchPattern":null,"preventionTips":["Only group by string or byte[] keys with GetGroupedOccurrences","Convert other key types (numbers, dates) to strings before grouping"],"tags":["dotnet","dataframe","not-supported"],"backgroundTag":"unsupported-operation","analyzedSha":"7b76e69cf964daeca3f1377af6bc5543284d56c6","analyzedAt":"2026-09-11T12:35:38.930Z","contentChangedAt":"2026-09-11T12:35:38.930Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}