Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

跨表关联时,关联字段会有类型不匹配的问题 #462

Closed
2 tasks done
allenchen0314 opened this issue Sep 26, 2024 · 1 comment
Closed
2 tasks done

跨表关联时,关联字段会有类型不匹配的问题 #462

allenchen0314 opened this issue Sep 26, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@allenchen0314
Copy link

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

两表对比检测时,在使用impala和trino数据源,如果两边关联的字段是int类型,那么使用coalesce(" + table + "." + QuoteIdentifier.quote(column, needQuote) + ", '')就会报错,impala 和trino不适用改语法

DataVines Version

1

DataVines Config

coalesce(" + table + "." + QuoteIdentifier.quote(column, needQuote)

Running Command

transform sql is: select count(1) as actual_value_313cc67e from ( SELECT ods_ods_flume_agent_agent_config_di_1.id AS id_1, ods_ods_flume_agent_agent_config_di_2.id AS id_2 FROM (SELECT * FROM ods.ods_flume_agent_agent_config_di WHERE (date_id = '20240802') ) ods_ods_flume_agent_agent_config_di_1 LEFT JOIN (SELECT * FROM ods.ods_flume_agent_agent_config_di WHERE (date_id = '20240803') ) ods_ods_flume_agent_agent_config_di_2 ON coalesce(ods_ods_flume_agent_agent_config_di_1.id, '')=coalesce(ods_ods_flume_agent_agent_config_di_2.id, '') WHERE ( NOT (ods_ods_flume_agent_agent_config_di_1.id IS NULL )) AND ( ods_ods_flume_agent_agent_config_di_2.id IS NULL ) ) t, transform_type is : actual_value
[ERROR] 2024-09-26 15:06:18.514 [JobExecutionUniqueId=JOB-20240926-client_local_15:[112] - transform execute error:
java.sql.SQLException: Query failed (#20240926_070618_00004_2uqq9): line 1:465: All COALESCE operands must be the same type or coercible to a common type. Cannot find common type between integer and varchar(0), all types (without duplicates): [integer, varchar(0)]

Error Exception

transform sql is: select count(1) as actual_value_313cc67e from ( SELECT ods_ods_flume_agent_agent_config_di_1.id AS id_1, ods_ods_flume_agent_agent_config_di_2.id AS id_2 FROM (SELECT * FROM ods.ods_flume_agent_agent_config_di WHERE (date_id = '20240802') ) ods_ods_flume_agent_agent_config_di_1 LEFT JOIN (SELECT * FROM ods.ods_flume_agent_agent_config_di WHERE (date_id = '20240803') ) ods_ods_flume_agent_agent_config_di_2 ON coalesce(ods_ods_flume_agent_agent_config_di_1.id, '')=coalesce(ods_ods_flume_agent_agent_config_di_2.id, '') WHERE ( NOT (ods_ods_flume_agent_agent_config_di_1.id IS NULL )) AND ( ods_ods_flume_agent_agent_config_di_2.id IS NULL ) ) t, transform_type is : actual_value
[ERROR] 2024-09-26 15:06:18.514 [JobExecutionUniqueId=JOB-20240926-client_local_15:[112] - transform execute error:
java.sql.SQLException: Query failed (#20240926_070618_00004_2uqq9): line 1:465: All COALESCE operands must be the same type or coercible to a common type. Cannot find common type between integer and varchar(0), all types (without duplicates): [integer, varchar(0)]

Engine Type

local

Java Version

1.8

Screenshots

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
@allenchen0314 allenchen0314 added the bug Something isn't working label Sep 26, 2024
@zixi0825
Copy link
Member

This issue has been fixed in #464

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants