title: How do you calculate a boolean aggregate over a column in BigQuery?
body: <p>I have a table of events of users, and I want to project those events into a
  new column with some predicate, and then aggregate the events together per user
  into a new projection that tells me if a user has ever had the predicate match
  for them, or if they've never had it match, etc.</p>
  
  <p>In other languages this is usually called <code>all()</code> and <code>any()</code>, where you pass
  it a list of boolean values and it will tell you if all of them match, or if at
  least one matches.  It's equivalent to using a boolean <code>AND</code> on all boolean
  values (such as in the case with <code>all</code>) or using a boolean <code>OR</code> on all boolean
  values (as in <code>any</code>).</p>
  
  <p>Does BigQuery have this feature?  I can sort of approximate it using <code>max</code> and
  <code>min</code> but it's not ideal.</p>
  
  <p>Example:</p>
  
  <pre><code>select
  month(date_time) m,
  count(*) as ct,
  max(id_is_present),
  min(id_is_present),
  max(starts_with_one) max_one,
  min(starts_with_one) min_one,
  from
  (
      select
      length(user_id) &gt; 1 id_is_present,
      regexp_match(user_id, r'^1') starts_with_one,
      date_time
      from
      [user_events.2015_02]
  )
  group by
  m
  </code></pre>
  
  <p>It's exploiting a behavior of <code>max(true, false, false)</code> yielding <code>true</code>, so you could sort of implement <code>any</code> and <code>all</code> by searching through the column for values and then building from there.</p>
  
  <p>Is this the hack I have to rely on or does BigQuery support boolean aggregates?</p>