UDTF invocation forms

You can invoke a table function by using either of the following syntax forms:
TABLE(func_name(args))
or
TABLE WITH FINAL (func_name(args))

The TABLE syntax causes the query to use normal table behavior, which means that the UDTF is invoked once per each input row. The TABLE WITH FINAL syntax also invokes the UDTF once per each input row, but in addition, the UDTF is invoked again after all the input rows are processed, which allows it to output more rows such as summary rows. The behavior of the TABLE WITH FINAL syntax depends on the locus where the UDTF runs. If the UDTF runs on the S-Blades, for example, the TABLE WITH FINAL post-processing occurs once per dataslice.

When you register a UDTF, you can control whether the user can invoke the UDTF with the WITH FINAL syntax. If you register the UDTF as TABLE, TABLE FINAL ALLOWED, the user can specify either TABLE or TABLE WITH FINAL syntax. If the UDTF is registered as TABLE ALLOWED, for example, the user can specify only the TABLE syntax option. Likewise, if the UDTF is registered as TABLE FINAL ALLOWED, the user must use the TABLE WITH FINAL syntax option.