Skip to content

Commit

Permalink
fix: fix integration test's bad case (#527)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rachelint authored Dec 30, 2022
1 parent 611792b commit 5819fa5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions common_util/src/avro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -364,12 +364,12 @@ fn avro_value_to_datum(value: Value, datum_type: DatumKind) -> Result<Datum> {
(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 {
Expand Down
6 changes: 5 additions & 1 deletion integration_tests/cases/local/03_dml/insert_mode.result
Original file line number Diff line number Diff line change
Expand Up @@ -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),


0 comments on commit 5819fa5

Please sign in to comment.