If a function that operates on partitions (the query has the PARTITION BY KEY syntax in the ON clause, possibly containing the PartitionColumns argument clause), is invoked on data with large partition sizes and high concurrency, the spool space for the database user may be exhausted during partitioning of data and an error is reported.
You can reduce concurrency or decrease partition sizes to resolve the issue. If partition sizes cannot be decreased, run the function on each partition separately using the PARTITION BY ANY syntax, where it is allowed.