Using SPI for set returning functions