fix: Handle nested fields from BigQuery source when getting default column_names#522
Conversation
…s to return a Set instead of a List
549357e to
e581093
Compare
geraint0923
left a comment
There was a problem hiding this comment.
Thanks for fixing this!
| ) | ||
|
|
||
| @property | ||
| def column_names(self) -> List[str]: |
There was a problem hiding this comment.
Changing the return type introduces a breaking change. Perhaps convert back to list after after deduping with set. What is the scenario where the same column name is populated more than once? Assuming that's the motivation using set. Trying to understand if this is worth introducing a breaking change.
There was a problem hiding this comment.
The set comparison is trivial because col_names are unique and order is not a factor.
List implies an order which is not relevant for column names and makes the unit tests a tiny (very tiny) bit more complicated to write.
There was a problem hiding this comment.
I see your point about a breaking change. What do you recommend?
There was a problem hiding this comment.
I agree with the motivation to change the return type to a Set. Let's do the following:
- Leave the return type as List to avoid the breaking change.
- Proceed with this PR mainly as is.
- Open a ticket to track the return type change to Set.
- Tentatively plan to implement the return type change when we get closer to a larger breaking change and major version rev.
There was a problem hiding this comment.
Agreed on all points.
There was a problem hiding this comment.
Tracked in b/193044977
There was a problem hiding this comment.
I kept the private method return types as Set as I assume that it's acceptable to make breaking changes to private methods.
| my_dataset = datasets.TabularDataset(dataset_name=_TEST_NAME) | ||
|
|
||
| assert my_dataset.column_names == ["column_1", "column_2"] | ||
| assert my_dataset.column_names == set( |
There was a problem hiding this comment.
@sasha-gitg Using a set means that when I write a unit-test, I don't have to know about the implementation details on how the list is ordered.
There are workarounds, but using a set seems cleanest.
…ot introduce a breaking change at this time
40c6a30 to
cc90645
Compare
Fixes '
ds.column_namesdoesn't contain nested fields in BigQuery table' issue.According to the product team, only "leaf node" fields should be passed to AutoML tabular.
Added unit test for it.
Fixes b/191864144 🦕