From b76c777fa9337a590febcca7397718c98f8cdd80 Mon Sep 17 00:00:00 2001 From: Robin Tang Date: Thu, 12 Dec 2024 13:53:34 -0800 Subject: [PATCH] Clean up. --- clients/snowflake/dialect/dialect_test.go | 4 ++-- lib/sql/tests/columns_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clients/snowflake/dialect/dialect_test.go b/clients/snowflake/dialect/dialect_test.go index 4fb59e240..4be3a2065 100644 --- a/clients/snowflake/dialect/dialect_test.go +++ b/clients/snowflake/dialect/dialect_test.go @@ -82,11 +82,11 @@ func TestSnowflakeDialect_BuildDropColumnQuery(t *testing.T) { func TestSnowflakeDialect_BuildIsNotToastValueExpression(t *testing.T) { assert.Equal(t, - `COALESCE(tbl."BAR" != '__debezium_unavailable_value', true)`, + `COALESCE(TO_VARCHAR(tbl."BAR") NOT LIKE '%__debezium_unavailable_value%', TRUE)`, SnowflakeDialect{}.BuildIsNotToastValueExpression("tbl", columns.NewColumn("bar", typing.Invalid)), ) assert.Equal(t, - `COALESCE(tbl."FOO" != {'key': '__debezium_unavailable_value'}, true)`, + `COALESCE(TO_VARCHAR(tbl."FOO") NOT LIKE '%__debezium_unavailable_value%', TRUE)`, SnowflakeDialect{}.BuildIsNotToastValueExpression("tbl", columns.NewColumn("foo", typing.Struct)), ) } diff --git a/lib/sql/tests/columns_test.go b/lib/sql/tests/columns_test.go index 1799cac88..77147bd30 100644 --- a/lib/sql/tests/columns_test.go +++ b/lib/sql/tests/columns_test.go @@ -181,7 +181,7 @@ func TestBuildColumnsUpdateFragment_Snowflake(t *testing.T) { } actualQuery := sql.BuildColumnsUpdateFragment(stringAndToastCols, "stg", "tgt", snowflakeDialect.SnowflakeDialect{}) - assert.Equal(t, `"FOO"= CASE WHEN stg."FOO" NOT LIKE %__debezium_unavailable_value% THEN stg.\"FOO\" ELSE tgt.\"FOO\" END,\"BAR\"=stg.\"BAR\""`, actualQuery) + assert.Equal(t, `"FOO"= CASE WHEN COALESCE(stg."FOO" NOT LIKE '%__debezium_unavailable_value%', TRUE) THEN stg."FOO" ELSE tgt."FOO" END,"BAR"=stg."BAR"`, actualQuery) } func TestBuildColumnComparison(t *testing.T) {