-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
fix: error around latest partition in BigQuery #11274
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11274 +/- ##
==========================================
- Coverage 65.63% 65.62% -0.02%
==========================================
Files 838 839 +1
Lines 39714 39841 +127
Branches 3613 3653 +40
==========================================
+ Hits 26068 26145 +77
- Misses 13538 13595 +57
+ Partials 108 101 -7
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
b852a3d
to
f099e0e
Compare
@@ -110,7 +110,7 @@ class TableElement extends React.PureComponent { | |||
/> | |||
); | |||
} | |||
let latest = Object.entries(table.partitions.latest).map( | |||
let latest = Object.entries(table.partitions?.latest || []).map( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't necessary anymore given the issue being addressed in the backend, but is a tiny bit of defensive programming.
4edbc56
to
816d467
Compare
816d467
to
f8dbcae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
# the index's `column_names` == [None] | ||
# Here we're returning only non-None indexes | ||
for ix in indexes: | ||
column_names = ix.get("column_names") or [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
for index in indexes:
column_names = index.get("column_names", [])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the or
is a bit safer in case the key exists with a None
value, will stick to it
normalized_idx = BigQueryEngineSpec.normalize_indexes(indexes) | ||
self.assertEqual(normalized_idx, []) | ||
|
||
indexes = [{"name": "partition", "column_names": ["dttm"], "unique": False}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could add another small test with indexes = [{"name": "partition", "column_names": ["dttm", None], "unique": False}]
7fa9092
to
2905eb7
Compare
addressed the comments, mergin'! |
* fix: error around latest partition in BigQuery * lint * Going with a backend-first approach * fix test * add an extra test
Hit this bug while using BigQ. The SQLAlchemy inspector's
get_indexes
returns a list of columns that is wrong and get the SQL Lab frontend to hard crash.Here's the exact payload I was getting off of
get_indexes
for a particular table:[{'name': 'partition', 'column_names': [None], 'unique': False}]
Here I'm adding a BigQuery specific mutation for the indexes that makes sure this doesn't happen. We're assuming that
pybigquery
will fix the root cause in a future version.