Merge pull request #28603 from taosdata/enh/TD-32540
supporte disable encode and add test case
This commit is contained in:
commit
07f9690714
|
@ -363,6 +363,9 @@ int8_t validColEncode(uint8_t type, uint8_t l1) {
|
||||||
if (l1 == TSDB_COLVAL_ENCODE_NOCHANGE) {
|
if (l1 == TSDB_COLVAL_ENCODE_NOCHANGE) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
if (l1 == TSDB_COLVAL_ENCODE_DISABLED) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
if (type == TSDB_DATA_TYPE_BOOL) {
|
if (type == TSDB_DATA_TYPE_BOOL) {
|
||||||
return TSDB_COLVAL_ENCODE_RLE == l1 ? 1 : 0;
|
return TSDB_COLVAL_ENCODE_RLE == l1 ? 1 : 0;
|
||||||
} else if (type >= TSDB_DATA_TYPE_TINYINT && type <= TSDB_DATA_TYPE_INT) {
|
} else if (type >= TSDB_DATA_TYPE_TINYINT && type <= TSDB_DATA_TYPE_INT) {
|
||||||
|
|
|
@ -1633,8 +1633,7 @@ int32_t tsDecompressBigint(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int
|
||||||
} \
|
} \
|
||||||
} else if (l1 == L1_DISABLED && l2 != L2_DISABLED) { \
|
} else if (l1 == L1_DISABLED && l2 != L2_DISABLED) { \
|
||||||
if (compress) { \
|
if (compress) { \
|
||||||
uTrace("encode:%s, compress:%s, level:%d, type:%s", "disabled", compressL2Dict[l1].name, lvl, \
|
uTrace("encode:%s, compress:%s, level:%d, type:%s", "disabled", "disable", lvl, tDataTypes[type].name); \
|
||||||
tDataTypes[type].name); \
|
|
||||||
int8_t alvl = tsGetCompressL2Level(l2, lvl); \
|
int8_t alvl = tsGetCompressL2Level(l2, lvl); \
|
||||||
return compressL2Dict[l2].comprFn(pIn, nIn, pOut, nOut, type, alvl); \
|
return compressL2Dict[l2].comprFn(pIn, nIn, pOut, nOut, type, alvl); \
|
||||||
} else { \
|
} else { \
|
||||||
|
|
|
@ -0,0 +1,146 @@
|
||||||
|
system sh/stop_dnodes.sh
|
||||||
|
system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
sql connect
|
||||||
|
|
||||||
|
print ============================ dnode1 start
|
||||||
|
$i = 0
|
||||||
|
$dbPrefix = db
|
||||||
|
$tbPrefix = tb
|
||||||
|
$db = $dbPrefix . $i
|
||||||
|
$tb = $tbPrefix . $i
|
||||||
|
|
||||||
|
$N = 2000
|
||||||
|
|
||||||
|
print =============== step1
|
||||||
|
sql create database $db
|
||||||
|
sql use $db
|
||||||
|
sql create table $tb (ts timestamp, b bool encode 'disabled', t tinyint encode 'disabled', s smallint encode 'disabled', i int encode 'disabled', big bigint encode 'disabled', str binary(256))
|
||||||
|
|
||||||
|
$count = 0
|
||||||
|
while $count < $N
|
||||||
|
$ms = 1591200000000 + $count
|
||||||
|
sql insert into $tb values( $ms , 1, 0, $count , $count , $count ,'it is a string')
|
||||||
|
$count = $count + 1
|
||||||
|
endw
|
||||||
|
|
||||||
|
sql select * from $tb
|
||||||
|
if $rows != $N then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql flush database $db
|
||||||
|
|
||||||
|
sql select * from $tb
|
||||||
|
if $rows != $N then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql alter table $tb modify column ts encode 'disabled'
|
||||||
|
|
||||||
|
$count = 0
|
||||||
|
while $count < $N
|
||||||
|
$ms = 1591200030000 + $count
|
||||||
|
sql insert into $tb values( $ms , 1, 0, $count , $count , $count ,'it is a string')
|
||||||
|
$count = $count + 1
|
||||||
|
endw
|
||||||
|
|
||||||
|
$M = 4000
|
||||||
|
sql select * from $tb
|
||||||
|
if $rows != $M then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql flush database $db
|
||||||
|
|
||||||
|
sql select * from $tb
|
||||||
|
if $rows != $M then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
|
||||||
|
$stb1 = txx1
|
||||||
|
sql create table txx1 (ts timestamp encode 'disabled' compress 'disabled' level 'h', f int compress 'lz4') tags(t int)
|
||||||
|
|
||||||
|
$count = 0
|
||||||
|
$subTb1 = txx1_sub1
|
||||||
|
$subTb2 = txx1_sub2
|
||||||
|
|
||||||
|
sql create table $subTb1 using $stb1 tags(1)
|
||||||
|
sql create table $subTb2 using $stb1 tags(2)
|
||||||
|
|
||||||
|
while $count < $N
|
||||||
|
$ms = 1591200030000 + $count
|
||||||
|
sql insert into $subTb1 values( $ms , 1)
|
||||||
|
|
||||||
|
$ms2 = 1591200040000 + $count
|
||||||
|
sql insert into $subTb2 values( $ms2 , 1)
|
||||||
|
$count = $count + 1
|
||||||
|
endw
|
||||||
|
|
||||||
|
$count = 0
|
||||||
|
sql select * from $stb1
|
||||||
|
if $rows != $M then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql flush database $db
|
||||||
|
|
||||||
|
sql select * from $stb1
|
||||||
|
if $rows != $M then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
$L = 8000
|
||||||
|
sql alter table $stb1 modify column ts encode 'delta-i'
|
||||||
|
sql alter table $stb1 modify column f encode 'disabled'
|
||||||
|
|
||||||
|
while $count < $N
|
||||||
|
$ms = 1591200050000 + $count
|
||||||
|
sql insert into $subTb1 values( $ms , 1)
|
||||||
|
|
||||||
|
$ms2 = 1591200060000 + $count
|
||||||
|
sql insert into $subTb2 values( $ms2 , 1)
|
||||||
|
$count = $count + 1
|
||||||
|
endw
|
||||||
|
|
||||||
|
|
||||||
|
sql select * from $stb1
|
||||||
|
if $rows != $L then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql flush database $db
|
||||||
|
|
||||||
|
sql select * from $stb1
|
||||||
|
if $rows != $L then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql alter table $stb1 modify column ts encode 'disabled'
|
||||||
|
|
||||||
|
|
||||||
|
$count = 0
|
||||||
|
$I = 12000
|
||||||
|
while $count < $N
|
||||||
|
$ms = 1591200070000 + $count
|
||||||
|
sql insert into $subTb1 values( $ms , 1)
|
||||||
|
|
||||||
|
$ms2 = 1591200080000 + $count
|
||||||
|
sql insert into $subTb2 values( $ms2 , 1)
|
||||||
|
$count = $count + 1
|
||||||
|
endw
|
||||||
|
|
||||||
|
|
||||||
|
sql select * from $stb1
|
||||||
|
if $rows != $I then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql flush database $db
|
||||||
|
|
||||||
|
sql select * from $stb1
|
||||||
|
if $rows != $I then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
|
@ -325,6 +325,7 @@
|
||||||
./test.sh -f tsim/compress/compress.sim
|
./test.sh -f tsim/compress/compress.sim
|
||||||
./test.sh -f tsim/compress/compress_col.sim
|
./test.sh -f tsim/compress/compress_col.sim
|
||||||
./test.sh -f tsim/compress/uncompress.sim
|
./test.sh -f tsim/compress/uncompress.sim
|
||||||
|
./test.sh -f tsim/compress/compressDisable.sim
|
||||||
./test.sh -f tsim/compute/avg.sim
|
./test.sh -f tsim/compute/avg.sim
|
||||||
./test.sh -f tsim/compute/block_dist.sim
|
./test.sh -f tsim/compute/block_dist.sim
|
||||||
./test.sh -f tsim/compute/bottom.sim
|
./test.sh -f tsim/compute/bottom.sim
|
||||||
|
|
Loading…
Reference in New Issue