AssertionError: Cannot add expression of different type to set

Hello everyone!

In my DataMesh project i used Dremio for developing queries as per my client needs.
Deploying our components (written in yaml files, Bitbucket) i always get an error which i cannot bypass:

com.dremio.exec.work.foreman.ForemanException) Unexpected exception during fragment initialization: java.lang.AssertionError: Cannot add expression of different type to set:
set type is RecordType(BIGINT NOT NULL $f0) NOT NULL
expression type is RecordType(BIGINT KPI_value_vl) NOT NULL
set is rel#645427277:AggregateRel.LOGICAL.ANY([]).

The code is:

  • name: mOrders
    sql:
    SELECT
    ‘QA’ “code_cd”
    ,((SELECT “value_vl” FROM ?mOrdersCol) + (SELECT “value_vl” FROM ?mOrdersGar)) “value_vl”
    ,CAST(0 AS DECIMAL(15,2)) “value_am”
    FROM…

Later i replaced the SUM column with: CAST(0 AS BIGINT) “KPI_value_vl”
trying to just respect the initial schema of BIGINT, but i got the same error.

I saw a similar topic opened 5 years ago on this community, but with no conclusion.
Do you have any hint on what can we try to do different, to bypass this blocking issue?

Many thanks in advance!!

Can you share a verbose profile? This error typical occurs when two relational operators are supposed to have the same field names and types. You can see how the error says the name and nullability do not match. These errors are usually obscure planner bugs.