This commit is contained in:
RogerYK 2022-01-28 11:20:34 +08:00
parent 887eeddeb6
commit 102f6f66a7
6 changed files with 134 additions and 128 deletions

View File

@ -2,26 +2,11 @@ bcdef
bcdef
bcdef
bcdef
bcdef
bcdef
g
g
g
-
bcdef
bcdef
bcdef
bcdef
bcdef
g
g
g
-
bcdef
23456
@ -31,15 +16,6 @@ bcdef
2345
bcdef
345
-
6
-
bcdef
23456
@ -49,12 +25,3 @@ bcdef
2345
bcdef
345
-
6

View File

@ -2,115 +2,35 @@ select substring('abcdefgh', 2, -2);
select substring('abcdefgh', materialize(2), -2);
select substring('abcdefgh', 2, materialize(-2));
select substring('abcdefgh', materialize(2), materialize(-2));
select substring(materialize('abcdefgh'), 2, -2);
select substring(materialize('abcdefgh'), materialize(2), materialize(-2));
select substring('abcdefgh', -2, -2);
select substring(materialize('abcdefgh'), -2, -2);
select substring(materialize('abcdefgh'), materialize(-2), materialize(-2));
select substring('abcdefgh', -2, -1);
select substring(materialize('abcdefgh'), -2, -1);
select substring(materialize('abcdefgh'), materialize(-2), materialize(-1));
select '-';
select substring(cast('abcdefgh' as FixedString(8)), 2, -2);
select substring(cast('abcdefgh' as FixedString(8)), materialize(2), -2);
select substring(cast('abcdefgh' as FixedString(8)), 2, materialize(-2));
select substring(materialize(cast('abcdefgh' as FixedString(8))), 2, -2);
select substring(cast('abcdefgh' as FixedString(8)), materialize(2), materialize(-2));
select substring(cast('abcdefgh' as FixedString(8)), -2, -2);
select substring(materialize(cast('abcdefgh' as FixedString(8))), -2, -2);
select substring(materialize(cast('abcdefgh' as FixedString(8))), materialize(-2), materialize(-2));
select '-';
select substring(cast('abcdefgh' as FixedString(8)), -2, -1);
select substring(materialize(cast('abcdefgh' as FixedString(8))), -2, -1);
select substring(materialize(cast('abcdefgh' as FixedString(8))), materialize(-2), materialize(-1));
drop table if exists t;
create table t (s String, l Int8, r Int8) engine = Memory;
insert into t values ('abcdefgh', 2, -2), ('12345678', 3, -3);
select substring(s, 2, -2) from t;
select substring(s, l, -2) from t;
select substring(s, 2, r) from t;
select substring(s, l, r) from t;
select '-';
drop table if exists t;
create table t
(
s String,
l Int8,
r Int8
) engine = Memory;
insert into t(s, l, r)
values ('abcdefgh', 2, -2),('12345678', 3, -3);
create table t (s FixedString(8), l Int8, r Int8) engine = Memory;
insert into t values ('abcdefgh', 2, -2), ('12345678', 3, -3);
select substring(s, 2, -2)
from t;
select substring(s, l, -2)
from t;
select substring(s, 2, r)
from t;
select substring(s, l, r)
from t;
select '-';
select substring(s, 2, -2) from t;
select substring(s, l, -2) from t;
select substring(s, 2, r) from t;
select substring(s, l, r) from t;
drop table if exists t;
create table t
(
s String,
l Int8,
r Int8
) engine = Memory;
insert into t
values ('abcdefgh', -2, -2),('12345678', -3, -3);
select substring(s, -2, -2)
from t;
select substring(s, l, -2)
from t;
select substring(s, -2, r)
from t;
select substring(s, l, r)
from t;
select '-';
drop table if exists t;
create table t
(
s FixedString(8),
l Int8,
r Int8
) engine = Memory;
insert into t
values ('abcdefgh', 2, -2),('12345678', 3, -3);
select substring(s, 2, -2)
from t;
select substring(s, l, -2)
from t;
select substring(s, 2, r)
from t;
select substring(s, l, r)
from t;
select '-';
drop table if exists t;
create table t
(
s FixedString(8),
l Int8,
r Int8
) engine = Memory;
insert into t
values ('abcdefgh', -2, -2),('12345678', -3, -3);
select substring(s, -2, -2)
from t;
select substring(s, l, -2)
from t;
select substring(s, -2, r)
from t;
select substring(s, l, r)
from t;
drop table if exists t;

View File

@ -0,0 +1,15 @@
[]
[]
[]
[7]
[7]
[7]
-
[]
[]
[]
[6]
[]
[]
[]
[]

View File

@ -0,0 +1,25 @@
select arraySlice([1, 2, 3, 4, 5, 6, 7, 8], -2, -2);
select arraySlice(materialize([1, 2, 3, 4, 5, 6, 7, 8]), -2, -2);
select arraySlice(materialize([1, 2, 3, 4, 5, 6, 7, 8]), materialize(-2), materialize(-2));
select arraySlice([1, 2, 3, 4, 5, 6, 7, 8], -2, -1);
select arraySlice(materialize([1, 2, 3, 4, 5, 6, 7, 8]), -2, -1);
select arraySlice(materialize([1, 2, 3, 4, 5, 6, 7, 8]), materialize(-2), materialize(-1));
select '-';
drop table if exists t;
create table t
(
s Array(Int),
l Int8,
r Int8
) engine = Memory;
insert into t values ([1, 2, 3, 4, 5, 6, 7, 8], -2, -2),([1, 2, 3, 4, 5, 6, 7, 8], -3, -3);
select arraySlice(s, -2, -2) from t;
select arraySlice(s, l, -2) from t;
select arraySlice(s, -2, r) from t;
select arraySlice(s, l, r) from t;
drop table if exists t;

View File

@ -0,0 +1,31 @@
g
g
g
-
g
g
g
-
6
-
6

View File

@ -0,0 +1,48 @@
select substring('abcdefgh', -2, -2);
select substring(materialize('abcdefgh'), -2, -2);
select substring(materialize('abcdefgh'), materialize(-2), materialize(-2));
select substring('abcdefgh', -2, -1);
select substring(materialize('abcdefgh'), -2, -1);
select substring(materialize('abcdefgh'), materialize(-2), materialize(-1));
select '-';
select substring(cast('abcdefgh' as FixedString(8)), -2, -2);
select substring(materialize(cast('abcdefgh' as FixedString(8))), -2, -2);
select substring(materialize(cast('abcdefgh' as FixedString(8))), materialize(-2), materialize(-2));
select substring(cast('abcdefgh' as FixedString(8)), -2, -1);
select substring(materialize(cast('abcdefgh' as FixedString(8))), -2, -1);
select substring(materialize(cast('abcdefgh' as FixedString(8))), materialize(-2), materialize(-1));
select '-';
drop table if exists t;
create table t
(
s String,
l Int8,
r Int8
) engine = Memory;
insert into t values ('abcdefgh', -2, -2),('12345678', -3, -3);
select substring(s, -2, -2) from t;
select substring(s, l, -2) from t;
select substring(s, -2, r) from t;
select substring(s, l, r) from t;
select '-';
drop table if exists t;
create table t(
s FixedString(8),
l Int8,
r Int8
) engine = Memory;
insert into t values ('abcdefgh', -2, -2),('12345678', -3, -3);
select substring(s, -2, -2) from t;
select substring(s, l, -2) from t;
select substring(s, -2, r) from t;
select substring(s, l, r) from t;
drop table if exists t;