You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Multi-JOIN allows to use a column with a wrong table specifier. #23162
bugConfirmed user-visible misbehaviour in official releasecomp-joinsJOINs end-to-end (planning hooks + runtime join operators/algorithms). Single bucket to avoid pla...
changed the title [-]JOIN allows to use a column with a wrong table specifier.[/-][+]Multi-JOIN allows to use a column with a wrong table specifier.[/+]on Apr 15, 2021
:) SET use_analyzer = 1;
:) SELECT * FROM t1 INNER JOIN s ON t1.k = s.k WHERE (t1.d >= now());
0 rows in set. Elapsed: 0.015 sec.
Received exception from server (version 22.9.1):
Code: 36. DB::Exception: Received from localhost:9000. DB::Exception: Identifier t1.d cannot be resolved from table with name default.t1. In scope SELECT * FROM t1 INNER JOIN s ON t1.k = s.k WHERE t1.d >= now(). (BAD_ARGUMENTS)
:) SELECT * FROM t1 INNER JOIN s ON t1.k = s.k INNER JOIN t2 ON t2.x = t1.x WHERE (t1.d >= now());
0 rows in set. Elapsed: 0.015 sec.
Received exception from server (version 22.9.1):
Code: 36. DB::Exception: Received from localhost:9000. DB::Exception: Identifier t1.d cannot be resolved from table with name default.t1. In scope SELECT * FROM t1 INNER JOIN s ON t1.k = s.k INNER JOIN t2 ON t2.x = t1.x WHERE t1.d >= now(). (BAD_ARGUMENTS)
@beijishiqidu This is design related issue. That's why it's fixed in PR with so many changes. Merging and integrating the new query analyzing approach would take some time (it would be disabled by default first). You can experiment with the build from the PR, but we do not recommend using it in the production (I suppose because this problem is about not throwing an exception in the case where it should, it shouldn't be so critical, or not?)
@vdimir I think I understand what you're saying. This is a new query capability, and it may have fixed the problem I had. But I actually found the answer in another issue, and I'm ready to try it. Thank you, my friend;
@vdimir yes, but in this demo, you can see the table 't1' does not have column 'd', but this sql also can be executed successful, I think this is abnormal, am I right?
The following SQL statement is used to reproduce the problem.
Code: 47. DB::Exception: Received from 127.0.0.1:9120. DB::Exception: Missing columns: '102510101' while processing query: 'SELECT COM_FAIL_CAUSE, SIP_RELEASE_CODE, VONR_MO_CALL_CONN_FAIL_TIMES, NAME_102510101, `102510101`, D183111570684_H101.`102510101` AS `--D183111570684_H101.102510101`, D183111570684_H101.`183111861371` AS `--D183111570684_H101.183111861371` FROM SEC_SDR_CS.SDR_VONR_IMS_TER_FAIL_15MIN_CB14_19257 ALL LEFT JOIN (SELECT concat(PROTOCOL_ID, '-', FIRFAILMSG_ID, '-', PD_ID, '-', CAUSE_ID) AS `102510101`, UNIFIED_CAUSE_ID AS `183111861371`, concat(FAILCAUSE, '(', PD, ')') AS NAME_102510101 FROM TEST_DATABASE.DIM_TEST GROUP BY concat(PROTOCOL_ID, '-', FIRFAILMSG_ID, '-', PD_ID, '-', CAUSE_ID), UNIFIED_CAUSE_ID, concat(FAILCAUSE, '(', PD, ')')) AS D183111570684_H101 ON COM_FAIL_CAUSE = `--D183111570684_H101.102510101`', required columns: 'SIP_RELEASE_CODE' 'VONR_MO_CALL_CONN_FAIL_TIMES' 'COM_FAIL_CAUSE' 'NAME_102510101' '102510101' 'D183111570684_H101.102510101' 'D183111570684_H101.183111861371', maybe you meant: ['SIP_RELEASE_CODE','VONR_MO_CALL_CONN_FAIL_TIMES','COM_FAIL_CAUSE'], joined columns: 'D183111570684_H101.102510101' 'D183111570684_H101.183111861371' 'NAME_102510101'.
but this sql can be execute successful in version of 20.3.2.1, but when I upgrade to 21.8.8.29, I faced this issue;
at the beginning, I think #26899 have fixed this issue, and I upgrade the patch, I found the patch has fixed the issue in 26899, but still not fixed my issue;
bugConfirmed user-visible misbehaviour in official releasecomp-joinsJOINs end-to-end (planning hooks + runtime join operators/algorithms). Single bucket to avoid pla...
Activity
[-]JOIN allows to use a column with a wrong table specifier.[/-][+]Multi-JOIN allows to use a column with a wrong table specifier.[/+]hexiaoting commentedon Apr 16, 2021
I will try to fix this.
alexey-milovidov commentedon Jun 17, 2021
#23194
beijishiqidu commentedon Sep 13, 2022
Is this problem fixed now? What's the PR? Thank you very much.
vdimir commentedon Sep 14, 2022
Would be fixed in #31796
beijishiqidu commentedon Sep 22, 2022
Thank you, my friend. But I see that this is not merged, Can we use it directly? Because he changed too many files.
vdimir commentedon Sep 22, 2022
@beijishiqidu This is design related issue. That's why it's fixed in PR with so many changes. Merging and integrating the new query analyzing approach would take some time (it would be disabled by default first). You can experiment with the build from the PR, but we do not recommend using it in the production (I suppose because this problem is about not throwing an exception in the case where it should, it shouldn't be so critical, or not?)
beijishiqidu commentedon Sep 22, 2022
@vdimir I think I understand what you're saying. This is a new query capability, and it may have fixed the problem I had. But I actually found the answer in another issue, and I'm ready to try it. Thank you, my friend;
#26899
beijishiqidu commentedon Sep 26, 2022
@vdimir I found that this PR only fixed their problem, not the current one. #26899, have you any idea for current issue?
vdimir commentedon Sep 26, 2022
@beijishiqidu
Could you give reproducible example for your issue?
I've tested query
from the original comment in this issue #23162 (comment)
Probably your case is a bit different?
beijishiqidu commentedon Sep 26, 2022
@vdimir yes, but in this demo, you can see the table 't1' does not have column 'd', but this sql also can be executed successful, I think this is abnormal, am I right?
The following SQL statement is used to reproduce the problem.
The command output is as follows:
Code: 47. DB::Exception: Received from 127.0.0.1:9120. DB::Exception: Missing columns: '102510101' while processing query: 'SELECT COM_FAIL_CAUSE, SIP_RELEASE_CODE, VONR_MO_CALL_CONN_FAIL_TIMES, NAME_102510101, `102510101`, D183111570684_H101.`102510101` AS `--D183111570684_H101.102510101`, D183111570684_H101.`183111861371` AS `--D183111570684_H101.183111861371` FROM SEC_SDR_CS.SDR_VONR_IMS_TER_FAIL_15MIN_CB14_19257 ALL LEFT JOIN (SELECT concat(PROTOCOL_ID, '-', FIRFAILMSG_ID, '-', PD_ID, '-', CAUSE_ID) AS `102510101`, UNIFIED_CAUSE_ID AS `183111861371`, concat(FAILCAUSE, '(', PD, ')') AS NAME_102510101 FROM TEST_DATABASE.DIM_TEST GROUP BY concat(PROTOCOL_ID, '-', FIRFAILMSG_ID, '-', PD_ID, '-', CAUSE_ID), UNIFIED_CAUSE_ID, concat(FAILCAUSE, '(', PD, ')')) AS D183111570684_H101 ON COM_FAIL_CAUSE = `--D183111570684_H101.102510101`', required columns: 'SIP_RELEASE_CODE' 'VONR_MO_CALL_CONN_FAIL_TIMES' 'COM_FAIL_CAUSE' 'NAME_102510101' '102510101' 'D183111570684_H101.102510101' 'D183111570684_H101.183111861371', maybe you meant: ['SIP_RELEASE_CODE','VONR_MO_CALL_CONN_FAIL_TIMES','COM_FAIL_CAUSE'], joined columns: 'D183111570684_H101.102510101' 'D183111570684_H101.183111861371' 'NAME_102510101'.but this sql can be execute successful in version of 20.3.2.1, but when I upgrade to 21.8.8.29, I faced this issue;
at the beginning, I think #26899 have fixed this issue, and I upgrade the patch, I found the patch has fixed the issue in 26899, but still not fixed my issue;
alexey-milovidov commentedon Mar 20, 2023
@beijishiqidu this large query is fixed by
SET allow_experimental_analyzer = 1We will close this issue after enabling the Analyzer by default.
Add a test for #23162
Merge pull request #47740 from ClickHouse/add-test-23162