code: def test_groupby_agg_bad_on(ray_start_regular_shared):
      # Test bad on for groupby aggregation
      xs = list(range(100))
      df = pd.DataFrame(
          {"A": [x % 3 for x in xs], "B": xs, "C": [2 * x for x in xs]}
      )
      # Wrong type.
      with pytest.raises(Exception):
          ray.data.from_pandas(df).groupby("A").mean(5).materialize()
      with pytest.raises(Exception):
          ray.data.from_pandas(df).groupby("A").mean([5]).materialize()
      # Empty list.
      with pytest.raises(ValueError):
          ray.data.from_pandas(df).groupby("A").mean([]).materialize()
      # Nonexistent column.
      with pytest.raises(ValueError):
          ray.data.from_pandas(df).groupby("A").mean("D").materialize()
      with pytest.raises(ValueError):
          ray.data.from_pandas(df).groupby("A").mean(
              ["B", "D"]
          ).materialize()
      # Columns for simple Dataset.
      with pytest.raises(ValueError):
          ray.data.from_items(xs).groupby(lambda x: x % 3 == 0).mean(
              "A"
          ).materialize()
  
      # Test bad on for global aggregation
      # Wrong type.
      with pytest.raises(Exception):
          ray.data.from_pandas(df).mean(5).materialize()
      with pytest.raises(Exception):
          ray.data.from_pandas(df).mean([5]).materialize()
      # Empty list.
      with pytest.raises(ValueError):
          ray.data.from_pandas(df).mean([]).materialize()
      # Nonexistent column.
      with pytest.raises(ValueError):
          ray.data.from_pandas(df).mean("D").materialize()
      with pytest.raises(ValueError):
          ray.data.from_pandas(df).mean(["B", "D"]).materialize()
      # Columns for simple Dataset.
      with pytest.raises(ValueError):
          ray.data.from_items(xs).mean("A").materialize()
  
imports: import itertools
  import math
  import random
  import time
  from unittest.mock import patch
  import numpy
  import pandas
  import pyarrow
  import pytest
  import ray
  from ray.data.aggregate import AggregateFn, Count, Max, Mean, Min, Quantile, Std, Sum
  from ray.data.context import DataContext
  from ray.data.tests.conftest import *
  from ray.data.tests.util import column_udf, named_values
  from ray.tests.conftest import *
label_desc: Use image node_id 26 for calling a global function with example usage: test_groupby_agg_bad_on(ray_start_regular_shared) without return types