I spent some more time looking at this and it becomes fairly unwieldy. I've actually gone back to defining a sql-like basic algebraic expression syntax. Same concepts but much more crisp. I hope to share something of it soon.
On Sat, Nov 17, 2012 at 5:00 AM, InJun Song <[email protected]> wrote: > Seems good. To be more explicitly, we could refer variables by appending $ > mark.. For example, > > [ > { fn: "ref", ref: "user.gender"}, > { fn: "equals", val1: "$0", val2: "male"} > { fn: "equals", val1: "$0", val2: "female"} > { fn: "isnull", val1: "$0"} > { fn: "case", cases: [ > { condition: "$1", output: ":/" }, > { condition: "$2", output: ":)"}, > { condition: "$3", output: ":("}, > { condition: "$4", output: ":o"} > ]} > ] > > > > > On Wed, Nov 14, 2012 at 11:27 AM, Jacques Nadeau <[email protected] > >wrote: > > > I've been working on blowing out some example logical plans. > Originally, I > > was thinking that embedded expressions would be okay (see my previous > > email). As I work through it, I think that utilizing ssa-ish > > representation makes more sense for the logical plan. An example of this > > might be: > > > > Original Expression: > > > > left(regex("activity.cookie", "persistent=([^;]*)"), 3) > > > > New Expression > > > > [ > > { fn: "def", ref: "activity.cookie"}, > > { fn: "regex", val: "0", pattern: "persistent=([^;]*)"} > > { fn: "left", val: "1", length: "3" } > > ] > > > > Everything becomes a function. Even case statements. For clarity, a > > function can receive nested arguments. > > > > CASE > > WHEN user.gender='male' THEN ":/" > > WHEN user.gender='female THEN ":)" > > WHEN user.gender is null THEN ":(" > > ELSE ":o" > > END > > > > Becomes: > > > > [ > > { fn: "ref", ref: "user.gender"}, > > { fn: "equals", val1: "0", val2: "male"} > > { fn: "equals", val1: "0", val2: "female"} > > { fn: "isnull", val1: "0"} > > { fn: "case", cases: [ > > { condition: "1", output: ":/" }, > > { condition: "2", output: ":)"}, > > { condition: "3", output: ":("}, > > { condition: "4", output: ":o"} > > ]} > > ] > > > > > > Thoughts/Opinions? To simplify, we could things like make single value > > argument functions implicitly refer to the previous output if no input is > > provided... > > > > Jacques > > >
