From 45a5ca161515b2cdd7766efb5dc5c38d0b7a6a9d Mon Sep 17 00:00:00 2001 From: Robin Tang Date: Thu, 12 Dec 2024 13:58:46 -0800 Subject: [PATCH] Clean up. --- clients/snowflake/dialect/dialect_test.go | 30 +++++++++++++++++------ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/clients/snowflake/dialect/dialect_test.go b/clients/snowflake/dialect/dialect_test.go index 4be3a2065..8625893b3 100644 --- a/clients/snowflake/dialect/dialect_test.go +++ b/clients/snowflake/dialect/dialect_test.go @@ -81,14 +81,28 @@ func TestSnowflakeDialect_BuildDropColumnQuery(t *testing.T) { } func TestSnowflakeDialect_BuildIsNotToastValueExpression(t *testing.T) { - assert.Equal(t, - `COALESCE(TO_VARCHAR(tbl."BAR") NOT LIKE '%__debezium_unavailable_value%', TRUE)`, - SnowflakeDialect{}.BuildIsNotToastValueExpression("tbl", columns.NewColumn("bar", typing.Invalid)), - ) - assert.Equal(t, - `COALESCE(TO_VARCHAR(tbl."FOO") NOT LIKE '%__debezium_unavailable_value%', TRUE)`, - SnowflakeDialect{}.BuildIsNotToastValueExpression("tbl", columns.NewColumn("foo", typing.Struct)), - ) + { + // Unspecified data type + assert.Equal(t, + `COALESCE(TO_VARCHAR(tbl."BAR") NOT LIKE '%__debezium_unavailable_value%', TRUE)`, + SnowflakeDialect{}.BuildIsNotToastValueExpression("tbl", columns.NewColumn("bar", typing.Invalid)), + ) + } + { + // Structs + assert.Equal(t, + `COALESCE(TO_VARCHAR(tbl."FOO") NOT LIKE '%__debezium_unavailable_value%', TRUE)`, + SnowflakeDialect{}.BuildIsNotToastValueExpression("tbl", columns.NewColumn("foo", typing.Struct)), + ) + } + { + // String + assert.Equal(t, + `COALESCE(tbl."BAR" NOT LIKE '%__debezium_unavailable_value%', TRUE)`, + SnowflakeDialect{}.BuildIsNotToastValueExpression("tbl", columns.NewColumn("bar", typing.String)), + ) + } + } func buildColumns(colTypesMap map[string]typing.KindDetails) *columns.Columns {