Skip to content

Commit

Permalink
stdlib: Disable JOINID validation
Browse files Browse the repository at this point in the history
Current solution require whole stdlib to be available, which is not true both for Chrometto and google3 modules. Because of this, having this check in any place that doesn't need whole standard library is a bad approach and we should move it to be runtime in Trace Processor.

Next step is to save all ID columns in perfetto_sql_parser/engine and then verify all joinid columns there with similar check to the one removed here.

Bug:381538049
Change-Id: Ie962f8358a8e0844b91ad5f274d4ab6c727fc465
  • Loading branch information
aMayzner committed Dec 2, 2024
1 parent dbfeb77 commit 9743f83
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions tools/check_sql_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ def main():
f"{len(parsed.table_views)} tables/views, "
f"{len(parsed.macros)} macros.")

tables_with_id_cols = {}
for _, _, m in modules:
tables_with_id_cols.update(m.id_columns)

all_errors = 0
for path, sql, parsed in modules:
errors = []
Expand Down Expand Up @@ -130,22 +126,6 @@ def main():
f"Modules from package 'android' can't include '{include.module}' "
f"from package 'chrome'")

# Validate JOINID type.
# Verify if the JOINID references an ID column of a table.
for o in parsed.table_views:
for c, arg in o.joinid_cols.items():
[tab, id_col] = arg.joinid_column.split('.')
if tab not in tables_with_id_cols.keys():
errors.append(
f"JOINID column '{c}' of '{o.name}' references table '{tab}' that doesn't exist."
)
continue
if id_col not in tables_with_id_cols[tab]:
errors.append(
f"JOINID column '{c}' of '{o.name}' references ID column '{id_col}' in '{tab}' that doesn't exist."
)
continue

errors += [
*parsed.errors, *check_banned_words(sql),
*check_banned_create_table_as(sql), *check_banned_create_view_as(sql),
Expand Down

0 comments on commit 9743f83

Please sign in to comment.