Commit ab2bbdd
authored
Make sure that column types are not inferred to VARCHAR (#1006)
The `UNION BY NAME` approach introduced as a fix for issue #977 led to
the problem that if one of the files contained only empty values for an
optional column, that column would be inferred to be of type `VARCHAR`
by DuckDB.
The solution is to create the empty table with strict types based on
the data contract and then insert the data into the table in a separate
step, taking only into account those columns that exist in both the data
contract and the data, which might be missing newly introduced columns
or still have columns that have been removed from the contract by now.1 parent 585ee42 commit ab2bbdd
File tree
3 files changed
+16
-17
lines changed- datacontract/engines/soda/connections
- tests
- fixtures/schema-evolution
3 files changed
+16
-17
lines changedLines changed: 13 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
90 | 96 | | |
91 | 97 | | |
92 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
24 | | - | |
25 | 23 | | |
26 | 24 | | |
27 | 25 | | |
| |||
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
35 | | - | |
36 | 33 | | |
37 | 34 | | |
38 | 35 | | |
| |||
43 | 40 | | |
44 | 41 | | |
45 | 42 | | |
46 | | - | |
47 | 43 | | |
48 | 44 | | |
49 | 45 | | |
| |||
55 | 51 | | |
56 | 52 | | |
57 | 53 | | |
58 | | - | |
59 | 54 | | |
60 | 55 | | |
61 | 56 | | |
| |||
70 | 65 | | |
71 | 66 | | |
72 | 67 | | |
73 | | - | |
74 | 68 | | |
75 | 69 | | |
76 | 70 | | |
| |||
82 | 76 | | |
83 | 77 | | |
84 | 78 | | |
85 | | - | |
86 | 79 | | |
87 | 80 | | |
88 | 81 | | |
| |||
93 | 86 | | |
94 | 87 | | |
95 | 88 | | |
96 | | - | |
97 | 89 | | |
98 | 90 | | |
99 | 91 | | |
| |||
104 | 96 | | |
105 | 97 | | |
106 | 98 | | |
107 | | - | |
108 | 99 | | |
109 | 100 | | |
110 | 101 | | |
| |||
116 | 107 | | |
117 | 108 | | |
118 | 109 | | |
119 | | - | |
120 | 110 | | |
0 commit comments