|
45 | 45 | "_airbyte_raw_id",
|
46 | 46 | "_airbyte_extracted_at",
|
47 | 47 | OBJECT(
|
48 |
| - 'errors', |
| 48 | + 'changes', |
49 | 49 | ARRAY_CONCAT(
|
50 | 50 | ARRAY_CONCAT(
|
51 | 51 | ARRAY_CONCAT(
|
|
61 | 61 | ARRAY_CONCAT(
|
62 | 62 | ARRAY_CONCAT(
|
63 | 63 | ARRAY_CONCAT(
|
| 64 | + ARRAY_CONCAT( |
| 65 | + CASE WHEN ( |
| 66 | + "_airbyte_data"."id1" is not null |
| 67 | + and "id1" is null |
| 68 | + ) THEN ARRAY(JSON_PARSE('{"field": "id1", "change": "NULLED", "reason": "DESTINATION_TYPECAST_ERROR"}')) ELSE ARRAY() END , |
| 69 | + CASE WHEN ( |
| 70 | + "_airbyte_data"."id2" is not null |
| 71 | + and "id2" is null |
| 72 | + ) THEN ARRAY(JSON_PARSE('{"field": "id2", "change": "NULLED", "reason": "DESTINATION_TYPECAST_ERROR"}')) ELSE ARRAY() END |
| 73 | + ), |
64 | 74 | CASE WHEN (
|
65 |
| - "_airbyte_data"."id1" is not null |
66 |
| - and "id1" is null |
67 |
| - ) THEN ARRAY('Problem with `id1`') ELSE ARRAY() END , |
68 |
| - CASE WHEN ( |
69 |
| - "_airbyte_data"."id2" is not null |
70 |
| - and "id2" is null |
71 |
| - ) THEN ARRAY('Problem with `id2`') ELSE ARRAY() END |
| 75 | + "_airbyte_data"."updated_at" is not null |
| 76 | + and "updated_at" is null |
| 77 | + ) THEN ARRAY(JSON_PARSE('{"field": "updated_at", "change": "NULLED", "reason": "DESTINATION_TYPECAST_ERROR"}')) ELSE ARRAY() END |
72 | 78 | ),
|
73 | 79 | CASE WHEN (
|
74 |
| - "_airbyte_data"."updated_at" is not null |
75 |
| - and "updated_at" is null |
76 |
| - ) THEN ARRAY('Problem with `updated_at`') ELSE ARRAY() END |
| 80 | + "_airbyte_data"."struct" is not null |
| 81 | + and "struct" is null |
| 82 | + ) THEN ARRAY(JSON_PARSE('{"field": "struct", "change": "NULLED", "reason": "DESTINATION_TYPECAST_ERROR"}')) ELSE ARRAY() END |
77 | 83 | ),
|
78 | 84 | CASE WHEN (
|
79 |
| - "_airbyte_data"."struct" is not null |
80 |
| - and "struct" is null |
81 |
| - ) THEN ARRAY('Problem with `struct`') ELSE ARRAY() END |
| 85 | + "_airbyte_data"."array" is not null |
| 86 | + and "array" is null |
| 87 | + ) THEN ARRAY(JSON_PARSE('{"field": "array", "change": "NULLED", "reason": "DESTINATION_TYPECAST_ERROR"}')) ELSE ARRAY() END |
82 | 88 | ),
|
83 | 89 | CASE WHEN (
|
84 |
| - "_airbyte_data"."array" is not null |
85 |
| - and "array" is null |
86 |
| - ) THEN ARRAY('Problem with `array`') ELSE ARRAY() END |
| 90 | + "_airbyte_data"."string" is not null |
| 91 | + and "string" is null |
| 92 | + ) THEN ARRAY(JSON_PARSE('{"field": "string", "change": "NULLED", "reason": "DESTINATION_TYPECAST_ERROR"}')) ELSE ARRAY() END |
87 | 93 | ),
|
88 | 94 | CASE WHEN (
|
89 |
| - "_airbyte_data"."string" is not null |
90 |
| - and "string" is null |
91 |
| - ) THEN ARRAY('Problem with `string`') ELSE ARRAY() END |
| 95 | + "_airbyte_data"."number" is not null |
| 96 | + and "number" is null |
| 97 | + ) THEN ARRAY(JSON_PARSE('{"field": "number", "change": "NULLED", "reason": "DESTINATION_TYPECAST_ERROR"}')) ELSE ARRAY() END |
92 | 98 | ),
|
93 | 99 | CASE WHEN (
|
94 |
| - "_airbyte_data"."number" is not null |
95 |
| - and "number" is null |
96 |
| - ) THEN ARRAY('Problem with `number`') ELSE ARRAY() END |
| 100 | + "_airbyte_data"."integer" is not null |
| 101 | + and "integer" is null |
| 102 | + ) THEN ARRAY(JSON_PARSE('{"field": "integer", "change": "NULLED", "reason": "DESTINATION_TYPECAST_ERROR"}')) ELSE ARRAY() END |
97 | 103 | ),
|
98 | 104 | CASE WHEN (
|
99 |
| - "_airbyte_data"."integer" is not null |
100 |
| - and "integer" is null |
101 |
| - ) THEN ARRAY('Problem with `integer`') ELSE ARRAY() END |
| 105 | + "_airbyte_data"."boolean" is not null |
| 106 | + and "boolean" is null |
| 107 | + ) THEN ARRAY(JSON_PARSE('{"field": "boolean", "change": "NULLED", "reason": "DESTINATION_TYPECAST_ERROR"}')) ELSE ARRAY() END |
102 | 108 | ),
|
103 | 109 | CASE WHEN (
|
104 |
| - "_airbyte_data"."boolean" is not null |
105 |
| - and "boolean" is null |
106 |
| - ) THEN ARRAY('Problem with `boolean`') ELSE ARRAY() END |
| 110 | + "_airbyte_data"."timestamp_with_timezone" is not null |
| 111 | + and "timestamp_with_timezone" is null |
| 112 | + ) THEN ARRAY(JSON_PARSE('{"field": "timestamp_with_timezone", "change": "NULLED", "reason": "DESTINATION_TYPECAST_ERROR"}')) ELSE ARRAY() END |
107 | 113 | ),
|
108 | 114 | CASE WHEN (
|
109 |
| - "_airbyte_data"."timestamp_with_timezone" is not null |
110 |
| - and "timestamp_with_timezone" is null |
111 |
| - ) THEN ARRAY('Problem with `timestamp_with_timezone`') ELSE ARRAY() END |
| 115 | + "_airbyte_data"."timestamp_without_timezone" is not null |
| 116 | + and "timestamp_without_timezone" is null |
| 117 | + ) THEN ARRAY(JSON_PARSE('{"field": "timestamp_without_timezone", "change": "NULLED", "reason": "DESTINATION_TYPECAST_ERROR"}')) ELSE ARRAY() END |
112 | 118 | ),
|
113 | 119 | CASE WHEN (
|
114 |
| - "_airbyte_data"."timestamp_without_timezone" is not null |
115 |
| - and "timestamp_without_timezone" is null |
116 |
| - ) THEN ARRAY('Problem with `timestamp_without_timezone`') ELSE ARRAY() END |
| 120 | + "_airbyte_data"."time_with_timezone" is not null |
| 121 | + and "time_with_timezone" is null |
| 122 | + ) THEN ARRAY(JSON_PARSE('{"field": "time_with_timezone", "change": "NULLED", "reason": "DESTINATION_TYPECAST_ERROR"}')) ELSE ARRAY() END |
117 | 123 | ),
|
118 | 124 | CASE WHEN (
|
119 |
| - "_airbyte_data"."time_with_timezone" is not null |
120 |
| - and "time_with_timezone" is null |
121 |
| - ) THEN ARRAY('Problem with `time_with_timezone`') ELSE ARRAY() END |
| 125 | + "_airbyte_data"."time_without_timezone" is not null |
| 126 | + and "time_without_timezone" is null |
| 127 | + ) THEN ARRAY(JSON_PARSE('{"field": "time_without_timezone", "change": "NULLED", "reason": "DESTINATION_TYPECAST_ERROR"}')) ELSE ARRAY() END |
122 | 128 | ),
|
123 | 129 | CASE WHEN (
|
124 |
| - "_airbyte_data"."time_without_timezone" is not null |
125 |
| - and "time_without_timezone" is null |
126 |
| - ) THEN ARRAY('Problem with `time_without_timezone`') ELSE ARRAY() END |
| 130 | + "_airbyte_data"."date" is not null |
| 131 | + and "date" is null |
| 132 | + ) THEN ARRAY(JSON_PARSE('{"field": "date", "change": "NULLED", "reason": "DESTINATION_TYPECAST_ERROR"}')) ELSE ARRAY() END |
127 | 133 | ),
|
128 | 134 | CASE WHEN (
|
129 |
| - "_airbyte_data"."date" is not null |
130 |
| - and "date" is null |
131 |
| - ) THEN ARRAY('Problem with `date`') ELSE ARRAY() END |
| 135 | + "_airbyte_data"."unknown" is not null |
| 136 | + and "unknown" is null |
| 137 | + ) THEN ARRAY(JSON_PARSE('{"field": "unknown", "change": "NULLED", "reason": "DESTINATION_TYPECAST_ERROR"}')) ELSE ARRAY() END |
132 | 138 | ),
|
133 | 139 | CASE WHEN (
|
134 |
| - "_airbyte_data"."unknown" is not null |
135 |
| - and "unknown" is null |
136 |
| - ) THEN ARRAY('Problem with `unknown`') ELSE ARRAY() END |
| 140 | + "_airbyte_data"."_ab_cdc_deleted_at" is not null |
| 141 | + and "_ab_cdc_deleted_at" is null |
| 142 | + ) THEN ARRAY(JSON_PARSE('{"field": "_ab_cdc_deleted_at", "change": "NULLED", "reason": "DESTINATION_TYPECAST_ERROR"}')) ELSE ARRAY() END |
137 | 143 | ),
|
138 | 144 | CASE WHEN (
|
139 |
| - "_airbyte_data"."_ab_cdc_deleted_at" is not null |
140 |
| - and "_ab_cdc_deleted_at" is null |
141 |
| - ) THEN ARRAY('Problem with `_ab_cdc_deleted_at`') ELSE ARRAY() END |
| 145 | + "_airbyte_meta" is not null |
| 146 | + and IS_OBJECT("_airbyte_meta") |
| 147 | + and "_airbyte_meta"."changes" is not null |
| 148 | + and IS_ARRAY("_airbyte_meta"."changes") |
| 149 | + ) THEN "_airbyte_meta"."changes" ELSE ARRAY() END |
142 | 150 | )
|
143 | 151 | ) as "_airbyte_meta"
|
144 | 152 | from "test_schema"."users_raw"
|
|
0 commit comments