Skip to content

Reduce not generating unique enum values when database is not consistent #18439

Answered by arekpalinski
loraderon asked this question in Q&A
Discussion options

You must be logged in to vote

The exception System.NotSupportedException: Cannot extract field name from: Day = IndexHelper.EnsureEnum(result.Day) is an internal issue in the RavenDB's index compiler. We'll check that (https://issues.hibernatingrhinos.com/issue/RavenDB-22317/Index-compiler-cannot-extract-Group-By-field-name).

You can use IndexHelper.EnsureEnum() in the map function instead of the reduce to workaround that. Also I had to modify the extension method to:

public static string EnsureEnum(object value)
{
	if (value is string s)
	{
		return s;
	}

	if (value is Sparrow.Json.LazyStringValue lsv)
	{
		return lsv.ToString();
	}

	return DaysOfWeek[(int)value];
}

alternatively you could also try something like:

p…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@loraderon
Comment options

@ayende
Comment options

@loraderon
Comment options

@arekpalinski
Comment options

Answer selected by loraderon
@loraderon
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants