@@ -761,10 +761,10 @@ public void testTreeViewTable() throws Exception {
761761 try (final Connection connection = EnvFactory .getEnv ().getConnection ();
762762 final Statement statement = connection .createStatement ()) {
763763 statement .execute ("create database root.another" );
764- statement .execute ("create database root.`重庆`.b" );
765- statement .execute ("create timeSeries root.`重庆`.b.c .S1 int32" );
766- statement .execute ("create timeSeries root.`重庆`.b.c .s2 string" );
767- statement .execute ("create timeSeries root.`重庆`.b.S1 int32" );
764+ statement .execute ("create database root.`重庆`.`1`. b" );
765+ statement .execute ("create timeSeries root.`重庆`.`1`.b.`2` .S1 int32" );
766+ statement .execute ("create timeSeries root.`重庆`.`1`.b.`2` .s2 string" );
767+ statement .execute ("create timeSeries root.`重庆`.`1`. b.S1 int32" );
768768 } catch (SQLException e ) {
769769 fail (e .getMessage ());
770770 }
@@ -783,13 +783,13 @@ public void testTreeViewTable() throws Exception {
783783 "701: Cannot specify view pattern to match more than one tree database." ,
784784 e .getMessage ());
785785 }
786- statement .execute ("create view tree_table (tag1 tag, tag2 tag) as root.\" 重庆\" .**" );
786+ statement .execute ("create view tree_table (tag1 tag, tag2 tag) as root.\" 重庆\" .\" 1 \" . **" );
787787 statement .execute ("drop view tree_table" );
788788 }
789789
790790 try (final Connection connection = EnvFactory .getEnv ().getConnection ();
791791 final Statement statement = connection .createStatement ()) {
792- statement .execute ("create timeSeries root.`重庆`.b.d .s1 int32" );
792+ statement .execute ("create timeSeries root.`重庆`.`1`.b.`1` .s1 int32" );
793793 } catch (SQLException e ) {
794794 fail (e .getMessage ());
795795 }
@@ -800,7 +800,7 @@ public void testTreeViewTable() throws Exception {
800800 statement .execute ("use tree_view_db" );
801801
802802 try {
803- statement .execute ("create view tree_table (tag1 tag, tag2 tag) as root.\" 重庆\" .**" );
803+ statement .execute ("create view tree_table (tag1 tag, tag2 tag) as root.\" 重庆\" .\" 1 \" . **" );
804804 fail ();
805805 } catch (final SQLException e ) {
806806 final Set <String > result =
@@ -814,13 +814,13 @@ public void testTreeViewTable() throws Exception {
814814
815815 try (final Connection connection = EnvFactory .getEnv ().getConnection ();
816816 final Statement statement = connection .createStatement ()) {
817- statement .execute ("drop timeSeries root.`重庆`.b.d .s1" );
817+ statement .execute ("drop timeSeries root.`重庆`.`1`.b.`1` .s1" );
818818 statement .execute ("create device template t1 (S1 boolean, s9 int32)" );
819- statement .execute ("set schema template t1 to root.`重庆`.b.d " );
820- statement .execute ("create timeSeries root.`重庆`.b.c .f.g.h.S1 int32" );
819+ statement .execute ("set schema template t1 to root.`重庆`.`1`.b.`1` " );
820+ statement .execute ("create timeSeries root.`重庆`.`1`.b.`2` .f.g.h.S1 int32" );
821821
822822 // Put schema cache
823- statement .execute ("select S1, s2 from root.`重庆`.b.c " );
823+ statement .execute ("select S1, s2 from root.`重庆`.`1`.b.`2` " );
824824 } catch (SQLException e ) {
825825 fail (e .getMessage ());
826826 }
@@ -831,7 +831,7 @@ public void testTreeViewTable() throws Exception {
831831 statement .execute ("use tree_view_db" );
832832
833833 try {
834- statement .execute ("create view tree_table (tag1 tag, tag2 tag) as root.\" 重庆\" .**" );
834+ statement .execute ("create view tree_table (tag1 tag, tag2 tag) as root.\" 重庆\" .\" 1 \" . **" );
835835 fail ();
836836 } catch (final SQLException e ) {
837837 assertEquals (
@@ -841,7 +841,7 @@ public void testTreeViewTable() throws Exception {
841841
842842 try {
843843 statement .execute (
844- "create view tree_table (tag1 tag, tag2 tag, S1 field) as root.\" 重庆\" .**" );
844+ "create view tree_table (tag1 tag, tag2 tag, S1 field) as root.\" 重庆\" .\" 1 \" . **" );
845845 fail ();
846846 } catch (final SQLException e ) {
847847 assertEquals (
@@ -852,7 +852,7 @@ public void testTreeViewTable() throws Exception {
852852
853853 try (final Connection connection = EnvFactory .getEnv ().getConnection ();
854854 final Statement statement = connection .createStatement ()) {
855- statement .execute ("create timeSeries root.`重庆`.b.e.s1 int32" );
855+ statement .execute ("create timeSeries root.`重庆`.`1`. b.e.s1 int32" );
856856 } catch (SQLException e ) {
857857 fail (e .getMessage ());
858858 }
@@ -873,7 +873,7 @@ public void testTreeViewTable() throws Exception {
873873 // Temporary
874874 try {
875875 statement .execute (
876- "create or replace view tree_table (tag1 tag, tag2 tag, S1 int32 field, s3 boolean from S1) as root.\" 重庆\" .**" );
876+ "create or replace view tree_table (tag1 tag, tag2 tag, S1 int32 field, s3 boolean from S1) as root.\" 重庆\" .\" 1 \" . **" );
877877 fail ();
878878 } catch (final SQLException e ) {
879879 assertEquals (
@@ -882,14 +882,14 @@ public void testTreeViewTable() throws Exception {
882882
883883 try {
884884 statement .execute (
885- "create or replace view tree_table (tag1 tag, tag2 tag, S1 int32 field, s3 from s2, s8 field) as root.\" 重庆\" .**" );
885+ "create or replace view tree_table (tag1 tag, tag2 tag, S1 int32 field, s3 from s2, s8 field) as root.\" 重庆\" .\" 1 \" . **" );
886886 fail ();
887887 } catch (final SQLException e ) {
888888 assertEquals ("528: Measurements not found for s8, cannot auto detect" , e .getMessage ());
889889 }
890890
891891 statement .execute (
892- "create or replace view tree_table (tag1 tag, tag2 tag, S1 int32 field, s3 from s2) as root.\" 重庆\" .**" );
892+ "create or replace view tree_table (tag1 tag, tag2 tag, S1 int32 field, s3 from s2) as root.\" 重庆\" .\" 1 \" . **" );
893893
894894 // Cannot be written
895895 try {
@@ -937,11 +937,15 @@ public void testTreeViewTable() throws Exception {
937937 TestUtils .assertResultSetEqual (
938938 statement .executeQuery ("show devices from view_table where tag1 = 'b'" ),
939939 "tag1,tag2," ,
940- new HashSet <>(Arrays .asList ("b,c ," , "b,null," , "b,e," )));
940+ new HashSet <>(Arrays .asList ("b,`2` ," , "b,null," , "b,e," )));
941941 TestUtils .assertResultSetEqual (
942942 statement .executeQuery ("show devices from view_table where tag1 = 'b' and tag2 is null" ),
943943 "tag1,tag2," ,
944944 Collections .singleton ("b,null," ));
945+ TestUtils .assertResultSetEqual (
946+ statement .executeQuery ("show devices from view_table where tag1 = 'b' and tag2 = '`2`'" ),
947+ "tag1,tag2," ,
948+ Collections .singleton ("b,`2`," ));
945949 TestUtils .assertResultSetEqual (
946950 statement .executeQuery ("count devices from view_table" ),
947951 "count(devices)," ,
@@ -953,7 +957,7 @@ public void testTreeViewTable() throws Exception {
953957 final Statement statement = connection .createStatement ()) {
954958 // Test create & replace + restrict
955959 statement .execute (
956- "create or replace view tree_view_db.view_table (tag1 tag, tag2 tag, s11 int32 field, s3 from s2) restrict with (ttl=100) as root.`重庆`.**" );
960+ "create or replace view tree_view_db.view_table (tag1 tag, tag2 tag, s11 int32 field, s3 from s2) restrict with (ttl=100) as root.`重庆`.`1`. **" );
957961 fail ();
958962 } catch (final SQLException e ) {
959963 assertTrue (
@@ -974,7 +978,7 @@ public void testTreeViewTable() throws Exception {
974978 .getConnection ("testUser" , "testUser123456" , BaseEnv .TABLE_SQL_DIALECT );
975979 final Statement statement = connection .createStatement ()) {
976980 statement .execute (
977- "create or replace view tree_view_db.view_table (tag1 tag, tag2 tag, s11 int32 field, s3 from s2) restrict with (ttl=100) as root.\" 重庆\" .**" );
981+ "create or replace view tree_view_db.view_table (tag1 tag, tag2 tag, s11 int32 field, s3 from s2) restrict with (ttl=100) as root.\" 重庆\" .\" 1 \" . **" );
978982 fail ();
979983 } catch (final SQLException e ) {
980984 assertEquals (
@@ -995,7 +999,7 @@ public void testTreeViewTable() throws Exception {
995999 .getConnection ("testUser" , "testUser123456" , BaseEnv .TABLE_SQL_DIALECT );
9961000 final Statement statement = connection .createStatement ()) {
9971001 statement .execute (
998- "create or replace view tree_view_db.view_table (tag1 tag, tag2 tag, s11 int32 field, s3 from s2) restrict with (ttl=100) as root.\" 重庆\" .**" );
1002+ "create or replace view tree_view_db.view_table (tag1 tag, tag2 tag, s11 int32 field, s3 from s2) restrict with (ttl=100) as root.\" 重庆\" .\" 1 \" . **" );
9991003 fail ();
10001004 } catch (final SQLException e ) {
10011005 assertEquals (
@@ -1015,7 +1019,7 @@ public void testTreeViewTable() throws Exception {
10151019 .getConnection ("testUser" , "testUser123456" , BaseEnv .TABLE_SQL_DIALECT );
10161020 final Statement statement = connection .createStatement ()) {
10171021 statement .execute (
1018- "create or replace view tree_view_db.view_table (tag1 tag, tag2 tag, s11 int32 field, s3 from s2) restrict with (ttl=100) as root.\" 重庆\" .**" );
1022+ "create or replace view tree_view_db.view_table (tag1 tag, tag2 tag, s11 int32 field, s3 from s2) restrict with (ttl=100) as root.\" 重庆\" .\" 1 \" . **" );
10191023 fail ();
10201024 } catch (final SQLException e ) {
10211025 assertEquals (
@@ -1035,7 +1039,7 @@ public void testTreeViewTable() throws Exception {
10351039 .getConnection ("testUser" , "testUser123456" , BaseEnv .TABLE_SQL_DIALECT );
10361040 final Statement statement = connection .createStatement ()) {
10371041 statement .execute (
1038- "create or replace view tree_view_db.view_table (tag1 tag, tag2 tag, s11 int32 field, s3 from s2) restrict with (ttl=100) as root.\" 重庆\" .**" );
1042+ "create or replace view tree_view_db.view_table (tag1 tag, tag2 tag, s11 int32 field, s3 from s2) restrict with (ttl=100) as root.\" 重庆\" .\" 1 \" . **" );
10391043 } catch (final SQLException e ) {
10401044 fail ();
10411045 }
@@ -1054,14 +1058,14 @@ public void testTreeViewTable() throws Exception {
10541058 statement .executeQuery ("show create view view_table" ),
10551059 "View,Create View," ,
10561060 Collections .singleton (
1057- "view_table,CREATE VIEW \" view_table\" (\" tag1\" STRING TAG,\" tag2\" STRING TAG,\" s11\" INT32 FIELD,\" s3\" STRING FIELD FROM \" s2\" ) RESTRICT WITH (ttl=100) AS root.\" 重庆\" .**," ));
1061+ "view_table,CREATE VIEW \" view_table\" (\" tag1\" STRING TAG,\" tag2\" STRING TAG,\" s11\" INT32 FIELD,\" s3\" STRING FIELD FROM \" s2\" ) RESTRICT WITH (ttl=100) AS root.\" 重庆\" .\" 1 \" . **," ));
10581062
10591063 // Can also use "show create table"
10601064 TestUtils .assertResultSetEqual (
10611065 statement .executeQuery ("show create table view_table" ),
10621066 "View,Create View," ,
10631067 Collections .singleton (
1064- "view_table,CREATE VIEW \" view_table\" (\" tag1\" STRING TAG,\" tag2\" STRING TAG,\" s11\" INT32 FIELD,\" s3\" STRING FIELD FROM \" s2\" ) RESTRICT WITH (ttl=100) AS root.\" 重庆\" .**," ));
1068+ "view_table,CREATE VIEW \" view_table\" (\" tag1\" STRING TAG,\" tag2\" STRING TAG,\" s11\" INT32 FIELD,\" s3\" STRING FIELD FROM \" s2\" ) RESTRICT WITH (ttl=100) AS root.\" 重庆\" .\" 1 \" . **," ));
10651069
10661070 statement .execute ("create table a ()" );
10671071 try {
0 commit comments