<commit_before>require_relative './helper.rb'

class ArrayTest < Test::Unit::TestCase
  test "Array equality" do
    msg = "invalidQuery: Equality is not defined for arguments of type ARRAY<INT64> at [2:8]"
    expected_error = Google::Cloud::InvalidArgumentError.new(msg)

    assert_raise(expected_error) do
      query <<~SQL
        SELECT [1] = [1]
      SQL
    end
  end
end<commit_msg>Add a spec that can't grouping by Array<commit_after>require_relative './helper.rb'

class ArrayTest < Test::Unit::TestCase
  test "Array equality" do
    msg = "invalidQuery: Equality is not defined for arguments of type ARRAY<INT64> at [2:8]"
    expected_error = Google::Cloud::InvalidArgumentError.new(msg)

    assert_raise(expected_error) do
      query <<~SQL
        SELECT [1] = [1]
      SQL
    end
  end

  test "group by Array" do
    msg = "invalidQuery: Grouping by expressions of type ARRAY is not allowed at [9:10]"
    expected_error = Google::Cloud::InvalidArgumentError.new(msg)

    assert_raise(expected_error) do
      query <<~SQL
        WITH t AS (
      SELECT *
        FROM UNNEST(ARRAY<STRUCT<id INT64, messages ARRAY<STRING>>>
               [(1, ['a', 'b']), (2, ['c', 'd'])]))

      SELECT messages, COUNT(id)
        FROM t
    GROUP BY 1
      SQL
    end
  end
end
{'fraction_non_alphanumeric': 0.11205564142194745, 'fraction_numerical': 0.015455950540958269, 'mean_word_length': 3.034267912772586, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3993284', 'n_tokens_mistral': 422, 'n_tokens_neox': 398, 'n_words': 126}