Skip to content
This repository has been archived by the owner on Jul 7, 2020. It is now read-only.

add graceful support for missing columns (by name) #26

Closed
wants to merge 1 commit into from
Closed

add graceful support for missing columns (by name) #26

wants to merge 1 commit into from

Conversation

stewartoallen
Copy link
Contributor

add support for a "default value" when NPEs would otherwise occur

add support for a "default value" when NPEs would otherwise occur
@mspiegel
Copy link
Contributor

A sanity check for me: using the "Cfoobar" notation allows you to push a value onto the calculator based on the column name "foobar"? I did not know that; I will add it to the documentation.

IMO this patch goes against the principle of least astonishment. If the column name does not exist we should throw a more meaningful error message instead of selecting the 0th column.

@stewartoallen
Copy link
Contributor Author

i do not believe that's what it does. if the column does not exist, it uses the new "default" value which defaults to the value zero but can be changed.

@stewartoallen
Copy link
Contributor Author

ok, couple of things. all columns have names. try this: do a pivot;title. you will see the labels the pivot assigns to columns. in my case, it's possible that some values to not exist and thus the column in the pivot will not exist. throwing an error message and nuking the query because of this is totally non-sensical. it's a valid case. thus the default value. not all query operators support column naming, but they should.

@mspiegel
Copy link
Contributor

Can you provide a small example that illustrates your point. I must be missing something. It seems to me that if the user asks for column "helloworld" and that column does not exist then the query should throw a meaningful error message. Erroneous input should always provide a clear concise error message. The program should not attempt to deduce the intent of the user. I think this pull request would have the query select the 0th column if the column "helloworld" doesn't exist.

@stewartoallen
Copy link
Contributor Author

ok, i've re-read my patch a couple of times. it clearly uses the default value when the desired column name is missing. as for a test case, let's assume a hypothetical set of columns: date, animal, value. if my query selects a date range then pivots on date/animal where the animal is the column, then based on the selected date range, it is possible that one or more animals does not appear in that date range and thus their columns would be missing from the pivot. if i further have ops that skip the header then select column values based on name to emulate logical and/or for row selection, it is important that the query NOT fail when this condition occurs.

@stewartoallen stewartoallen deleted the at-pull-005 branch March 11, 2014 17:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants