process_row_and_columns.sql 481 B

12345678910111213141516171819
  1. /* syntax version 1 */
  2. /* postgres can not */
  3. $udfScript = @@
  4. def processRow(row, tag, separator):
  5. return {"value":row.Name + separator + row.Value + separator + tag};
  6. @@;
  7. $udf = Python::processRow(
  8. Callable<(Struct<Name:String, Tag:String, Value:String>, String, String)->Struct<value:String>>,
  9. $udfScript
  10. );
  11. $data = (
  12. SELECT key AS Name, value AS Value, subkey AS Tag FROM plato.Input0
  13. );
  14. $separator = "|";
  15. PROCESS $data USING $udf(TableRow(), Tag, $separator);