Changeset: a0587c55bd30 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a0587c55bd30 Modified Files: sql/backends/monet5/rel_bin.c sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-2join-query.stable.out sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-2join-view.stable.out Branch: Oct2020 Log Message:
fixed problem with rel2bin_basetable, where only a single (tid) column was returned, only return sql_tid, no candidates(are handled already). diffs (217 lines): diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -1665,8 +1665,10 @@ rel2bin_basetable(backend *be, sql_rel * if (col) s = stmt_mirror(be, col); - else + else { s = dels?dels:stmt_tid(be, t, 0); + dels = NULL; + } s = stmt_alias(be, s, rnme, TID); } else if (oname[0] == '%') { sql_idx *i = find_sql_idx(t, oname+1); diff --git a/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-2join-query.stable.out b/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-2join-query.stable.out --- a/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-2join-query.stable.out +++ b/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-2join-query.stable.out @@ -184,8 +184,8 @@ end user.main; % clob # type % 195 # length function user.main():void; - X_1:void := querylog.define("explain select id , v2 from fk left outer join pk1 on fk.fk1 = pk1.pk1 left outer join pk2 on fk.fk2 = pk2.pk2 order by id;":str, "sequential_pipe":str, 104:int); - X_49:bat[:int] := bat.new(nil:int); + X_1:void := querylog.define("explain select id , v2 from fk left outer join pk1 on fk.fk1 = pk1.pk1 left outer join pk2 on fk.fk2 = pk2.pk2 order by id;":str, "sequential_pipe":str, 103:int); + X_48:bat[:int] := bat.new(nil:int); X_4:int := sql.mvc(); C_5:bat[:oid] := sql.tid(X_4:int, "sys":str, "fk":str); X_22:bat[:oid] := sql.bind_idxbat(X_4:int, "sys":str, "fk":str, "fk_fk1_fkey":str, 0:int); @@ -194,50 +194,49 @@ function user.main():void; X_27:bat[:oid] := sql.delta(X_22:bat[:oid], X_25:bat[:oid], X_26:bat[:oid], X_24:bat[:oid]); X_37:bat[:oid] := algebra.projection(C_5:bat[:oid], X_27:bat[:oid]); C_34:bat[:oid] := sql.tid(X_4:int, "sys":str, "pk1":str); - C_39:bat[:oid] := algebra.projection(C_34:bat[:oid], C_34:bat[:oid]); - X_40:bat[:oid] := algebra.join(X_37:bat[:oid], C_39:bat[:oid], nil:BAT, nil:BAT, false:bit, nil:lng); + X_39:bat[:oid] := algebra.join(X_37:bat[:oid], C_34:bat[:oid], nil:BAT, nil:BAT, false:bit, nil:lng); X_17:bat[:int] := sql.bind(X_4:int, "sys":str, "fk":str, "id":str, 0:int); X_36:bat[:int] := algebra.projection(C_5:bat[:oid], X_17:bat[:int]); - X_48:bat[:int] := algebra.projection(X_40:bat[:oid], X_36:bat[:int]); - C_46:bat[:oid] := bat.mirror(X_36:bat[:int]); - C_47:bat[:oid] := algebra.difference(C_46:bat[:oid], X_40:bat[:oid], nil:BAT, nil:BAT, false:bit, false:bit, nil:lng); + X_47:bat[:int] := algebra.projection(X_39:bat[:oid], X_36:bat[:int]); + C_45:bat[:oid] := bat.mirror(X_36:bat[:int]); + C_46:bat[:oid] := algebra.difference(C_45:bat[:oid], X_39:bat[:oid], nil:BAT, nil:BAT, false:bit, false:bit, nil:lng); X_28:bat[:oid] := sql.bind_idxbat(X_4:int, "sys":str, "fk":str, "fk_fk2_fkey":str, 0:int); (X_31:bat[:oid], X_32:bat[:oid]) := sql.bind_idxbat(X_4:int, "sys":str, "fk":str, "fk_fk2_fkey":str, 2:int); X_30:bat[:oid] := sql.bind_idxbat(X_4:int, "sys":str, "fk":str, "fk_fk2_fkey":str, 1:int); X_33:bat[:oid] := sql.delta(X_28:bat[:oid], X_31:bat[:oid], X_32:bat[:oid], X_30:bat[:oid]); X_38:bat[:oid] := algebra.projection(C_5:bat[:oid], X_33:bat[:oid]); - X_51:bat[:int] := bat.append(X_49:bat[:int], X_48:bat[:int], true:bit); - X_53:bat[:int] := algebra.projection(C_47:bat[:oid], X_36:bat[:int]); - X_54:bat[:int] := bat.append(X_51:bat[:int], X_53:bat[:int], true:bit); - X_62:bat[:oid] := bat.new(nil:oid); - X_61:bat[:oid] := algebra.projection(X_40:bat[:oid], X_38:bat[:oid]); - X_63:bat[:oid] := bat.append(X_62:bat[:oid], X_61:bat[:oid], true:bit); - X_64:bat[:oid] := algebra.projection(C_47:bat[:oid], X_38:bat[:oid]); - X_65:bat[:oid] := bat.append(X_63:bat[:oid], X_64:bat[:oid], true:bit); - X_96:bat[:int] := bat.new(nil:int); - C_72:bat[:oid] := sql.tid(X_4:int, "sys":str, "pk2":str); - (X_87:bat[:oid], X_88:bat[:oid]) := algebra.join(X_65:bat[:oid], C_72:bat[:oid], nil:BAT, nil:BAT, false:bit, nil:lng); - X_95:bat[:int] := algebra.projection(X_87:bat[:oid], X_54:bat[:int]); - C_93:bat[:oid] := bat.mirror(X_54:bat[:int]); - C_94:bat[:oid] := algebra.difference(C_93:bat[:oid], X_87:bat[:oid], nil:BAT, nil:BAT, false:bit, false:bit, nil:lng); - X_80:bat[:int] := sql.bind(X_4:int, "sys":str, "pk2":str, "v2":str, 0:int); - X_98:bat[:int] := bat.append(X_96:bat[:int], X_95:bat[:int], true:bit); - X_100:bat[:int] := algebra.projection(C_94:bat[:oid], X_54:bat[:int]); - X_101:bat[:int] := bat.append(X_98:bat[:int], X_100:bat[:int], true:bit); - X_119:bat[:int] := bat.new(nil:int); - X_118:bat[:int] := algebra.projectionpath(X_88:bat[:oid], C_72:bat[:oid], X_80:bat[:int]); - X_120:bat[:int] := bat.append(X_119:bat[:int], X_118:bat[:int], true:bit); - X_122:bat[:int] := algebra.project(C_94:bat[:oid], nil:int); - X_123:bat[:int] := bat.append(X_120:bat[:int], X_122:bat[:int], true:bit); - X_138:bat[:str] := bat.pack(".fk":str, ".pk2":str); - X_139:bat[:str] := bat.pack("id":str, "v2":str); - X_140:bat[:str] := bat.pack("int":str, "int":str); - X_141:bat[:int] := bat.pack(32:int, 32:int); - X_142:bat[:int] := bat.pack(0:int, 0:int); - (X_130:bat[:int], X_131:bat[:oid]) := algebra.sort(X_101:bat[:int], false:bit, false:bit, false:bit); - X_135:bat[:int] := algebra.projection(X_131:bat[:oid], X_101:bat[:int]); - X_136:bat[:int] := algebra.projection(X_131:bat[:oid], X_123:bat[:int]); - sql.resultSet(X_138:bat[:str], X_139:bat[:str], X_140:bat[:str], X_141:bat[:int], X_142:bat[:int], X_135:bat[:int], X_136:bat[:int]); + X_50:bat[:int] := bat.append(X_48:bat[:int], X_47:bat[:int], true:bit); + X_52:bat[:int] := algebra.projection(C_46:bat[:oid], X_36:bat[:int]); + X_53:bat[:int] := bat.append(X_50:bat[:int], X_52:bat[:int], true:bit); + X_61:bat[:oid] := bat.new(nil:oid); + X_60:bat[:oid] := algebra.projection(X_39:bat[:oid], X_38:bat[:oid]); + X_62:bat[:oid] := bat.append(X_61:bat[:oid], X_60:bat[:oid], true:bit); + X_63:bat[:oid] := algebra.projection(C_46:bat[:oid], X_38:bat[:oid]); + X_64:bat[:oid] := bat.append(X_62:bat[:oid], X_63:bat[:oid], true:bit); + X_95:bat[:int] := bat.new(nil:int); + C_71:bat[:oid] := sql.tid(X_4:int, "sys":str, "pk2":str); + (X_86:bat[:oid], X_87:bat[:oid]) := algebra.join(X_64:bat[:oid], C_71:bat[:oid], nil:BAT, nil:BAT, false:bit, nil:lng); + X_94:bat[:int] := algebra.projection(X_86:bat[:oid], X_53:bat[:int]); + C_92:bat[:oid] := bat.mirror(X_53:bat[:int]); + C_93:bat[:oid] := algebra.difference(C_92:bat[:oid], X_86:bat[:oid], nil:BAT, nil:BAT, false:bit, false:bit, nil:lng); + X_79:bat[:int] := sql.bind(X_4:int, "sys":str, "pk2":str, "v2":str, 0:int); + X_97:bat[:int] := bat.append(X_95:bat[:int], X_94:bat[:int], true:bit); + X_99:bat[:int] := algebra.projection(C_93:bat[:oid], X_53:bat[:int]); + X_100:bat[:int] := bat.append(X_97:bat[:int], X_99:bat[:int], true:bit); + X_118:bat[:int] := bat.new(nil:int); + X_117:bat[:int] := algebra.projectionpath(X_87:bat[:oid], C_71:bat[:oid], X_79:bat[:int]); + X_119:bat[:int] := bat.append(X_118:bat[:int], X_117:bat[:int], true:bit); + X_121:bat[:int] := algebra.project(C_93:bat[:oid], nil:int); + X_122:bat[:int] := bat.append(X_119:bat[:int], X_121:bat[:int], true:bit); + X_137:bat[:str] := bat.pack(".fk":str, ".pk2":str); + X_138:bat[:str] := bat.pack("id":str, "v2":str); + X_139:bat[:str] := bat.pack("int":str, "int":str); + X_140:bat[:int] := bat.pack(32:int, 32:int); + X_141:bat[:int] := bat.pack(0:int, 0:int); + (X_129:bat[:int], X_130:bat[:oid]) := algebra.sort(X_100:bat[:int], false:bit, false:bit, false:bit); + X_134:bat[:int] := algebra.projection(X_130:bat[:oid], X_100:bat[:int]); + X_135:bat[:int] := algebra.projection(X_130:bat[:oid], X_122:bat[:int]); + sql.resultSet(X_137:bat[:str], X_138:bat[:str], X_139:bat[:str], X_140:bat[:int], X_141:bat[:int], X_134:bat[:int], X_135:bat[:int]); end user.main; #inline actions= 0 time=2 usec #remap actions= 0 time=3 usec diff --git a/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-2join-view.stable.out b/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-2join-view.stable.out --- a/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-2join-view.stable.out +++ b/sql/test/FeatureRequests/Tests/foreign_key_outer_join_dead_code_elimination-explain-2join-view.stable.out @@ -117,8 +117,8 @@ end user.main; % clob # type % 137 # length function user.main():void; - X_1:void := querylog.define("explain select id , v2 from v2 order by id;":str, "sequential_pipe":str, 104:int); - X_49:bat[:int] := bat.new(nil:int); + X_1:void := querylog.define("explain select id , v2 from v2 order by id;":str, "sequential_pipe":str, 103:int); + X_48:bat[:int] := bat.new(nil:int); X_4:int := sql.mvc(); C_5:bat[:oid] := sql.tid(X_4:int, "sys":str, "fk":str); X_22:bat[:oid] := sql.bind_idxbat(X_4:int, "sys":str, "fk":str, "fk_fk1_fkey":str, 0:int); @@ -127,50 +127,49 @@ function user.main():void; X_27:bat[:oid] := sql.delta(X_22:bat[:oid], X_25:bat[:oid], X_26:bat[:oid], X_24:bat[:oid]); X_37:bat[:oid] := algebra.projection(C_5:bat[:oid], X_27:bat[:oid]); C_34:bat[:oid] := sql.tid(X_4:int, "sys":str, "pk1":str); - C_39:bat[:oid] := algebra.projection(C_34:bat[:oid], C_34:bat[:oid]); - X_40:bat[:oid] := algebra.join(X_37:bat[:oid], C_39:bat[:oid], nil:BAT, nil:BAT, false:bit, nil:lng); + X_39:bat[:oid] := algebra.join(X_37:bat[:oid], C_34:bat[:oid], nil:BAT, nil:BAT, false:bit, nil:lng); X_17:bat[:int] := sql.bind(X_4:int, "sys":str, "fk":str, "id":str, 0:int); X_36:bat[:int] := algebra.projection(C_5:bat[:oid], X_17:bat[:int]); - X_48:bat[:int] := algebra.projection(X_40:bat[:oid], X_36:bat[:int]); - C_46:bat[:oid] := bat.mirror(X_36:bat[:int]); - C_47:bat[:oid] := algebra.difference(C_46:bat[:oid], X_40:bat[:oid], nil:BAT, nil:BAT, false:bit, false:bit, nil:lng); + X_47:bat[:int] := algebra.projection(X_39:bat[:oid], X_36:bat[:int]); + C_45:bat[:oid] := bat.mirror(X_36:bat[:int]); + C_46:bat[:oid] := algebra.difference(C_45:bat[:oid], X_39:bat[:oid], nil:BAT, nil:BAT, false:bit, false:bit, nil:lng); X_28:bat[:oid] := sql.bind_idxbat(X_4:int, "sys":str, "fk":str, "fk_fk2_fkey":str, 0:int); (X_31:bat[:oid], X_32:bat[:oid]) := sql.bind_idxbat(X_4:int, "sys":str, "fk":str, "fk_fk2_fkey":str, 2:int); X_30:bat[:oid] := sql.bind_idxbat(X_4:int, "sys":str, "fk":str, "fk_fk2_fkey":str, 1:int); X_33:bat[:oid] := sql.delta(X_28:bat[:oid], X_31:bat[:oid], X_32:bat[:oid], X_30:bat[:oid]); X_38:bat[:oid] := algebra.projection(C_5:bat[:oid], X_33:bat[:oid]); - X_51:bat[:int] := bat.append(X_49:bat[:int], X_48:bat[:int], true:bit); - X_53:bat[:int] := algebra.projection(C_47:bat[:oid], X_36:bat[:int]); - X_54:bat[:int] := bat.append(X_51:bat[:int], X_53:bat[:int], true:bit); - X_62:bat[:oid] := bat.new(nil:oid); - X_61:bat[:oid] := algebra.projection(X_40:bat[:oid], X_38:bat[:oid]); - X_63:bat[:oid] := bat.append(X_62:bat[:oid], X_61:bat[:oid], true:bit); - X_64:bat[:oid] := algebra.projection(C_47:bat[:oid], X_38:bat[:oid]); - X_65:bat[:oid] := bat.append(X_63:bat[:oid], X_64:bat[:oid], true:bit); - X_96:bat[:int] := bat.new(nil:int); - C_72:bat[:oid] := sql.tid(X_4:int, "sys":str, "pk2":str); - (X_87:bat[:oid], X_88:bat[:oid]) := algebra.join(X_65:bat[:oid], C_72:bat[:oid], nil:BAT, nil:BAT, false:bit, nil:lng); - X_95:bat[:int] := algebra.projection(X_87:bat[:oid], X_54:bat[:int]); - C_93:bat[:oid] := bat.mirror(X_54:bat[:int]); - C_94:bat[:oid] := algebra.difference(C_93:bat[:oid], X_87:bat[:oid], nil:BAT, nil:BAT, false:bit, false:bit, nil:lng); - X_80:bat[:int] := sql.bind(X_4:int, "sys":str, "pk2":str, "v2":str, 0:int); - X_98:bat[:int] := bat.append(X_96:bat[:int], X_95:bat[:int], true:bit); - X_100:bat[:int] := algebra.projection(C_94:bat[:oid], X_54:bat[:int]); - X_101:bat[:int] := bat.append(X_98:bat[:int], X_100:bat[:int], true:bit); - X_119:bat[:int] := bat.new(nil:int); - X_118:bat[:int] := algebra.projectionpath(X_88:bat[:oid], C_72:bat[:oid], X_80:bat[:int]); - X_120:bat[:int] := bat.append(X_119:bat[:int], X_118:bat[:int], true:bit); - X_122:bat[:int] := algebra.project(C_94:bat[:oid], nil:int); - X_123:bat[:int] := bat.append(X_120:bat[:int], X_122:bat[:int], true:bit); - X_138:bat[:str] := bat.pack(".v2":str, ".v2":str); - X_139:bat[:str] := bat.pack("id":str, "v2":str); - X_140:bat[:str] := bat.pack("int":str, "int":str); - X_141:bat[:int] := bat.pack(32:int, 32:int); - X_142:bat[:int] := bat.pack(0:int, 0:int); - (X_130:bat[:int], X_131:bat[:oid]) := algebra.sort(X_101:bat[:int], false:bit, false:bit, false:bit); - X_135:bat[:int] := algebra.projection(X_131:bat[:oid], X_101:bat[:int]); - X_136:bat[:int] := algebra.projection(X_131:bat[:oid], X_123:bat[:int]); - sql.resultSet(X_138:bat[:str], X_139:bat[:str], X_140:bat[:str], X_141:bat[:int], X_142:bat[:int], X_135:bat[:int], X_136:bat[:int]); + X_50:bat[:int] := bat.append(X_48:bat[:int], X_47:bat[:int], true:bit); + X_52:bat[:int] := algebra.projection(C_46:bat[:oid], X_36:bat[:int]); + X_53:bat[:int] := bat.append(X_50:bat[:int], X_52:bat[:int], true:bit); + X_61:bat[:oid] := bat.new(nil:oid); + X_60:bat[:oid] := algebra.projection(X_39:bat[:oid], X_38:bat[:oid]); + X_62:bat[:oid] := bat.append(X_61:bat[:oid], X_60:bat[:oid], true:bit); + X_63:bat[:oid] := algebra.projection(C_46:bat[:oid], X_38:bat[:oid]); + X_64:bat[:oid] := bat.append(X_62:bat[:oid], X_63:bat[:oid], true:bit); + X_95:bat[:int] := bat.new(nil:int); + C_71:bat[:oid] := sql.tid(X_4:int, "sys":str, "pk2":str); + (X_86:bat[:oid], X_87:bat[:oid]) := algebra.join(X_64:bat[:oid], C_71:bat[:oid], nil:BAT, nil:BAT, false:bit, nil:lng); + X_94:bat[:int] := algebra.projection(X_86:bat[:oid], X_53:bat[:int]); + C_92:bat[:oid] := bat.mirror(X_53:bat[:int]); + C_93:bat[:oid] := algebra.difference(C_92:bat[:oid], X_86:bat[:oid], nil:BAT, nil:BAT, false:bit, false:bit, nil:lng); + X_79:bat[:int] := sql.bind(X_4:int, "sys":str, "pk2":str, "v2":str, 0:int); + X_97:bat[:int] := bat.append(X_95:bat[:int], X_94:bat[:int], true:bit); + X_99:bat[:int] := algebra.projection(C_93:bat[:oid], X_53:bat[:int]); + X_100:bat[:int] := bat.append(X_97:bat[:int], X_99:bat[:int], true:bit); + X_118:bat[:int] := bat.new(nil:int); + X_117:bat[:int] := algebra.projectionpath(X_87:bat[:oid], C_71:bat[:oid], X_79:bat[:int]); + X_119:bat[:int] := bat.append(X_118:bat[:int], X_117:bat[:int], true:bit); + X_121:bat[:int] := algebra.project(C_93:bat[:oid], nil:int); + X_122:bat[:int] := bat.append(X_119:bat[:int], X_121:bat[:int], true:bit); + X_137:bat[:str] := bat.pack(".v2":str, ".v2":str); + X_138:bat[:str] := bat.pack("id":str, "v2":str); + X_139:bat[:str] := bat.pack("int":str, "int":str); + X_140:bat[:int] := bat.pack(32:int, 32:int); + X_141:bat[:int] := bat.pack(0:int, 0:int); + (X_129:bat[:int], X_130:bat[:oid]) := algebra.sort(X_100:bat[:int], false:bit, false:bit, false:bit); + X_134:bat[:int] := algebra.projection(X_130:bat[:oid], X_100:bat[:int]); + X_135:bat[:int] := algebra.projection(X_130:bat[:oid], X_122:bat[:int]); + sql.resultSet(X_137:bat[:str], X_138:bat[:str], X_139:bat[:str], X_140:bat[:int], X_141:bat[:int], X_134:bat[:int], X_135:bat[:int]); end user.main; #inline actions= 0 time=1 usec #remap actions= 0 time=2 usec _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list