Evaluation dies for 0-row view
bgribaudo opened this issue · 2 comments
bgribaudo commented
Preflight Checklist
- I have installed the latest version of Power Query SDK.
- I have checked existing resources, including the common issues and the release notes.
- I have searched for similar issues.
Power Query SDK
0.2.1
Regression From
No response
Platform
Windows
Architecture
x64
OS Version
No response
VSCode version
No response
PQSdkTool Path
No response
Bug Description
When data is requested from a connector that returns a view which outputs a zero-row table, evaluation dies with an exception.
Steps to Reproduce
- Create a connector defined as follows:
section Test; [DataSource.Kind="Test"] shared Test.Contents = () => Table.View(null, [ GetRows = () => #table({"A"}, {{}}), GetType = () => Value.Type(GetRows()) ]); Test = [ Authentication = [ Anonymous = [] ] ];
- Evaluate the following test script:
Test.Contents()
Actual Experience
Evaluate dies with the following error:
"Error": {
"Message": "1 keys were specified, but 0 values were provided.",
"MessageFormat": "{0} keys were specified, but {1} values were provided.",
"MessageParameters": [
"1",
"0"
],
"Details": {
"Reason": "Expression.Error",
"Detail": "{error \"Microsoft.Mashup.Engine1.Runtime.ValueException: [Expression.Error] Value was not specified.#(cr)#(lf) at Microsoft.Mashup.Engine1.Language.ValueCreator.CreateValueForNotImplemented(INotImplementedExpression expression)#(cr)#(lf) at Microsoft.Mashup.Engine1.Runtime.ListValue.DemandArrayListValue.get_Item(Int32 index)#(cr)#(lf) at Microsoft.Data.Mashup.ProviderCommon.MashupResource.TryGetValue(Func`1 getValue, IValue& value, String& errorMessage)#(cr)#(lf)Record\"}"
}
}
Expected Experience
A 0-row table should be successfully returned.
Additional Context
If the Table.View
code is copied out of the connector and placed into the .test.pq
file, then that file is evaluated, the expected table is returned without error.
mattmasson commented
It looks like this is an engine bug / quirk of Table.View
, rather than an issue with the SDK itself. The GetRows
handler does not like the empty list value in the table row.
This works:
#table({"A"}, {})
But this throws an exception:
#table({"A"}, {{}}
I've opened a tracking bug internally.
bgribaudo commented
Thank you, @mattmasson!