dataform-co / dataform

Dataform is a framework for managing SQL based data operations in BigQuery
https://cloud.google.com/dataform/docs
Apache License 2.0
853 stars 165 forks source link

Update unit test's result messages #1812

Closed spider-man-tm closed 2 months ago

spider-man-tm commented 3 months ago

This PR is linked to the following issue:

close #1791

Current

Prepare the following table and its corresponding unit test.

Test table:

config {
    type: "table",
    schema: "hoge",
    name: "fuga"
}

select
  user_id
from
  ${ref("users")}

Test code:

config {
  type: "test",
  dataset: "fuga",
}

select 1 as user_id union all
select cast(null as int64) as user_id

input "users" {
  select 1 as user_id union all
  select 2 as user_id
}

Given that the expected block includes cast(null as int64), it would be more user-friendly to have the output display as follows:

For row 1 and column "user_id": expected null, but saw "2"

However, the current output is as follows, which can cause confusion for the user:

For row 1 and column "user_id": expected type "object", but saw type "number".

Before Committing

google-cla[bot] commented 3 months ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Ekrekr commented 2 months ago

I've run the tests, and all pass. Will merge, thanks for doing this!