September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
34
Task/Hash-join/Phix/hash-join.phix
Normal file
34
Task/Hash-join/Phix/hash-join.phix
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
constant A = {{27,"Jonah"},
|
||||
{18,"Alan"},
|
||||
{28,"Glory"},
|
||||
{18,"Popeye"},
|
||||
{28,"Alan"}},
|
||||
B = {{"Jonah","Whales"},
|
||||
{"Jonah","Spiders"},
|
||||
{"Alan", "Ghosts"},
|
||||
{"Alan", "Zombies"},
|
||||
{"Glory","Buffy"}},
|
||||
jA = 2,
|
||||
jB = 1,
|
||||
MB = new_dict()
|
||||
sequence C = {}
|
||||
for i=1 to length(B) do
|
||||
object key = B[i][jB]
|
||||
object data = getd(key,MB)
|
||||
if data=0 then
|
||||
data = {B[i]}
|
||||
else
|
||||
data = append(data,B[i])
|
||||
end if
|
||||
putd(key,data,MB)
|
||||
end for
|
||||
for i=1 to length(A) do
|
||||
object data = getd(A[i][jA],MB)
|
||||
if sequence(data) then
|
||||
for j=1 to length(data) do
|
||||
C = append(C,{A[i],data[j]})
|
||||
end for
|
||||
end if
|
||||
end for
|
||||
destroy_dict(MB)
|
||||
pp(C,{pp_Nest,1})
|
||||
Loading…
Add table
Add a link
Reference in a new issue