@@ -207,10 +207,10 @@ func TestMySQLAdapter_InterpretDataQualityCheck(t *testing.T) {
207207 dataset : "mydb.users" ,
208208 whereClause : "" ,
209209 expectedSQL : `select count(*)
210- from information_schema.columns
211- where table_schema = 'mydb'
212- and table_name = 'users'
213- and ((column_name = 'id' and ordinal_position = 1) or (column_name = 'name' and ordinal_position = 2) or (column_name = 'email' and ordinal_position = 3))` ,
210+ from information_schema.columns
211+ where table_schema = 'mydb'
212+ and table_name = 'users'
213+ and ((column_name = 'id' and ordinal_position = 1) or (column_name = 'name' and ordinal_position = 2) or (column_name = 'email' and ordinal_position = 3))` ,
214214 },
215215 {
216216 name : "expect_columns_ordered check with single column" ,
@@ -225,10 +225,10 @@ func TestMySQLAdapter_InterpretDataQualityCheck(t *testing.T) {
225225 dataset : "testdb.products" ,
226226 whereClause : "" ,
227227 expectedSQL : `select count(*)
228- from information_schema.columns
229- where table_schema = 'testdb'
230- and table_name = 'products'
231- and ((column_name = 'id' and ordinal_position = 1))` ,
228+ from information_schema.columns
229+ where table_schema = 'testdb'
230+ and table_name = 'products'
231+ and ((column_name = 'id' and ordinal_position = 1))` ,
232232 },
233233 {
234234 name : "expect_columns_ordered check invalid dataset format" ,
@@ -245,6 +245,57 @@ func TestMySQLAdapter_InterpretDataQualityCheck(t *testing.T) {
245245 expectError : true ,
246246 errorMessage : "dataset must be in format database.table" ,
247247 },
248+ {
249+ name : "expect_columns check with multiple columns" ,
250+ check : & dbqcore.DataQualityCheck {
251+ Expression : "expect_columns" ,
252+ SchemaCheck : & dbqcore.SchemaCheckConfig {
253+ ExpectColumns : & dbqcore.ExpectColumnsConfig {
254+ Columns : []string {"order_id" , "customer_id" , "total_amount" },
255+ },
256+ },
257+ },
258+ dataset : "ecommerce.orders" ,
259+ whereClause : "" ,
260+ expectedSQL : `select count(*)
261+ from information_schema.columns
262+ where table_schema = 'ecommerce'
263+ and table_name = 'orders'
264+ and (column_name = 'order_id' or column_name = 'customer_id' or column_name = 'total_amount')` ,
265+ },
266+ {
267+ name : "expect_columns check with two columns" ,
268+ check : & dbqcore.DataQualityCheck {
269+ Expression : "expect_columns" ,
270+ SchemaCheck : & dbqcore.SchemaCheckConfig {
271+ ExpectColumns : & dbqcore.ExpectColumnsConfig {
272+ Columns : []string {"product_id" , "price" },
273+ },
274+ },
275+ },
276+ dataset : "shop.products" ,
277+ whereClause : "" ,
278+ expectedSQL : `select count(*)
279+ from information_schema.columns
280+ where table_schema = 'shop'
281+ and table_name = 'products'
282+ and (column_name = 'product_id' or column_name = 'price')` ,
283+ },
284+ {
285+ name : "expect_columns check invalid dataset format" ,
286+ check : & dbqcore.DataQualityCheck {
287+ Expression : "expect_columns" ,
288+ SchemaCheck : & dbqcore.SchemaCheckConfig {
289+ ExpectColumns : & dbqcore.ExpectColumnsConfig {
290+ Columns : []string {"id" , "name" },
291+ },
292+ },
293+ },
294+ dataset : "invalid_dataset" ,
295+ whereClause : "" ,
296+ expectError : true ,
297+ errorMessage : "dataset must be in format database.table" ,
298+ },
248299 {
249300 name : "unknown function fallback" ,
250301 check : & dbqcore.DataQualityCheck {
0 commit comments