Instead of writing a query like 

```
select * from xyz where mydomain IN ('foobar.com', 'www.example.com')

```

I want to write a function like

```
select * from xyz where one_of_my_domains(select mydomain as from_site)

```

But I want to be able to reuse this functions for any url in one of many tables. Currently when I use a function like this, I have to predefined what is returned and use it on the whole FROM part of the SQL statement. Is there any way to generalize a UDF to where I can use it on just 1 column instead of it operating over all rows. Here is my code right now that works but I have to predefine every output column which makes it not reusable.

```
domains = ['foobar.com', 'www.example.com'];

// The UDF
function has_domain(row, emit) {
  var has_domain = false;
  if (row.to_site !== null && row.to_site !== undefined) {
    for (var i = 0; i < domains.length; i++){
    if (domains[i] === String.prototype.toLowerCase.call(row.to_site)){
      has_domain = true;
      break;
     }
   }
  }
  return emit({has_domain: has_domain, trackingEventId: row.trackingEventId, date: row.date, from_site: row.from_site, to_site: row.to_site});
}

// UDF registration
bigquery.defineFunction(
  'has_domain',  // Name used to call the function from SQL

  ['from_site'],  // Input column names

  // JSON representation of the output schema
  [{name: 'has_domain', type: 'boolean'}],

  has_domain  // The function reference
);

```