[erlang-questions] qlc join query results

Hans Bolinder <>
Tue Dec 9 16:23:31 CET 2008


[Bernard Duggan:]
> > What exactly is it about that ordering of generators that causes
> > qlc to choose a different join method and, in a more general
> > sense, how can we predict which method will be chosen?

> Whoops - on inspection of the results of qlc:info(), it appears both the
> first and second queries use the 'merge' join method.  So my question
> above should in fact read "why does the 'merge' join method produce
> different results depending on the order of the generators?".

It's a bug. Thanks for reporting it.

Best regards,

Hans Bolinder, Erlang/OTP, Ericsson



*** /usr/local/otp/releases/otp_beam_linux_sles10_x64_r12b_patched/lib/stdlib-1.15.5/src/qlc.erl	Thu Nov  6 12:10:06 2008
--- /clearcase/otp/erts/lib/stdlib/src/qlc.erl	Tue Dec  9 16:00:15 2008
***************
*** 2978,2985 ****
      end.
  
  %% element(C2, E2_0) == K1, element(C2, E2) == K1_0
! same_keys1(E1_0, _K1_0, [], _C1, E2, _C2, E2_0, _L2, M) ->
!     end_merge_join([?JWRAP(E1_0, E2_0), ?JWRAP(E1_0, E2)], M);
  same_keys1(E1_0, K1_0, [E1 | _]=L1, C1, E2, C2, E2_0, L2, M) ->
      K1 = element(C1, E1),
      if 
--- 2978,2986 ----
      end.
  
  %% element(C2, E2_0) == K1, element(C2, E2) == K1_0
! same_keys1(E1_0, K1_0, []=L1, C1, E2, C2, E2_0, L2, M) ->
!     [?JWRAP(E1_0, E2_0), ?JWRAP(E1_0, E2) |
!      fun() -> same_keys(K1_0, E1_0, L1, C1, L2, C2, M) end];
  same_keys1(E1_0, K1_0, [E1 | _]=L1, C1, E2, C2, E2_0, L2, M) ->
      K1 = element(C1, E1),
      if 



More information about the erlang-questions mailing list