-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid column reference in Table.AddColumn outputs null instead of an error #223
Comments
Wondering if the root issue here is not- The following expression outputs a table whose third row contains an error in column
|
Converting errors to null is by design for our console-based output. We're limited on what we can do outside of the PQ experience. Our options are to either throw an exception or return the cell value as null. I believe the previous VS SDK exposed a project property that let you choose the behavior, but I'm not sure we need to expose that behavior. Longer term, we want to use an embedded PQ experience for testing, which should give you the behavior you're looking for. Here is a longer response regarding errors that Curt wrote up a while back:
|
Thank you, @mattmasson, for sharing that explanation. @CurtHagenlocher, you should seriously consider turning this into a blog post for the PQ blog...or as a guest contribution for my blog! :-) |
Hmm....with a text-based output format (like the SDK currently provides), I could imagine outputting error info on a cell-by-cell basis by rendering each individual M cell value as a "try record" of sorts...something like:
Technically works, but not the prettiest. At least, it's an idea, for what it's worth (may be more of interest to provide an error-enhanced output format option like this if the SDK's base library is expanded to be a general-purpose "run PQ to produce output" tool). Would a much simpler fail-safe for now be to add a top-level Boolean property to the output of |
Preflight Checklist
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
In Power Query, when
Table.AddColumn
's column generator function references a non-existent column, the output generated for the new column should be an error.Steps to Reproduce
.test.pq
file defined as follows (the connector's contents don't matter):Actual Experience
The following two-column table is returned:
JSON version of the above:
Expected Experience
Column B should contain an error, not a null value.
Additional Context
If the same M code is evaluated in Power BI's Query Editor, the following output is produced (reflects the expected error):
The text was updated successfully, but these errors were encountered: