Is there something similar to pig STREAM in PigPen (https://pig.apache.org/docs/r0.7.0/piglatin_ref2.html#STREAM) or is there as work around to use this in PigPen.
Thank you so much, in advance.
- Ajay
--You received this message because you are subscribed to the Google Groups "PigPen Support" group.To unsubscribe from this group and stop receiving emails from it, send an email to pigpen-suppor...@googlegroups.com.For more options, visit https://groups.google.com/d/optout.
Hey Matt,
Thank you for the information.
Use case:
We have a legacy code that uses Pig Stream command, to stream data to a classifier that's written in python (nltk + scilearn etc).
- Ajay
(ns pigpen-demo.core
(:require [pigpen.raw :as pig-raw]
[pigpen.core :as pig]
[pigpen.core.op :as pig-op]
[pigpen.pig.script :as pig-script]))
(defn stream$
[command relation]
(->
(#'pigpen.raw/command :stream relation {})
(assoc :command command
:field-type :native)))
(defn stream [command relation]
(->> relation
(pig-op/bind$ (pig-op/map->bind 'pr-str) {:field-type :native})
(stream$ command)
(pig-op/bind$ (pig-op/map->bind 'read-string) {:field-type-in :native})))
(defmethod pig-script/command->script :stream
[{:keys [id ancestors command]}]
(let [pig-id (#'pigpen.pig.script/escape-id id)
relation-id (#'pigpen.pig.script/escape-id (first ancestors))]
(str pig-id " = STREAM " relation-id " THROUGH '" command "';")))