Skip to content

Commit

Permalink
Add better exception for SQL slice key parsing issues.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 446100628
  • Loading branch information
embr authored and tfx-copybara committed May 3, 2022
1 parent a6da421 commit 5d737dc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tensorflow_model_analysis/extractors/sql_slice_key_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,13 @@ def setup(self):

def _GenerateQueries(
schema: pa.Schema) -> List[sql_util.RecordBatchSQLSliceQuery]:
return [
sql_util.RecordBatchSQLSliceQuery(sql, schema) for sql in self._sqls
]
result = []
for sql in self._sqls:
try:
result.append(sql_util.RecordBatchSQLSliceQuery(sql, schema))
except Exception as e:
raise RuntimeError(f'Failed to parse sql:\n\n{sql}') from e
return result

# A cache for compiled sql queries, keyed by record batch schemas.
# This way the extractor can work with record batches of different schemas,
Expand Down

0 comments on commit 5d737dc

Please sign in to comment.