File tree Expand file tree Collapse file tree 2 files changed +3
-10
lines changed
tests/integration_tests/avro_basic/data Expand file tree Collapse file tree 2 files changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -558,15 +558,7 @@ func (a *BatchEncoder) columns2AvroSchema(
558
558
// the string literal "null" must be coerced to a `nil`
559
559
// see https://github.com/linkedin/goavro/blob/5ec5a5ee7ec82e16e6e2b438d610e1cab2588393/record.go#L109-L114
560
560
// https://stackoverflow.com/questions/22938124/avro-field-default-values
561
- defaultFirst := false
562
- if defaultValue == nil {
563
- defaultFirst = true
564
- } else if s , ok := defaultValue .(string ); ok && s == "null" {
565
- defaultFirst = true
566
- } else if b , ok := defaultValue .([]byte ); ok && string (b ) == "null" {
567
- defaultFirst = true
568
- }
569
- if defaultFirst {
561
+ if defaultValue == nil || defaultValue == "null" {
570
562
field ["type" ] = []interface {}{"null" , avroType }
571
563
} else {
572
564
field ["type" ] = []interface {}{avroType , "null" }
Original file line number Diff line number Diff line change @@ -168,7 +168,8 @@ create table t1(
168
168
id int primary key ,
169
169
c1 varchar (255 ) default " null" ,
170
170
c2 varchar (255 ) default " NULL" ,
171
- c3 varchar (255 ) default null
171
+ c3 varchar (255 ) default null ,
172
+ c4 varbinary(100 ) DEFAULT b' 01101110011101010110110001101100'
172
173
);
173
174
174
175
insert into t1(id) values (1 );
You can’t perform that action at this time.
0 commit comments