Skip to content

Commit

Permalink
add testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
jiacai2050 committed Dec 2, 2022
1 parent 52633cf commit dd7e455
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sql/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl ToString for TableName {
self.0
.0
.iter()
.map(|ident| Self::normalize_ident(ident))
.map(Self::normalize_ident)
.collect::<Vec<_>>()
.join(".")
}
Expand Down
69 changes: 69 additions & 0 deletions tests/cases/local/03_dml/case_insensitive.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
DROP TABLE IF EXISTS case_insensitive_table1;

affected_rows: 0

CREATE TABLE case_insensitive_table1 (
ts timestamp NOT NULL,
value1 double,
timestamp KEY (ts)) ENGINE=Analytic
WITH(
enable_ttl='false'
);

affected_rows: 0

INSERT INTO case_insensitive_table1 (ts, value1)
VALUES (1, 10), (2, 20), (3, 30);

affected_rows: 3

SELECT
*
FROM
case_insensitive_table1;

ts,tsid,value1,
Timestamp(Timestamp(1)),Int64(0),Double(10.0),
Timestamp(Timestamp(2)),Int64(0),Double(20.0),
Timestamp(Timestamp(3)),Int64(0),Double(30.0),


SELECT
*
FROM
CASE_INSENSITIVE_TABLE1;

ts,tsid,value1,
Timestamp(Timestamp(1)),Int64(0),Double(10.0),
Timestamp(Timestamp(2)),Int64(0),Double(20.0),
Timestamp(Timestamp(3)),Int64(0),Double(30.0),


SHOW CREATE TABLE case_insensitive_table1;

Table,Create Table,
String(StringBytes(b"case_insensitive_table1")),String(StringBytes(b"CREATE TABLE `case_insensitive_table1` (`ts` timestamp NOT NULL, `tsid` uint64 NOT NULL, `value1` double, PRIMARY KEY(ts,tsid), TIMESTAMP KEY(ts)) ENGINE=Analytic WITH(arena_block_size='2097152', compaction_strategy='default', compression='ZSTD', enable_ttl='false', num_rows_per_row_group='8192', segment_duration='', storage_format='COLUMNAR', ttl='7d', update_mode='OVERWRITE', write_buffer_size='33554432')")),


SHOW CREATE TABLE CASE_INSENSITIVE_TABLE1;

Table,Create Table,
String(StringBytes(b"case_insensitive_table1")),String(StringBytes(b"CREATE TABLE `case_insensitive_table1` (`ts` timestamp NOT NULL, `tsid` uint64 NOT NULL, `value1` double, PRIMARY KEY(ts,tsid), TIMESTAMP KEY(ts)) ENGINE=Analytic WITH(arena_block_size='2097152', compaction_strategy='default', compression='ZSTD', enable_ttl='false', num_rows_per_row_group='8192', segment_duration='', storage_format='COLUMNAR', ttl='7d', update_mode='OVERWRITE', write_buffer_size='33554432')")),


DESC case_insensitive_table1;

name,type,is_primary,is_nullable,is_tag,
String(StringBytes(b"ts")),String(StringBytes(b"timestamp")),Boolean(true),Boolean(false),Boolean(false),
String(StringBytes(b"tsid")),String(StringBytes(b"uint64")),Boolean(true),Boolean(false),Boolean(false),
String(StringBytes(b"value1")),String(StringBytes(b"double")),Boolean(false),Boolean(true),Boolean(false),


DESC CASE_INSENSITIVE_TABLE1;

name,type,is_primary,is_nullable,is_tag,
String(StringBytes(b"ts")),String(StringBytes(b"timestamp")),Boolean(true),Boolean(false),Boolean(false),
String(StringBytes(b"tsid")),String(StringBytes(b"uint64")),Boolean(true),Boolean(false),Boolean(false),
String(StringBytes(b"value1")),String(StringBytes(b"double")),Boolean(false),Boolean(true),Boolean(false),


34 changes: 34 additions & 0 deletions tests/cases/local/03_dml/case_insensitive.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

DROP TABLE IF EXISTS case_insensitive_table1;


CREATE TABLE case_insensitive_table1 (
ts timestamp NOT NULL,
value1 double,
timestamp KEY (ts)) ENGINE=Analytic
WITH(
enable_ttl='false'
);

INSERT INTO case_insensitive_table1 (ts, value1)
VALUES (1, 10), (2, 20), (3, 30);


SELECT
*
FROM
case_insensitive_table1;

SELECT
*
FROM
CASE_INSENSITIVE_TABLE1;


SHOW CREATE TABLE case_insensitive_table1;

SHOW CREATE TABLE CASE_INSENSITIVE_TABLE1;

DESC case_insensitive_table1;

DESC CASE_INSENSITIVE_TABLE1;

0 comments on commit dd7e455

Please sign in to comment.