The type inference for the map() function in the expression language in mapping data flows appears to be incorrect.
Below is a function which grabs the distanceInMiles sub-element of the location list, sorts this list, and then returns the first.
Input schema of query_result.location for reference:
The correct output of this function is a double. map(query_result.location, #item.distanceInMiles) returns a double[]. The enclosing sort also returns a double []. Adding the list index at the end should return double.
However, if I look in the schema output, it believes the output of this is a Complex with multiple sub-fields. This type appears to be derived from the #item in the map function instead of #item.distanceInMiles.
If I run the step in debug mode, the column correctly outputs the double type and double values:
This incorrect type inference makes every subsequent step in the mapping flow impossible. It is not possible for me to write this double into a database, because the validation fails because it thinks it is a complex type.