{"record":{"id":"bc2ef20c6216c96e","repo":"dotnet/machinelearning","slug":"nameof-t","errorCode":null,"errorMessage":"nameof(T)","messagePattern":"nameof\\(T\\)","errorType":"exception","errorClass":"NotImplementedException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs","lineNumber":111,"sourceCode":"                return Int8Type.Default;\n            else if (typeof(T) == typeof(int))\n                return Int32Type.Default;\n            else if (typeof(T) == typeof(long))\n                return Int64Type.Default;\n            else if (typeof(T) == typeof(short))\n                return Int16Type.Default;\n            else if (typeof(T) == typeof(byte))\n                return UInt8Type.Default;\n            else if (typeof(T) == typeof(uint))\n                return UInt32Type.Default;\n            else if (typeof(T) == typeof(ulong))\n                return UInt64Type.Default;\n            else if (typeof(T) == typeof(ushort))\n                return UInt16Type.Default;\n            else if (typeof(T) == typeof(DateTime))\n                return Date64Type.Default;\n            else\n                throw new NotImplementedException(nameof(T));\n        }\n\n        protected internal override Field GetArrowField() => new Field(Name, GetArrowType(), NullCount != 0);\n\n        protected internal override int GetMaxRecordBatchLength(long startIndex) => _columnContainer.MaxRecordBatchLength(startIndex);\n\n        private int GetNullCount(long startIndex, int numberOfRows)\n        {\n            int nullCount = 0;\n            for (long i = startIndex; i < numberOfRows; i++)\n            {\n                if (!IsValid(i))\n                    nullCount++;\n            }\n            return nullCount;\n        }\n\n        protected internal override Apache.Arrow.Array ToArrowArray(long startIndex, int numberOfRows)","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/dotnet/machinelearning/blob/7b76e69cf964daeca3f1377af6bc5543284d56c6/src/Microsoft.Data.Analysis/PrimitiveDataFrameColumn.cs#L93-L129","documentation":"PrimitiveDataFrameColumn<T>.GetArrowType() throws NotImplementedException(nameof(T)) when the column's generic type parameter T has no mapping to an Apache Arrow type. The method maps supported primitives (including ulong, ushort, DateTime) to Arrow types; any other T reaches the else branch. The message is just the type parameter name, so it identifies T only indirectly.","triggerScenarios":"Calling GetArrowField()/GetArrowType() on a PrimitiveDataFrameColumn<T> where T is not one of the explicitly mapped Arrow-supported primitives, e.g. a PrimitiveDataFrameColumn<MyStruct> or T=TimeSpan/bool-dependent conversions.","commonSituations":"Serializing a DataFrame to Arrow/IPC after building columns with unusual element types; passing custom struct columns into the Arrow export pipeline; library version where a primitive's Arrow mapping was not yet added.","solutions":["Only create columns whose element type is an Arrow-supported primitive (bool, byte, char, decimal, double, float, int, long, sbyte, short, uint, ulong, ushort, DateTime)","Convert unsupported columns to a supported primitive type before Arrow export","Remove or skip non-primitive columns from the DataFrame before calling the Arrow conversion APIs","Upgrade the Microsoft.Data.Analysis package in case a newer version added the missing Arrow mapping"],"exampleFix":"// before\nvar col = new PrimitiveDataFrameColumn<MyStruct>(\"data\");\nvar field = col.GetArrowField(); // NotImplementedException\n// after\nvar col = new PrimitiveDataFrameColumn<int>(\"data\"); // supported Arrow type\nvar field = col.GetArrowField();","handlingStrategy":"type-guard","validationCode":"static readonly HashSet<Type> ArrowSupported = new() { typeof(bool), typeof(byte), typeof(char), typeof(decimal), typeof(double), typeof(float), typeof(int), typeof(long), typeof(sbyte), typeof(short), typeof(uint), typeof(ulong), typeof(ushort), typeof(DateTime) };\nif (!ArrowSupported.Contains(column.DataType)) throw new NotSupportedException($\"{column.DataType} has no Arrow mapping\");","typeGuard":"static bool IsArrowExportable<T>(PrimitiveDataFrameColumn<T> col) where T : unmanaged =>\n    col.DataType == typeof(bool) || col.DataType == typeof(byte) || col.DataType == typeof(char)\n    || col.DataType == typeof(decimal) || col.DataType == typeof(double) || col.DataType == typeof(float)\n    || col.DataType == typeof(int) || col.DataType == typeof(long) || col.DataType == typeof(sbyte)\n    || col.DataType == typeof(short) || col.DataType == typeof(uint) || col.DataType == typeof(ulong)\n    || col.DataType == typeof(ushort) || col.DataType == typeof(DateTime);","tryCatchPattern":"try { var field = column.GetArrowField(); }\ncatch (NotImplementedException) { /* skip column or convert before export */ }","preventionTips":["Restrict column element types to Arrow-supported primitives","Filter out non-exportable columns before Arrow/IPC conversion","Check DataType against the supported set in generic export helpers"],"tags":["not-implemented","arrow","dataframe","type-mapping"],"backgroundTag":"method-not-implemented","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"}