Skip to content

Commit

Permalink
fix varbinary type error
Browse files Browse the repository at this point in the history
  • Loading branch information
ZuLiangWang committed Feb 16, 2023
1 parent 8b73ed4 commit 5402635
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
2 changes: 1 addition & 1 deletion common_types/src/datum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ impl TryFrom<&SqlDataType> for DatumKind {
SqlDataType::Int(_) => Ok(Self::Int32),
SqlDataType::SmallInt(_) => Ok(Self::Int16),
SqlDataType::String => Ok(Self::String),
SqlDataType::Varbinary(_) => Ok(Self::Varbinary),
SqlDataType::Custom(objects, _) if objects.0.len() == 1 => {
match objects.0[0].value.as_str() {
"UINT64" | "uint64" => Ok(Self::UInt64),
Expand All @@ -223,7 +224,6 @@ impl TryFrom<&SqlDataType> for DatumKind {
"INT32" | "int32" => Ok(Self::Int32),
"INT16" | "int16" => Ok(Self::Int16),
"TINYINT" | "INT8" | "tinyint" | "int8" => Ok(Self::Int8),
"VARBINARY" | "varbinary" => Ok(Self::Varbinary),
_ => UnsupportedDataType {
sql_type: sql_type.clone(),
}
Expand Down
31 changes: 31 additions & 0 deletions integration_tests/cases/local/03_dml/issue-637.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
DROP TABLE IF EXISTS `issue637`;

affected_rows: 0

CREATE TABLE IF NOT EXISTS `issue637`
(
str_tag string TAG,
int_tag int32 TAG,
var_tag VARBINARY TAG,
str_field string,
int_field int32,
bin_field string,
t timestamp NOT NULL,
TIMESTAMP KEY (t)
) ENGINE=Analytic with(enable_ttl = 'false');

affected_rows: 0

INSERT INTO issue637
(`str_tag`,`int_tag`,`var_tag`,`str_field`,`int_field`,`bin_field`,`t`)
VALUES
("t1",1,"v1","s1",1,"b1",1651737067000);

affected_rows: 1

select * from `issue637`;

tsid,t,str_tag,int_tag,var_tag,str_field,int_field,bin_field,
UInt64(15527369105987057363),Timestamp(1651737067000),String("t1"),Int32(1),Varbinary([118, 49]),String("s1"),Int32(1),String("b1"),


22 changes: 22 additions & 0 deletions integration_tests/cases/local/03_dml/issue-637.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
DROP TABLE IF EXISTS `issue637`;

CREATE TABLE IF NOT EXISTS `issue637`
(
str_tag string TAG,
int_tag int32 TAG,
var_tag VARBINARY TAG,
str_field string,
int_field int32,
bin_field string,
t timestamp NOT NULL,
TIMESTAMP KEY (t)
) ENGINE=Analytic with(enable_ttl = 'false');


INSERT INTO issue637
(`str_tag`,`int_tag`,`var_tag`,`str_field`,`int_field`,`bin_field`,`t`)
VALUES
("t1",1,"v1","s1",1,"b1",1651737067000);

select * from `issue637`;

0 comments on commit 5402635

Please sign in to comment.