Skip to content

Commit

Permalink
Fix incorrect equalsArr function
Browse files Browse the repository at this point in the history
Change-Id: Ibf6e3f8a72bd5463aa34e00ec503134eeccf6ad6
  • Loading branch information
AVMarkin committed Jul 16, 2024
1 parent 4f442d9 commit 2f6b627
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/core/bq_queries/views/functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,11 @@ AS (
);

CREATE OR REPLACE FUNCTION `{bq_dataset}.equalsArr`(
x ARRAY<STRING>, y ARRAY<STRING>)
arr_new ARRAY<STRING>, arr_old ARRAY<STRING>)
RETURNS INT64
LANGUAGE js
AS r"""
var count = (x.length >= y.length ? x : y).reduce((count, element) => count + (!x.includes(element) ? 1 : 0), 0);
var count = arr_new.filter(x => !arr_old.includes(x))
.concat(arr_old.filter(x => !arr_new.includes(x))).length;
return count;
""";

0 comments on commit 2f6b627

Please sign in to comment.