Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Pig, mail # user - Cross Product of Two Tuples?


Copy link to this message
-
Cross Product of Two Tuples?
Eli Finkelshteyn 2012-04-04, 18:18
Hi Folks,
I'm currently trying to do something I figured would be trivial, but
actually wound up being a bit of work for me, so I'm wondering if I'm
missing something. All I want to do is get a cross product of two
tuples. So for example, given an input of:

('hello', 'howdy', 'hi'), ('hola', 'bonjour')

I'd get:

('hello', 'hola')
('hello', 'bonjour')
('howdy', 'hola')
('howdy', 'bonjour')
('hi', 'hola')
('hi', 'bonjour')

At first, I figured I could FLATTEN(TOBAG(tuple1, tuple2)), but that's
no good cause the tuples are first themselves put into new tuples. So,
what I'm left with no is writing a dirty and slow python udf for this.
Is there really no better way to do this? I'd think it would be a pretty
standard task.

Eli
+
Herbert Mühlburger 2012-04-04, 18:24
+
Prashant Kommireddi 2012-04-04, 18:24
+
Eli Finkelshteyn 2012-04-04, 18:40
+
Jonathan Coveney 2012-04-04, 18:43
+
Eli Finkelshteyn 2012-04-04, 21:37
+
Scott Carey 2012-04-05, 17:04
+
Jonathan Coveney 2012-04-05, 18:25
+
Scott Carey 2012-04-05, 20:35
+
Jonathan Coveney 2012-04-05, 23:41
+
Scott Carey 2012-04-06, 01:23
+
Eli Finkelshteyn 2012-04-07, 23:27
+
Jonathan Coveney 2012-04-06, 06:45