Skip to content

Multi-active satellite: src_ma_key need to be included in hashdiff calcluation? #96

Answered by tkirschke
cmettler asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @cmettler and thanks for reaching out!

Your input made me do some research, and apparently STRING_AGG() (SQL Server), LISTAGG() (Snowflake), and STRING_AGG() (BigQuery) all ignore NULL rows in the input.

A row in the current multi-active hashdiff calculation is set to NULL, if all input columns are NULL, achieved by the "NULLIF" function around the CONCAT().

To fix this, that NULLIF needs to be replaced, e.g. by a REPLACE() function, that scans for the "all_null" string, which would indicate that all columns are NULL, and replace that by the NULL placeholder "^^".

Based on the example code you provided, a SQL Server multi active hash calculation would need to look like this:

WITH sourc…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@cmettler
Comment options

@tkirschke
Comment options

Answer selected by cmettler
Comment options

You must be logged in to vote
2 replies
@cmettler
Comment options

@cmettler
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants