Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
19
Task/Hash-join/Deja-Vu/hash-join.djv
Normal file
19
Task/Hash-join/Deja-Vu/hash-join.djv
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
hashJoin table1 index1 table2 index2:
|
||||
local :h {}
|
||||
# hash phase
|
||||
for s in table1:
|
||||
local :key s! index1
|
||||
if not has h key:
|
||||
set-to h key []
|
||||
push-to h! key s
|
||||
# join phase
|
||||
[]
|
||||
for r in table2:
|
||||
for s in copy h! r! index2:
|
||||
push-through swap [ s r ]
|
||||
|
||||
local :table1 [ [ 27 "Jonah" ] [ 18 "Alan" ] [ 28 "Glory" ] [ 18 "Popeye" ] [ 28 "Alan" ] ]
|
||||
local :table2 [ [ "Jonah" "Whales" ] [ "Jonah" "Spiders" ] [ "Alan" "Ghosts" ] [ "Alan" "Zombies" ] [ "Glory" "Buffy" ] ]
|
||||
|
||||
for row in hashJoin table1 1 table2 0:
|
||||
!. row
|
||||
Loading…
Add table
Add a link
Reference in a new issue