dotnet/machinelearning · error · System.NotImplementedException

joinAlgorithm

Error message

joinAlgorithm

What it means

Merge ends its if/else chain with `throw new NotImplementedException(nameof(joinAlgorithm))`, so any JoinAlgorithm value that is not one of the implemented algorithms (Left/Right/Outer handled above) reaches this line. The message is just the parameter name 'joinAlgorithm'. It means the join algorithm you passed is not supported by this version.

Source

Thrown at src/Microsoft.Data.Analysis/DataFrame.Join.cs:402

                var intersection = Merge(retainedDataFrame, supplementaryDataFrame, retainedJoinColumns, supplementaryJoinColumns, out retainedRowIndices, out supplementaryRowIndices, calculateIntersection: true);

                // Step 2
                // Do RIGHT JOIN to retain all data from supplementary DataFrame too (take into account data intersection from the first step to avoid duplicates)
                for (long i = 0; i < supplementaryDataFrame.Columns.RowCount; i++)
                {
                    var columns = supplementaryJoinColumns.Select(name => supplementaryDataFrame.Columns[name]).ToArray();
                    if (!IsAnyNullValueInColumns(columns, i))
                    {
                        if (!intersection.Contains(i))
                        {
                            retainedRowIndices.Append(null);
                            supplementaryRowIndices.Append(i);
                        }
                    }
                }
            }
            else
                throw new NotImplementedException(nameof(joinAlgorithm));

            DataFrame ret = new DataFrame();

            PrimitiveDataFrameColumn<long> mapIndicesLeft = isLeftDataFrameRetained ? retainedRowIndices : supplementaryRowIndices;
            PrimitiveDataFrameColumn<long> mapIndicesRight = isLeftDataFrameRetained ? supplementaryRowIndices : retainedRowIndices;

            // Insert columns from left dataframe (this)
            for (int i = 0; i < this.Columns.Count; i++)
            {
                ret.Columns.Insert(i, this.Columns[i].Clone(mapIndicesLeft));
            }

            // Insert columns from right dataframe (other)
            for (int i = 0; i < other.Columns.Count; i++)
            {
                DataFrameColumn column = other.Columns[i].Clone(mapIndicesRight);

                SetSuffixForDuplicatedColumnNames(ret, column, leftSuffix, rightSuffix);

View on GitHub (pinned to 7b76e69cf9)

Solutions

  1. Use only JoinAlgorithm.Left, JoinAlgorithm.Right, or JoinAlgorithm.Outer as supported by your package version.
  2. Check the installed Microsoft.Data.Analysis version and upgrade if you need the newer algorithm.
  3. Validate the enum value before calling: Enum.IsDefined(typeof(JoinAlgorithm), joinAlgorithm).
  4. Implement the missing join manually (e.g. via row filtering) if the version cannot be upgraded.

Example fix

// before
var merged = left.Merge(right, lc, rc, joinAlgorithm: JoinAlgorithm.FullOuter);
// after
if (!Enum.IsDefined(typeof(JoinAlgorithm), joinAlgorithm))
    throw new ArgumentException($"Unsupported join algorithm: {joinAlgorithm}");
var merged = left.Merge(right, lc, rc, joinAlgorithm: JoinAlgorithm.Outer);
Defensive patterns

Strategy: type-guard

Validate before calling

if (!Enum.IsDefined(typeof(JoinAlgorithm), joinAlgorithm))
    throw new ArgumentException($"Join algorithm {joinAlgorithm} not supported by this package version");

Type guard

bool IsSupportedJoin(JoinAlgorithm a) => a is JoinAlgorithm.Left or JoinAlgorithm.Right or JoinAlgorithm.Outer;

Try / catch

try { merged = left.Merge(right, lc, rc, joinAlgorithm: alg); }
catch (NotImplementedException) { merged = manualJoin(left, right, lc, rc); }

Prevention

When it happens

Trigger: Calling df.Merge(other, leftCols, rightCols, joinAlgorithm: someJoinAlgorithm) where someJoinAlgorithm is not among the implemented enum members in the installed Microsoft.Data.Analysis version — typically a newer enum value, an invalid cast, or an out-of-range enum value like (JoinAlgorithm)99.

Common situations: Targeting a newer .NET/ML.NET API surface than the runtime package provides; copying sample code that uses an algorithm added in a later release; casting an int or another enum into JoinAlgorithm.

Related errors


AI-assisted analysis of dotnet/machinelearning@7b76e69cf9 (2026-09-11). Data as JSON: /api/errors/5f9416a191bb14b2. Report an issue: GitHub.