diff --git a/common_util/src/avro.rs b/common_util/src/avro.rs index a56585f8ca..db08513870 100644 --- a/common_util/src/avro.rs +++ b/common_util/src/avro.rs @@ -339,7 +339,7 @@ pub fn datum_to_avro_value(datum: Datum, is_nullable: bool) -> Value { Datum::String(v) => may_union(Value::String(v.to_string()), is_nullable), Datum::UInt64(v) => may_union(Value::Long(v as i64), is_nullable), Datum::Int64(v) => may_union(Value::Long(v), is_nullable), - Datum::UInt32(v) => may_union(Value::Int(v as i32), is_nullable), + Datum::UInt32(v) => may_union(Value::Long(v as i64), is_nullable), Datum::UInt16(v) => may_union(Value::Int(i32::from(v)), is_nullable), Datum::UInt8(v) => may_union(Value::Int(i32::from(v)), is_nullable), Datum::Int32(v) => may_union(Value::Int(v), is_nullable), @@ -364,12 +364,12 @@ fn avro_value_to_datum(value: Value, datum_type: DatumKind) -> Result { (Value::Boolean(v), DatumKind::Boolean) => Datum::Boolean(v), (Value::Long(v), DatumKind::Int64) => Datum::Int64(v), (Value::Long(v), DatumKind::UInt64) => Datum::UInt64(v as u64), + (Value::Long(v), DatumKind::UInt32) => Datum::UInt32(v as u32), (Value::Int(v), DatumKind::Int8) => Datum::Int8(v as i8), (Value::Int(v), DatumKind::UInt8) => Datum::UInt8(v as u8), (Value::Int(v), DatumKind::Int16) => Datum::Int16(v as i16), (Value::Int(v), DatumKind::UInt16) => Datum::UInt16(v as u16), (Value::Int(v), DatumKind::Int32) => Datum::Int32(v), - (Value::Int(v), DatumKind::UInt32) => Datum::UInt32(v as u32), (Value::Union(inner_val), _) => avro_value_to_datum(*inner_val, datum_type)?, (other_value, _) => { return UnsupportedConversion { diff --git a/integration_tests/cases/local/03_dml/insert_mode.result b/integration_tests/cases/local/03_dml/insert_mode.result index d0421c9e09..ecd3cf824d 100644 --- a/integration_tests/cases/local/03_dml/insert_mode.result +++ b/integration_tests/cases/local/03_dml/insert_mode.result @@ -195,5 +195,9 @@ FROM ORDER BY `c1` ASC; -Failed to execute query, err: Server(ServerError { code: 500, msg: "Failed to convert output, query: SELECT \n * \n FROM \n `03_dml_insert_mode_table4` \n ORDER BY \n `c1` ASC;. Caused by: Rpc error, code:500, message:failed to convert record batch, cause:Failed to write avro record, err:Value does not match schema." }) +tsid,timestamp,c1,c2,c3,c4,c5, +Int64(0),Timestamp(Timestamp(1)),Int64(10),String(StringBytes(b"123")),Int64(11),Int64(12),Int64(3), +Int64(0),Timestamp(Timestamp(2)),Int64(20),String(StringBytes(b"123")),Int64(21),Int64(22),Int64(4), +Int64(0),Timestamp(Timestamp(3)),Int64(30),String(StringBytes(b"123")),Int64(31),Int64(32),Int64(5), +