I need to pass a string representation of a <string,string> map into my U-SQL program, and deserialize it into a C# Dictionary<string,string> so I can then turn it to a U-SQL SqlMap. I need to do it in a constant-foldable way. My most recent attempt:
DECLARE @MapStr string = "{\"key\": \"val\"}";
DECLARE CONST @map = new SqlMap<string,string>(JsonConvert.DeserializeObject<Dictionary<string, string>>(@MapStr));
Fails with "E_CSC_USER_EXPRESSIONNOTCONSTANTFOLDABLE: Expression cannot be constant folded."
I have found numerous ways to deserialize a string into a map, but none so far were constant foldable. I can't find a list of constant-foldable c# expressions, which would also be helpful here.
In case anyone else was curious, I believe this is not possible:
For my specific purposes, I was able to use a configuration file that created CONST SqlMaps and use this, but that would not be a possibility if we had more than a finite set of possible inputs.