Azure / azure-stream-analytics

Azure Stream Analytics
MIT License
225 stars 937 forks source link

Unable to UNION records with 'bit' column. #178

Open pavel-orlov opened 1 year ago

pavel-orlov commented 1 year ago

Compatibility version: 1.2

[Error] Failed to compile the query script: Schemas of streams in union should match exactly. Column 'aa.bb' from left side has incompatible type 'bit' vs 'bit' from right side..

k-krupka commented 9 months ago

+1

with
RawQuery as
(
    SELECT
        timestamp,
        TRY_CAST(0 AS bit) as 'PLSGFSSP1DA1_Device1_Load',
        TRY_CAST(1 AS bit) as 'PLSGFSSP2DA1_Device1_Load'
    FROM
        [telemetry]
),
DataForCompressor as
(
    SELECT         
        timestamp,
        TRY_CAST(PLSGFSSP1DA1_Device1_Load as bit) as Load
    FROM [RawQuery] 
    UNION 
    SELECT         
        timestamp,
        TRY_CAST(PLSGFSSP2DA1_Device1_Load as bit) as Load
    FROM
        [telemetry]
)
SELECT     *
INTO       [ModbusSensorStreamV2]
FROM        [DataForCompressor]