function_histogram.py 59.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
###################################################################
#           Copyright (c) 2021 by TAOS Technologies, Inc.
#                     All rights reserved.
#
#  This file is proprietary and confidential to TAOS Technologies.
#  No part of this file may be reproduced, stored, transmitted,
#  disclosed or used in any form or by any means other than as
#  expressly provided by the written permission from Jianhui Tao
#
###################################################################

# -*- coding: utf-8 -*-

import sys
from util.log import *
from util.cases import *
from util.sql import *


class TDTestCase:
    def caseDescription(self):
        '''
        case1<Ganlin Zhao>: [TD-11222]<feature>: Histogram function
        '''
        return

    def init(self, conn, logSql):
        tdLog.debug("start to execute %s" % __file__)
        tdSql.init(conn.cursor(), logSql)

    def getBuildPath(self):
        selfPath = os.path.dirname(os.path.realpath(__file__))

        if ("community" in selfPath):
            projPath = selfPath[:selfPath.find("community")]
        else:
            projPath = selfPath[:selfPath.find("tests")]

        for root, dirs, files in os.walk(projPath):
            if ("taosd" in files):
                rootRealPath = os.path.dirname(os.path.realpath(root))
                if ("packaging" not in rootRealPath):
                    buildPath = root[:len(root) - len("/build/bin")]
                    break
        return buildPath

    def run(self):
        print("running {}".format(__file__))
        tdSql.execute("drop database if exists db")
        tdSql.execute("create database if not exists db")
        tdSql.execute('use db')

        #Prepare data
        tdSql.execute("create stable stb (col_timestamp timestamp, col_tinyint tinyint, col_smallint smallint, col_int int, col_bigint bigint, col_float float, col_double double, col_bool bool, col_binary binary(10), col_nchar nchar(10)) \
                       tags(tag_timestamp timestamp, tag_tinyint tinyint, tag_smallint smallint, tag_int int, tag_bigint bigint, tag_float float, tag_double double, tag_bool bool, tag_binary binary(10), tag_nchar nchar(10));")
        tdSql.execute("create table ctb using stb tags (now, 1, 1, 1, 1, 1.0, 1.0, true, 'abc', 'abc');")
        tdSql.execute("create table tb (col_timestamp timestamp, col_tinyint tinyint, col_smallint smallint, col_int int, col_bigint bigint, col_float float, col_double double, col_bool bool, col_binary binary(10), col_nchar nchar(10));")

        tdSql.execute("insert into ctb values (now, -9, -9, -9, -9, -9.5, -9.5, true, 'abc', 'abc');")
60 61 62 63 64 65 66 67 68 69 70 71 72 73
        tdSql.execute("insert into ctb values (now + 1s, -1, -1, -1, -1, -1.5, -1.5, true, 'abc', 'abc');")
        tdSql.execute("insert into ctb values (now + 2s, 1, 1, 1, 1, 1.5, 1.5, true, 'abc', 'abc');")
        tdSql.execute("insert into ctb values (now + 3s, 2, 2, 2, 2, 2.5, 2.5, true, 'abc', 'abc');")
        tdSql.execute("insert into ctb values (now + 4s, 3, 3, 3, 3, 3.5, 3.5, true, 'abc', 'abc');")
        tdSql.execute("insert into ctb values (now + 5s, 4, 4, 4, 4, 4.5, 4.5, true, 'abc', 'abc');")
        tdSql.execute("insert into ctb values (now + 6s, 5, 5, 5, 5, 5.5, 5.5, true, 'abc', 'abc');")
        tdSql.execute("insert into ctb values (now + 7s, 6, 6, 6, 6, 6.5, 6.5, true, 'abc', 'abc');")
        tdSql.execute("insert into ctb values (now + 8s, 7, 7, 7, 7, 7.5, 7.5, false, 'abc', 'abc');")
        tdSql.execute("insert into ctb values (now + 9s, 8, 8, 8, 8, 8.5, 8.5, false, 'abc', 'abc');")
        tdSql.execute("insert into ctb values (now + 10s, 9, 9, 9, 9, 9.5, 9.5, false, 'abc', 'abc');")
        tdSql.execute("insert into ctb values (now + 11s, 10, 10, 10, 10, 10.5, 10.5, false, 'abc', 'abc');")
        tdSql.execute("insert into ctb values (now + 12s, 15, 15, 15, 15, 15.5, 15.5, false, 'abc', 'abc');")
        tdSql.execute("insert into ctb values (now + 13s, 20, 20, 20, 20, 20.5, 20.5, false, 'abc', 'abc');")
        tdSql.execute("insert into ctb values (now + 14s, 99, 99, 99, 99, 99.5, 99.5, false, 'abc', 'abc');")
74 75

        tdSql.execute("insert into tb values (now, -9, -9, -9, -9, -9.5, -9.5, true, 'abc', 'abc');")
76 77 78 79 80 81 82 83 84 85 86 87 88 89
        tdSql.execute("insert into tb values (now + 1s, -1, -1, -1, -1, -1.5, -1.5, true, 'abc', 'abc');")
        tdSql.execute("insert into tb values (now + 2s, 1, 1, 1, 1, 1.5, 1.5, true, 'abc', 'abc');")
        tdSql.execute("insert into tb values (now + 3s, 2, 2, 2, 2, 2.5, 2.5, true, 'abc', 'abc');")
        tdSql.execute("insert into tb values (now + 4s, 3, 3, 3, 3, 3.5, 3.5, true, 'abc', 'abc');")
        tdSql.execute("insert into tb values (now + 5s, 4, 4, 4, 4, 4.5, 4.5, true, 'abc', 'abc');")
        tdSql.execute("insert into tb values (now + 6s, 5, 5, 5, 5, 5.5, 5.5, true, 'abc', 'abc');")
        tdSql.execute("insert into tb values (now + 7s, 6, 6, 6, 6, 6.5, 6.5, true, 'abc', 'abc');")
        tdSql.execute("insert into tb values (now + 8s, 7, 7, 7, 7, 7.5, 7.5, false, 'abc', 'abc');")
        tdSql.execute("insert into tb values (now + 9s, 8, 8, 8, 8, 8.5, 8.5, false, 'abc', 'abc');")
        tdSql.execute("insert into tb values (now + 10s, 9, 9, 9, 9, 9.5, 9.5, false, 'abc', 'abc');")
        tdSql.execute("insert into tb values (now + 11s, 10, 10, 10, 10, 10.5, 10.5, false, 'abc', 'abc');")
        tdSql.execute("insert into tb values (now + 12s, 15, 15, 15, 15, 15.5, 15.5, false, 'abc', 'abc');")
        tdSql.execute("insert into tb values (now + 13s, 20, 20, 20, 20, 20.5, 20.5, false, 'abc', 'abc');")
        tdSql.execute("insert into tb values (now + 14s, 99, 99, 99, 99, 99.5, 99.5, false, 'abc', 'abc');")
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195

        #execute query
        print("============== STEP 1: column types  ================== ")
        #Supported column types
        tdSql.query('select histogram(col_tinyint, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.checkRows(3);
        tdSql.query('select histogram(col_tinyint, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.checkRows(3);
        tdSql.query('select histogram(col_tinyint, "user_input", "[1,3,5,7]", 0) from tb;')
        tdSql.checkRows(3);

        tdSql.query('select histogram(col_smallint, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.checkRows(3);
        tdSql.query('select histogram(col_smallint, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.checkRows(3);
        tdSql.query('select histogram(col_smallint, "user_input", "[1,3,5,7]", 0) from tb;')
        tdSql.checkRows(3);

        tdSql.query('select histogram(col_int, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.checkRows(3);
        tdSql.query('select histogram(col_int, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.checkRows(3);
        tdSql.query('select histogram(col_int, "user_input", "[1,3,5,7]", 0) from tb;')
        tdSql.checkRows(3);

        tdSql.query('select histogram(col_bigint, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.checkRows(3);
        tdSql.query('select histogram(col_bigint, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.checkRows(3);
        tdSql.query('select histogram(col_bigint, "user_input", "[1,3,5,7]", 0) from tb;')
        tdSql.checkRows(3);

        tdSql.query('select histogram(col_float, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.checkRows(3);
        tdSql.query('select histogram(col_float, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.checkRows(3);
        tdSql.query('select histogram(col_float, "user_input", "[1,3,5,7]", 0) from tb;')
        tdSql.checkRows(3);

        tdSql.query('select histogram(col_double, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.checkRows(3);
        tdSql.query('select histogram(col_double, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.checkRows(3);
        tdSql.query('select histogram(col_double, "user_input", "[1,3,5,7]", 0) from tb;')
        tdSql.checkRows(3);

        #Unsupported column types
        tdSql.error('select histogram(col_timestamp, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.error('select histogram(col_timestamp, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.error('select histogram(col_timestamp, "user_input", "[1,3,5,7]", 0) from tb;')

        tdSql.error('select histogram(col_bool, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.error('select histogram(col_bool, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.error('select histogram(col_bool, "user_input", "[1,3,5,7]", 0) from tb;')

        tdSql.error('select histogram(col_binary, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.error('select histogram(col_binary, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.error('select histogram(col_binary, "user_input", "[1,3,5,7]", 0) from tb;')

        tdSql.error('select histogram(col_nchar, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.error('select histogram(col_nchar, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.error('select histogram(col_nchar, "user_input", "[1,3,5,7]", 0) from tb;')

        #Unsupported tags
        tdSql.error('select histogram(tag_timestamp, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.error('select histogram(tag_timestamp, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.error('select histogram(tag_timestamp, "user_input", "[1,3,5,7]", 0) from tb;')

        tdSql.error('select histogram(tag_tinyint, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.error('select histogram(tag_tinyint, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.error('select histogram(tag_tinyint, "user_input", "[1,3,5,7]", 0) from tb;')

        tdSql.error('select histogram(tag_smallint, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.error('select histogram(tag_smallint, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.error('select histogram(tag_smallint, "user_input", "[1,3,5,7]", 0) from tb;')

        tdSql.error('select histogram(tag_int, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.error('select histogram(tag_int, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.error('select histogram(tag_int, "user_input", "[1,3,5,7]", 0) from tb;')

        tdSql.error('select histogram(tag_bigint, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.error('select histogram(tag_bigint, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.error('select histogram(tag_bigint, "user_input", "[1,3,5,7]", 0) from tb;')

        tdSql.error('select histogram(tag_float, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.error('select histogram(tag_float, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.error('select histogram(tag_float, "user_input", "[1,3,5,7]", 0) from tb;')

        tdSql.error('select histogram(tag_double, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.error('select histogram(tag_double, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.error('select histogram(tag_double, "user_input", "[1,3,5,7]", 0) from tb;')

        tdSql.error('select histogram(tag_bool, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.error('select histogram(tag_bool, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.error('select histogram(tag_bool, "user_input", "[1,3,5,7]", 0) from tb;')

        tdSql.error('select histogram(tag_binary, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.error('select histogram(tag_binary, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.error('select histogram(tag_binary, "user_input", "[1,3,5,7]", 0) from tb;')

        tdSql.error('select histogram(tag_nchar, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.error('select histogram(tag_nchar, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.error('select histogram(tag_nchar, "user_input", "[1,3,5,7]", 0) from tb;')


        print("============== STEP 2: bin types  ================== ")
196
        ## user_input ##
197 198 199
        #TINYINT
        tdSql.query('select histogram(col_tinyint, "user_input", "[1,3,5]", 0) from stb;')
        tdSql.checkRows(2);
200 201
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
202 203
        tdSql.query('select histogram(col_tinyint, "user_input", "[1,3,5]", 0) from ctb;')
        tdSql.checkRows(2);
204 205
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
206 207
        tdSql.query('select histogram(col_tinyint, "user_input", "[1,3,5]", 0) from tb;')
        tdSql.checkRows(2);
208 209
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
210 211 212

        tdSql.query('select histogram(col_tinyint, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.checkRows(3);
213 214 215
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
        tdSql.checkData(2, 0, "(5:7]:2");
216 217
        tdSql.query('select histogram(col_tinyint, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.checkRows(3);
218 219 220
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
        tdSql.checkData(2, 0, "(5:7]:2");
221 222
        tdSql.query('select histogram(col_tinyint, "user_input", "[1,3,5,7]", 0) from tb;')
        tdSql.checkRows(3);
223 224 225
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
        tdSql.checkData(2, 0, "(5:7]:2");
226 227 228

        tdSql.query('select histogram(col_tinyint, "user_input", "[0,10,20,100]", 0) from stb;')
        tdSql.checkRows(3);
229 230 231
        tdSql.checkData(0, 0, "(0:10]:10");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
232 233
        tdSql.query('select histogram(col_tinyint, "user_input", "[0,10,20,100]", 0) from ctb;')
        tdSql.checkRows(3);
234 235 236
        tdSql.checkData(0, 0, "(0:10]:10");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
237 238
        tdSql.query('select histogram(col_tinyint, "user_input", "[0,10,20,100]", 0) from tb;')
        tdSql.checkRows(3);
239 240 241
        tdSql.checkData(0, 0, "(0:10]:10");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
242 243 244

        tdSql.query('select histogram(col_tinyint, "user_input", "[-10,10,20,100]", 0) from stb;')
        tdSql.checkRows(3);
245 246 247
        tdSql.checkData(0, 0, "(-10:10]:12");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
248 249
        tdSql.query('select histogram(col_tinyint, "user_input", "[-10,10,20,100]", 0) from ctb;')
        tdSql.checkRows(3);
250 251 252
        tdSql.checkData(0, 0, "(-10:10]:12");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
253 254
        tdSql.query('select histogram(col_tinyint, "user_input", "[-10,10,20,100]", 0) from tb;')
        tdSql.checkRows(3);
255 256 257
        tdSql.checkData(0, 0, "(-10:10]:12");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
258 259 260

        tdSql.query('select histogram(col_tinyint, "user_input", "[-8.9,9.9,19.9,99.9]", 0) from stb;')
        tdSql.checkRows(3);
261 262 263
        tdSql.checkData(0, 0, "(-8.9:9.9]:10");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:99.9]:2");
264 265
        tdSql.query('select histogram(col_tinyint, "user_input", "[-8.9,9.9,19.9,99.9]", 0) from ctb;')
        tdSql.checkRows(3);
266 267 268
        tdSql.checkData(0, 0, "(-8.9:9.9]:10");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:99.9]:2");
269 270
        tdSql.query('select histogram(col_tinyint, "user_input", "[-8.9,9.9,19.9,99.9]", 0) from tb;')
        tdSql.checkRows(3);
271 272 273
        tdSql.checkData(0, 0, "(-8.9:9.9]:10");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:99.9]:2");
274 275 276

        tdSql.query('select histogram(col_tinyint, "user_input", "[-99999999999999,9.9,19.9,99999999999999]", 0) from stb;')
        tdSql.checkRows(3);
277 278 279
        tdSql.checkData(0, 0, "(-1e+14:9.9]:11");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:1e+14]:2");
280 281
        tdSql.query('select histogram(col_tinyint, "user_input", "[-99999999999999,9.9,19.9,99999999999999]", 0) from ctb;')
        tdSql.checkRows(3);
282 283 284
        tdSql.checkData(0, 0, "(-1e+14:9.9]:11");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:1e+14]:2");
285 286
        tdSql.query('select histogram(col_tinyint, "user_input", "[-99999999999999,9.9,19.9,99999999999999]", 0) from tb;')
        tdSql.checkRows(3);
287 288 289
        tdSql.checkData(0, 0, "(-1e+14:9.9]:11");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:1e+14]:2");
290 291 292 293

        #SMALLINT
        tdSql.query('select histogram(col_smallint, "user_input", "[1,3,5]", 0) from stb;')
        tdSql.checkRows(2);
294 295
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
296 297
        tdSql.query('select histogram(col_smallint, "user_input", "[1,3,5]", 0) from ctb;')
        tdSql.checkRows(2);
298 299
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
300 301
        tdSql.query('select histogram(col_smallint, "user_input", "[1,3,5]", 0) from tb;')
        tdSql.checkRows(2);
302 303
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
304 305 306

        tdSql.query('select histogram(col_smallint, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.checkRows(3);
307 308 309
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
        tdSql.checkData(2, 0, "(5:7]:2");
310 311
        tdSql.query('select histogram(col_smallint, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.checkRows(3);
312 313 314
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
        tdSql.checkData(2, 0, "(5:7]:2");
315 316
        tdSql.query('select histogram(col_smallint, "user_input", "[1,3,5,7]", 0) from tb;')
        tdSql.checkRows(3);
317 318 319
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
        tdSql.checkData(2, 0, "(5:7]:2");
320 321 322

        tdSql.query('select histogram(col_smallint, "user_input", "[0,10,20,100]", 0) from stb;')
        tdSql.checkRows(3);
323 324 325
        tdSql.checkData(0, 0, "(0:10]:10");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
326 327
        tdSql.query('select histogram(col_smallint, "user_input", "[0,10,20,100]", 0) from ctb;')
        tdSql.checkRows(3);
328 329 330
        tdSql.checkData(0, 0, "(0:10]:10");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
331 332
        tdSql.query('select histogram(col_smallint, "user_input", "[0,10,20,100]", 0) from tb;')
        tdSql.checkRows(3);
333 334 335
        tdSql.checkData(0, 0, "(0:10]:10");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
336 337 338

        tdSql.query('select histogram(col_smallint, "user_input", "[-10,10,20,100]", 0) from stb;')
        tdSql.checkRows(3);
339 340 341
        tdSql.checkData(0, 0, "(-10:10]:12");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
342 343
        tdSql.query('select histogram(col_smallint, "user_input", "[-10,10,20,100]", 0) from ctb;')
        tdSql.checkRows(3);
344 345 346
        tdSql.checkData(0, 0, "(-10:10]:12");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
347 348
        tdSql.query('select histogram(col_smallint, "user_input", "[-10,10,20,100]", 0) from tb;')
        tdSql.checkRows(3);
349 350 351
        tdSql.checkData(0, 0, "(-10:10]:12");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
352 353 354

        tdSql.query('select histogram(col_smallint, "user_input", "[-8.9,9.9,19.9,99.9]", 0) from stb;')
        tdSql.checkRows(3);
355 356 357
        tdSql.checkData(0, 0, "(-8.9:9.9]:10");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:99.9]:2");
358 359
        tdSql.query('select histogram(col_smallint, "user_input", "[-8.9,9.9,19.9,99.9]", 0) from ctb;')
        tdSql.checkRows(3);
360 361 362
        tdSql.checkData(0, 0, "(-8.9:9.9]:10");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:99.9]:2");
363 364
        tdSql.query('select histogram(col_smallint, "user_input", "[-8.9,9.9,19.9,99.9]", 0) from tb;')
        tdSql.checkRows(3);
365 366 367
        tdSql.checkData(0, 0, "(-8.9:9.9]:10");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:99.9]:2");
368 369 370

        tdSql.query('select histogram(col_smallint, "user_input", "[-99999999999999,9.9,19.9,99999999999999]", 0) from stb;')
        tdSql.checkRows(3);
371 372 373
        tdSql.checkData(0, 0, "(-1e+14:9.9]:11");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:1e+14]:2");
374 375
        tdSql.query('select histogram(col_smallint, "user_input", "[-99999999999999,9.9,19.9,99999999999999]", 0) from ctb;')
        tdSql.checkRows(3);
376 377 378
        tdSql.checkData(0, 0, "(-1e+14:9.9]:11");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:1e+14]:2");
379 380
        tdSql.query('select histogram(col_smallint, "user_input", "[-99999999999999,9.9,19.9,99999999999999]", 0) from tb;')
        tdSql.checkRows(3);
381 382 383
        tdSql.checkData(0, 0, "(-1e+14:9.9]:11");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:1e+14]:2");
384 385 386 387

        #INT
        tdSql.query('select histogram(col_int, "user_input", "[1,3,5]", 0) from stb;')
        tdSql.checkRows(2);
388 389
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
390 391
        tdSql.query('select histogram(col_int, "user_input", "[1,3,5]", 0) from ctb;')
        tdSql.checkRows(2);
392 393
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
394 395
        tdSql.query('select histogram(col_int, "user_input", "[1,3,5]", 0) from tb;')
        tdSql.checkRows(2);
396 397
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
398 399 400

        tdSql.query('select histogram(col_int, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.checkRows(3);
401 402 403
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
        tdSql.checkData(2, 0, "(5:7]:2");
404 405
        tdSql.query('select histogram(col_int, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.checkRows(3);
406 407 408
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
        tdSql.checkData(2, 0, "(5:7]:2");
409 410
        tdSql.query('select histogram(col_int, "user_input", "[1,3,5,7]", 0) from tb;')
        tdSql.checkRows(3);
411 412 413
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
        tdSql.checkData(2, 0, "(5:7]:2");
414 415 416

        tdSql.query('select histogram(col_int, "user_input", "[0,10,20,100]", 0) from stb;')
        tdSql.checkRows(3);
417 418 419
        tdSql.checkData(0, 0, "(0:10]:10");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
420 421
        tdSql.query('select histogram(col_int, "user_input", "[0,10,20,100]", 0) from ctb;')
        tdSql.checkRows(3);
422 423 424
        tdSql.checkData(0, 0, "(0:10]:10");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
425 426
        tdSql.query('select histogram(col_int, "user_input", "[0,10,20,100]", 0) from tb;')
        tdSql.checkRows(3);
427 428 429
        tdSql.checkData(0, 0, "(0:10]:10");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
430 431 432

        tdSql.query('select histogram(col_int, "user_input", "[-10,10,20,100]", 0) from stb;')
        tdSql.checkRows(3);
433 434 435
        tdSql.checkData(0, 0, "(-10:10]:12");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
436 437
        tdSql.query('select histogram(col_int, "user_input", "[-10,10,20,100]", 0) from ctb;')
        tdSql.checkRows(3);
438 439 440
        tdSql.checkData(0, 0, "(-10:10]:12");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
441 442
        tdSql.query('select histogram(col_int, "user_input", "[-10,10,20,100]", 0) from tb;')
        tdSql.checkRows(3);
443 444 445
        tdSql.checkData(0, 0, "(-10:10]:12");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
446 447 448

        tdSql.query('select histogram(col_int, "user_input", "[-8.9,9.9,19.9,99.9]", 0) from stb;')
        tdSql.checkRows(3);
449 450 451
        tdSql.checkData(0, 0, "(-8.9:9.9]:10");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:99.9]:2");
452 453
        tdSql.query('select histogram(col_int, "user_input", "[-8.9,9.9,19.9,99.9]", 0) from ctb;')
        tdSql.checkRows(3);
454 455 456
        tdSql.checkData(0, 0, "(-8.9:9.9]:10");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:99.9]:2");
457 458
        tdSql.query('select histogram(col_int, "user_input", "[-8.9,9.9,19.9,99.9]", 0) from tb;')
        tdSql.checkRows(3);
459 460 461
        tdSql.checkData(0, 0, "(-8.9:9.9]:10");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:99.9]:2");
462 463 464

        tdSql.query('select histogram(col_int, "user_input", "[-99999999999999,9.9,19.9,99999999999999]", 0) from stb;')
        tdSql.checkRows(3);
465 466 467
        tdSql.checkData(0, 0, "(-1e+14:9.9]:11");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:1e+14]:2");
468 469
        tdSql.query('select histogram(col_int, "user_input", "[-99999999999999,9.9,19.9,99999999999999]", 0) from ctb;')
        tdSql.checkRows(3);
470 471 472
        tdSql.checkData(0, 0, "(-1e+14:9.9]:11");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:1e+14]:2");
473 474
        tdSql.query('select histogram(col_int, "user_input", "[-99999999999999,9.9,19.9,99999999999999]", 0) from tb;')
        tdSql.checkRows(3);
475 476 477
        tdSql.checkData(0, 0, "(-1e+14:9.9]:11");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:1e+14]:2");
478 479 480 481

        #BIGINT
        tdSql.query('select histogram(col_bigint, "user_input", "[1,3,5]", 0) from stb;')
        tdSql.checkRows(2);
482 483
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
484 485
        tdSql.query('select histogram(col_bigint, "user_input", "[1,3,5]", 0) from ctb;')
        tdSql.checkRows(2);
486 487
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
488 489
        tdSql.query('select histogram(col_bigint, "user_input", "[1,3,5]", 0) from tb;')
        tdSql.checkRows(2);
490 491
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
492 493 494

        tdSql.query('select histogram(col_bigint, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.checkRows(3);
495 496 497
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
        tdSql.checkData(2, 0, "(5:7]:2");
498 499
        tdSql.query('select histogram(col_bigint, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.checkRows(3);
500 501 502
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
        tdSql.checkData(2, 0, "(5:7]:2");
503 504
        tdSql.query('select histogram(col_bigint, "user_input", "[1,3,5,7]", 0) from tb;')
        tdSql.checkRows(3);
505 506 507
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
        tdSql.checkData(2, 0, "(5:7]:2");
508 509 510

        tdSql.query('select histogram(col_bigint, "user_input", "[0,10,20,100]", 0) from stb;')
        tdSql.checkRows(3);
511 512 513
        tdSql.checkData(0, 0, "(0:10]:10");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
514 515
        tdSql.query('select histogram(col_bigint, "user_input", "[0,10,20,100]", 0) from ctb;')
        tdSql.checkRows(3);
516 517 518
        tdSql.checkData(0, 0, "(0:10]:10");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
519 520
        tdSql.query('select histogram(col_bigint, "user_input", "[0,10,20,100]", 0) from tb;')
        tdSql.checkRows(3);
521 522 523
        tdSql.checkData(0, 0, "(0:10]:10");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
524 525 526

        tdSql.query('select histogram(col_bigint, "user_input", "[-10,10,20,100]", 0) from stb;')
        tdSql.checkRows(3);
527 528 529
        tdSql.checkData(0, 0, "(-10:10]:12");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
530 531
        tdSql.query('select histogram(col_bigint, "user_input", "[-10,10,20,100]", 0) from ctb;')
        tdSql.checkRows(3);
532 533 534
        tdSql.checkData(0, 0, "(-10:10]:12");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
535 536
        tdSql.query('select histogram(col_bigint, "user_input", "[-10,10,20,100]", 0) from tb;')
        tdSql.checkRows(3);
537 538 539
        tdSql.checkData(0, 0, "(-10:10]:12");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:1");
540 541 542

        tdSql.query('select histogram(col_bigint, "user_input", "[-8.9,9.9,19.9,99.9]", 0) from stb;')
        tdSql.checkRows(3);
543 544 545
        tdSql.checkData(0, 0, "(-8.9:9.9]:10");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:99.9]:2");
546 547
        tdSql.query('select histogram(col_bigint, "user_input", "[-8.9,9.9,19.9,99.9]", 0) from ctb;')
        tdSql.checkRows(3);
548 549 550
        tdSql.checkData(0, 0, "(-8.9:9.9]:10");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:99.9]:2");
551 552
        tdSql.query('select histogram(col_bigint, "user_input", "[-8.9,9.9,19.9,99.9]", 0) from tb;')
        tdSql.checkRows(3);
553 554 555
        tdSql.checkData(0, 0, "(-8.9:9.9]:10");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:99.9]:2");
556 557 558

        tdSql.query('select histogram(col_bigint, "user_input", "[-99999999999999,9.9,19.9,99999999999999]", 0) from stb;')
        tdSql.checkRows(3);
559 560 561
        tdSql.checkData(0, 0, "(-1e+14:9.9]:11");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:1e+14]:2");
562 563
        tdSql.query('select histogram(col_bigint, "user_input", "[-99999999999999,9.9,19.9,99999999999999]", 0) from ctb;')
        tdSql.checkRows(3);
564 565 566
        tdSql.checkData(0, 0, "(-1e+14:9.9]:11");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:1e+14]:2");
567 568
        tdSql.query('select histogram(col_bigint, "user_input", "[-99999999999999,9.9,19.9,99999999999999]", 0) from tb;')
        tdSql.checkRows(3);
569 570 571
        tdSql.checkData(0, 0, "(-1e+14:9.9]:11");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:1e+14]:2");
572 573 574 575

        #FLOAT
        tdSql.query('select histogram(col_float, "user_input", "[1,3,5]", 0) from stb;')
        tdSql.checkRows(2);
576 577
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
578 579
        tdSql.query('select histogram(col_float, "user_input", "[1,3,5]", 0) from ctb;')
        tdSql.checkRows(2);
580 581
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
582 583
        tdSql.query('select histogram(col_float, "user_input", "[1,3,5]", 0) from tb;')
        tdSql.checkRows(2);
584 585
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
586 587 588

        tdSql.query('select histogram(col_float, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.checkRows(3);
589 590 591
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
        tdSql.checkData(2, 0, "(5:7]:2");
592 593
        tdSql.query('select histogram(col_float, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.checkRows(3);
594 595 596
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
        tdSql.checkData(2, 0, "(5:7]:2");
597 598
        tdSql.query('select histogram(col_float, "user_input", "[1,3,5,7]", 0) from tb;')
        tdSql.checkRows(3);
599 600 601
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
        tdSql.checkData(2, 0, "(5:7]:2");
602 603 604

        tdSql.query('select histogram(col_float, "user_input", "[0,10,20,100]", 0) from stb;')
        tdSql.checkRows(3);
605 606 607
        tdSql.checkData(0, 0, "(0:10]:9");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:2");
608 609
        tdSql.query('select histogram(col_float, "user_input", "[0,10,20,100]", 0) from ctb;')
        tdSql.checkRows(3);
610 611 612
        tdSql.checkData(0, 0, "(0:10]:9");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:2");
613 614
        tdSql.query('select histogram(col_float, "user_input", "[0,10,20,100]", 0) from tb;')
        tdSql.checkRows(3);
615 616 617
        tdSql.checkData(0, 0, "(0:10]:9");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:2");
618 619 620

        tdSql.query('select histogram(col_float, "user_input", "[-10,10,20,100]", 0) from stb;')
        tdSql.checkRows(3);
621 622 623
        tdSql.checkData(0, 0, "(-10:10]:11");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:2");
624 625
        tdSql.query('select histogram(col_float, "user_input", "[-10,10,20,100]", 0) from ctb;')
        tdSql.checkRows(3);
626 627 628
        tdSql.checkData(0, 0, "(-10:10]:11");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:2");
629 630
        tdSql.query('select histogram(col_float, "user_input", "[-10,10,20,100]", 0) from tb;')
        tdSql.checkRows(3);
631 632 633
        tdSql.checkData(0, 0, "(-10:10]:11");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:2");
634 635 636

        tdSql.query('select histogram(col_float, "user_input", "[-9.4,9.6,20.4,99.9]", 0) from stb;')
        tdSql.checkRows(3);
637 638 639
        tdSql.checkData(0, 0, "(-9.4:9.6]:10");
        tdSql.checkData(1, 0, "(9.6:20.4]:2");
        tdSql.checkData(2, 0, "(20.4:99.9]:2");
640 641
        tdSql.query('select histogram(col_float, "user_input", "[-9.4,9.6,20.4,99.9]", 0) from ctb;')
        tdSql.checkRows(3);
642 643 644
        tdSql.checkData(0, 0, "(-9.4:9.6]:10");
        tdSql.checkData(1, 0, "(9.6:20.4]:2");
        tdSql.checkData(2, 0, "(20.4:99.9]:2");
645 646
        tdSql.query('select histogram(col_float, "user_input", "[-9.4,9.6,20.4,99.9]", 0) from tb;')
        tdSql.checkRows(3);
647 648 649
        tdSql.checkData(0, 0, "(-9.4:9.6]:10");
        tdSql.checkData(1, 0, "(9.6:20.4]:2");
        tdSql.checkData(2, 0, "(20.4:99.9]:2");
650 651 652 653


        tdSql.query('select histogram(col_float, "user_input", "[-99999999999999,9.9,19.9,99999999999999]", 0) from stb;')
        tdSql.checkRows(3);
654 655 656
        tdSql.checkData(0, 0, "(-1e+14:9.9]:11");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:1e+14]:2");
657 658
        tdSql.query('select histogram(col_float, "user_input", "[-99999999999999,9.9,19.9,99999999999999]", 0) from ctb;')
        tdSql.checkRows(3);
659 660 661
        tdSql.checkData(0, 0, "(-1e+14:9.9]:11");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:1e+14]:2");
662 663
        tdSql.query('select histogram(col_float, "user_input", "[-99999999999999,9.9,19.9,99999999999999]", 0) from tb;')
        tdSql.checkRows(3);
664 665 666
        tdSql.checkData(0, 0, "(-1e+14:9.9]:11");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:1e+14]:2");
667 668 669 670

        #DOUBLE
        tdSql.query('select histogram(col_double, "user_input", "[1,3,5]", 0) from stb;')
        tdSql.checkRows(2);
671 672
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
673 674
        tdSql.query('select histogram(col_double, "user_input", "[1,3,5]", 0) from ctb;')
        tdSql.checkRows(2);
675 676
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
677 678
        tdSql.query('select histogram(col_double, "user_input", "[1,3,5]", 0) from tb;')
        tdSql.checkRows(2);
679 680
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
681 682 683

        tdSql.query('select histogram(col_double, "user_input", "[1,3,5,7]", 0) from stb;')
        tdSql.checkRows(3);
684 685 686
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
        tdSql.checkData(2, 0, "(5:7]:2");
687 688
        tdSql.query('select histogram(col_double, "user_input", "[1,3,5,7]", 0) from ctb;')
        tdSql.checkRows(3);
689 690 691
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
        tdSql.checkData(2, 0, "(5:7]:2");
692 693
        tdSql.query('select histogram(col_double, "user_input", "[1,3,5,7]", 0) from tb;')
        tdSql.checkRows(3);
694 695 696
        tdSql.checkData(0, 0, "(1:3]:2");
        tdSql.checkData(1, 0, "(3:5]:2");
        tdSql.checkData(2, 0, "(5:7]:2");
697 698 699

        tdSql.query('select histogram(col_double, "user_input", "[0,10,20,100]", 0) from stb;')
        tdSql.checkRows(3);
700 701 702
        tdSql.checkData(0, 0, "(0:10]:9");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:2");
703 704
        tdSql.query('select histogram(col_double, "user_input", "[0,10,20,100]", 0) from ctb;')
        tdSql.checkRows(3);
705 706 707
        tdSql.checkData(0, 0, "(0:10]:9");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:2");
708 709
        tdSql.query('select histogram(col_double, "user_input", "[0,10,20,100]", 0) from tb;')
        tdSql.checkRows(3);
710 711 712
        tdSql.checkData(0, 0, "(0:10]:9");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:2");
713 714 715

        tdSql.query('select histogram(col_double, "user_input", "[-10,10,20,100]", 0) from stb;')
        tdSql.checkRows(3);
716 717 718
        tdSql.checkData(0, 0, "(-10:10]:11");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:2");
719 720
        tdSql.query('select histogram(col_double, "user_input", "[-10,10,20,100]", 0) from ctb;')
        tdSql.checkRows(3);
721 722 723
        tdSql.checkData(0, 0, "(-10:10]:11");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:2");
724 725
        tdSql.query('select histogram(col_double, "user_input", "[-10,10,20,100]", 0) from tb;')
        tdSql.checkRows(3);
726 727 728
        tdSql.checkData(0, 0, "(-10:10]:11");
        tdSql.checkData(1, 0, "(10:20]:2");
        tdSql.checkData(2, 0, "(20:100]:2");
729 730 731

        tdSql.query('select histogram(col_double, "user_input", "[-9.4,9.6,20.4,99.9]", 0) from stb;')
        tdSql.checkRows(3);
732 733 734
        tdSql.checkData(0, 0, "(-9.4:9.6]:10");
        tdSql.checkData(1, 0, "(9.6:20.4]:2");
        tdSql.checkData(2, 0, "(20.4:99.9]:2");
735 736
        tdSql.query('select histogram(col_double, "user_input", "[-9.4,9.6,20.4,99.9]", 0) from ctb;')
        tdSql.checkRows(3);
737 738 739
        tdSql.checkData(0, 0, "(-9.4:9.6]:10");
        tdSql.checkData(1, 0, "(9.6:20.4]:2");
        tdSql.checkData(2, 0, "(20.4:99.9]:2");
740 741
        tdSql.query('select histogram(col_double, "user_input", "[-9.4,9.6,20.4,99.9]", 0) from tb;')
        tdSql.checkRows(3);
742 743 744
        tdSql.checkData(0, 0, "(-9.4:9.6]:10");
        tdSql.checkData(1, 0, "(9.6:20.4]:2");
        tdSql.checkData(2, 0, "(20.4:99.9]:2");
745 746 747 748


        tdSql.query('select histogram(col_double, "user_input", "[-99999999999999,9.9,19.9,99999999999999]", 0) from stb;')
        tdSql.checkRows(3);
749 750 751
        tdSql.checkData(0, 0, "(-1e+14:9.9]:11");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:1e+14]:2");
752 753
        tdSql.query('select histogram(col_double, "user_input", "[-99999999999999,9.9,19.9,99999999999999]", 0) from ctb;')
        tdSql.checkRows(3);
754 755 756
        tdSql.checkData(0, 0, "(-1e+14:9.9]:11");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:1e+14]:2");
757 758
        tdSql.query('select histogram(col_double, "user_input", "[-99999999999999,9.9,19.9,99999999999999]", 0) from tb;')
        tdSql.checkRows(3);
759 760 761
        tdSql.checkData(0, 0, "(-1e+14:9.9]:11");
        tdSql.checkData(1, 0, "(9.9:19.9]:2");
        tdSql.checkData(2, 0, "(19.9:1e+14]:2");
762

763 764
        #ERROR CASE
        tdSql.error('select histogram(col_double, "user_input", "[1,5,3,7]", 0) from stb;')
765 766
        tdSql.error('select histogram(col_double, "user_input", "[1,5,3,7]", 0) from ctb;')
        tdSql.error('select histogram(col_double, "user_input", "[1,5,3,7]", 0) from tb;')
767
        tdSql.error('select histogram(col_double, "user_input", "[1,-1,3,-3]", 0) from stb;')
768 769
        tdSql.error('select histogram(col_double, "user_input", "[1,-1,3,-3]", 0) from ctb;')
        tdSql.error('select histogram(col_double, "user_input", "[1,-1,3,-3]", 0) from tb;')
770
        tdSql.error('select histogram(col_double, "user_input", "[1.0,5.5,3.3,7.7]", 0) from stb;')
771 772
        tdSql.error('select histogram(col_double, "user_input", "[1.0,5.5,3.3,7.7]", 0) from ctb;')
        tdSql.error('select histogram(col_double, "user_input", "[1.0,5.5,3.3,7.7]", 0) from tb;')
773
        tdSql.error('select histogram(col_double, "user_input", "[1,1,1]", 0) from stb;')
774 775 776 777 778
        tdSql.error('select histogram(col_double, "user_input", "[1,1,1]", 0) from ctb;')
        tdSql.error('select histogram(col_double, "user_input", "[1,1,1]", 0) from tb;')
        tdSql.error('select histogram(col_double, "user_input", "[-1,-1,1]", 0) from stb;')
        tdSql.error('select histogram(col_double, "user_input", "[-1,-1,1]", 0) from ctb;')
        tdSql.error('select histogram(col_double, "user_input", "[-1,-1,1]", 0) from tb;')
779
        tdSql.error('select histogram(col_double, "user_input", "[false,3,5]", 0) from stb;')
780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802
        tdSql.error('select histogram(col_double, "user_input", "[false,3,5]", 0) from ctb;')
        tdSql.error('select histogram(col_double, "user_input", "[false,3,5]", 0) from tb;')
        tdSql.error('select histogram(col_double, "user_input", "[1,true,5]", 0) from stb;')
        tdSql.error('select histogram(col_double, "user_input", "[1,true,5]", 0) from ctb;')
        tdSql.error('select histogram(col_double, "user_input", "[1,true,5]", 0) from tb;')
        tdSql.error('select histogram(col_double, "user_input", "[1.0,"abc",5]", 0) from stb;')
        tdSql.error('select histogram(col_double, "user_input", "[1.0,"abc",5]", 0) from ctb;')
        tdSql.error('select histogram(col_double, "user_input", "[1.0,"abc",5]", 0) from tb;')
        tdSql.error('select histogram(col_double, "user_input", "[1.0, 5, "中文"]", 0) from stb;')
        tdSql.error('select histogram(col_double, "user_input", "[1.0, 5, "中文"]", 0) from ctb;')
        tdSql.error('select histogram(col_double, "user_input", "[1.0, 5, "中文"]", 0) from tb;')
        tdSql.error('select histogram(col_double, "user_input", "{1.0, 3.0, 5.0}", 0) from stb;')
        tdSql.error('select histogram(col_double, "user_input", "{1.0, 3.0, 5.0}", 0) from ctb;')
        tdSql.error('select histogram(col_double, "user_input", "{1.0, 3.0, 5.0}", 0) from tb;')
        tdSql.error('select histogram(col_double, \'user_input\', \'{"start": 1.0, "width": 3.0, "count": 5, "infinity": true}\', 0) from stb;')
        tdSql.error('select histogram(col_double, \'user_input\', \'{"start": 1.0, "width": 3.0, "count": 5, "infinity": true}\', 0) from ctb;')
        tdSql.error('select histogram(col_double, \'user_input\', \'{"start": 1.0, "width": 3.0, "count": 5, "infinity": true}\', 0) from tb;')
        tdSql.error('select histogram(col_double, \'user_input\', \'{"start": 1.0, "factor": 3.0, "count": 5, "infinity": true}\', 0) from stb;')
        tdSql.error('select histogram(col_double, \'user_input\', \'{"start": 1.0, "factor": 3.0, "count": 5, "infinity": true}\', 0) from ctb;')
        tdSql.error('select histogram(col_double, \'user_input\', \'{"start": 1.0, "factor": 3.0, "count": 5, "infinity": true}\', 0) from tb;')


        ## linear_bins ##
803
        #TINYINT
804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": 1, "width": 3, "count": 8, "infinity": false}\', 0) from stb;')
        tdSql.checkRows(8);
        tdSql.checkData(0, 0, "(1:4]:3");
        tdSql.checkData(1, 0, "(4:7]:3");
        tdSql.checkData(2, 0, "(7:10]:3");
        tdSql.checkData(3, 0, "(10:13]:0");
        tdSql.checkData(4, 0, "(13:16]:1");
        tdSql.checkData(5, 0, "(16:19]:0");
        tdSql.checkData(6, 0, "(19:22]:1");
        tdSql.checkData(7, 0, "(22:25]:0");
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": 1, "width": 3, "count": 8, "infinity": false}\', 0) from ctb;')
        tdSql.checkRows(8);
        tdSql.checkData(0, 0, "(1:4]:3");
        tdSql.checkData(1, 0, "(4:7]:3");
        tdSql.checkData(2, 0, "(7:10]:3");
        tdSql.checkData(3, 0, "(10:13]:0");
        tdSql.checkData(4, 0, "(13:16]:1");
        tdSql.checkData(5, 0, "(16:19]:0");
        tdSql.checkData(6, 0, "(19:22]:1");
        tdSql.checkData(7, 0, "(22:25]:0");
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": 1, "width": 3, "count": 8, "infinity": false}\', 0) from tb;')
        tdSql.checkRows(8);
        tdSql.checkData(0, 0, "(1:4]:3");
        tdSql.checkData(1, 0, "(4:7]:3");
        tdSql.checkData(2, 0, "(7:10]:3");
        tdSql.checkData(3, 0, "(10:13]:0");
        tdSql.checkData(4, 0, "(13:16]:1");
        tdSql.checkData(5, 0, "(16:19]:0");
        tdSql.checkData(6, 0, "(19:22]:1");
        tdSql.checkData(7, 0, "(22:25]:0");

        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": -10.0, "width": 3.0, "count": 8, "infinity": false}\', 0) from stb;')
        tdSql.checkRows(8);
        tdSql.checkData(0, 0, "(-10:-7]:1");
        tdSql.checkData(1, 0, "(-7:-4]:0");
        tdSql.checkData(2, 0, "(-4:-1]:1");
        tdSql.checkData(3, 0, "(-1:2]:2");
        tdSql.checkData(4, 0, "(2:5]:3");
        tdSql.checkData(5, 0, "(5:8]:3");
        tdSql.checkData(6, 0, "(8:11]:2");
        tdSql.checkData(7, 0, "(11:14]:0");
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": -10.0, "width": 3.0, "count": 8, "infinity": false}\', 0) from ctb;')
        tdSql.checkRows(8);
        tdSql.checkData(0, 0, "(-10:-7]:1");
        tdSql.checkData(1, 0, "(-7:-4]:0");
        tdSql.checkData(2, 0, "(-4:-1]:1");
        tdSql.checkData(3, 0, "(-1:2]:2");
        tdSql.checkData(4, 0, "(2:5]:3");
        tdSql.checkData(5, 0, "(5:8]:3");
        tdSql.checkData(6, 0, "(8:11]:2");
        tdSql.checkData(7, 0, "(11:14]:0");
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": -10.0, "width": 3.0, "count": 8, "infinity": false}\', 0) from tb;')
        tdSql.checkRows(8);
        tdSql.checkData(0, 0, "(-10:-7]:1");
        tdSql.checkData(1, 0, "(-7:-4]:0");
        tdSql.checkData(2, 0, "(-4:-1]:1");
        tdSql.checkData(3, 0, "(-1:2]:2");
        tdSql.checkData(4, 0, "(2:5]:3");
        tdSql.checkData(5, 0, "(5:8]:3");
        tdSql.checkData(6, 0, "(8:11]:2");
        tdSql.checkData(7, 0, "(11:14]:0");

        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": -2.5, "width": 0.5, "count": 8, "infinity": false}\', 0) from stb;')
        tdSql.checkRows(8);
        tdSql.checkData(0, 0, "(-2.5:-2]:0");
        tdSql.checkData(1, 0, "(-2:-1.5]:0");
        tdSql.checkData(2, 0, "(-1.5:-1]:1");
        tdSql.checkData(3, 0, "(-1:-0.5]:0");
        tdSql.checkData(4, 0, "(-0.5:0]:0");
        tdSql.checkData(5, 0, "(0:0.5]:0");
        tdSql.checkData(6, 0, "(0.5:1]:1");
        tdSql.checkData(7, 0, "(1:1.5]:0");
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": -2.5, "width": 0.5, "count": 8, "infinity": false}\', 0) from ctb;')
        tdSql.checkRows(8);
        tdSql.checkData(0, 0, "(-2.5:-2]:0");
        tdSql.checkData(1, 0, "(-2:-1.5]:0");
        tdSql.checkData(2, 0, "(-1.5:-1]:1");
        tdSql.checkData(3, 0, "(-1:-0.5]:0");
        tdSql.checkData(4, 0, "(-0.5:0]:0");
        tdSql.checkData(5, 0, "(0:0.5]:0");
        tdSql.checkData(6, 0, "(0.5:1]:1");
        tdSql.checkData(7, 0, "(1:1.5]:0");
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": -2.5, "width": 0.5, "count": 8, "infinity": false}\', 0) from tb;')
        tdSql.checkRows(8);
        tdSql.checkData(0, 0, "(-2.5:-2]:0");
        tdSql.checkData(1, 0, "(-2:-1.5]:0");
        tdSql.checkData(2, 0, "(-1.5:-1]:1");
        tdSql.checkData(3, 0, "(-1:-0.5]:0");
        tdSql.checkData(4, 0, "(-0.5:0]:0");
        tdSql.checkData(5, 0, "(0:0.5]:0");
        tdSql.checkData(6, 0, "(0.5:1]:1");
        tdSql.checkData(7, 0, "(1:1.5]:0");

        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": 4, "width": -0.5, "count": 10, "infinity": false}\', 0) from stb;')
        tdSql.checkRows(10);
        tdSql.checkData(0, 0, "(3.5:4]:1");
        tdSql.checkData(1, 0, "(3:3.5]:0");
        tdSql.checkData(2, 0, "(2.5:3]:1");
        tdSql.checkData(3, 0, "(2:2.5]:0");
        tdSql.checkData(4, 0, "(1.5:2]:1");
        tdSql.checkData(5, 0, "(1:1.5]:0");
        tdSql.checkData(6, 0, "(0.5:1]:1");
        tdSql.checkData(7, 0, "(0:0.5]:0");
        tdSql.checkData(8, 0, "(-0.5:0]:0");
        tdSql.checkData(9, 0, "(-1:-0.5]:0");
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": 4, "width": -0.5, "count": 10, "infinity": false}\', 0) from ctb;')
        tdSql.checkRows(10);
        tdSql.checkData(0, 0, "(3.5:4]:1");
        tdSql.checkData(1, 0, "(3:3.5]:0");
        tdSql.checkData(2, 0, "(2.5:3]:1");
        tdSql.checkData(3, 0, "(2:2.5]:0");
        tdSql.checkData(4, 0, "(1.5:2]:1");
        tdSql.checkData(5, 0, "(1:1.5]:0");
        tdSql.checkData(6, 0, "(0.5:1]:1");
        tdSql.checkData(7, 0, "(0:0.5]:0");
        tdSql.checkData(8, 0, "(-0.5:0]:0");
        tdSql.checkData(9, 0, "(-1:-0.5]:0");
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": 4, "width": -0.5, "count": 10, "infinity": false}\', 0) from tb;')
        tdSql.checkRows(10);
        tdSql.checkData(0, 0, "(3.5:4]:1");
        tdSql.checkData(1, 0, "(3:3.5]:0");
        tdSql.checkData(2, 0, "(2.5:3]:1");
        tdSql.checkData(3, 0, "(2:2.5]:0");
        tdSql.checkData(4, 0, "(1.5:2]:1");
        tdSql.checkData(5, 0, "(1:1.5]:0");
        tdSql.checkData(6, 0, "(0.5:1]:1");
        tdSql.checkData(7, 0, "(0:0.5]:0");
        tdSql.checkData(8, 0, "(-0.5:0]:0");
        tdSql.checkData(9, 0, "(-1:-0.5]:0");

        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": 1, "width": 0.5, "count": 1.9999, "infinity": false}\', 0) from stb;')
        tdSql.checkRows(1);
        tdSql.checkData(0, 0, "(1:1.5]:0");
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": 1, "width": 0.5, "count": 1.9999, "infinity": false}\', 0) from ctb;')
        tdSql.checkRows(1);
        tdSql.checkData(0, 0, "(1:1.5]:0");
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": 1, "width": 0.5, "count": 1.9999, "infinity": false}\', 0) from tb;')
        tdSql.checkRows(1);
        tdSql.checkData(0, 0, "(1:1.5]:0");

944
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": 1, "width": 0.5, "count": 1.99999999999999999, "infinity": false}\', 0) from stb;')
945
        tdSql.checkRows(2);
946 947
        tdSql.checkData(0, 0, "(1:1.5]:0");
        tdSql.checkData(1, 0, "(1.5:2]:1");
948
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": 1, "width": 0.5, "count": 1.99999999999999999, "infinity": false}\', 0) from ctb;')
949
        tdSql.checkRows(2);
950 951
        tdSql.checkData(0, 0, "(1:1.5]:0");
        tdSql.checkData(1, 0, "(1.5:2]:1");
952
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": 1, "width": 0.5, "count": 1.99999999999999999, "infinity": false}\', 0) from tb;')
953
        tdSql.checkRows(2);
954 955 956
        tdSql.checkData(0, 0, "(1:1.5]:0");
        tdSql.checkData(1, 0, "(1.5:2]:1");

957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 5, "count": 5, "infinity": true}\', 0) from stb;')
        tdSql.checkRows(7);
        tdSql.checkData(0, 0, "(-1.79769e+308:0]:2");
        tdSql.checkData(1, 0, "(0:5]:5");
        tdSql.checkData(2, 0, "(5:10]:5");
        tdSql.checkData(3, 0, "(10:15]:1");
        tdSql.checkData(4, 0, "(15:20]:1");
        tdSql.checkData(5, 0, "(20:25]:0");
        tdSql.checkData(6, 0, "(25:1.79769e+308]:1");
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 5, "count": 5, "infinity": true}\', 0) from ctb;')
        tdSql.checkRows(7);
        tdSql.checkData(0, 0, "(-1.79769e+308:0]:2");
        tdSql.checkData(1, 0, "(0:5]:5");
        tdSql.checkData(2, 0, "(5:10]:5");
        tdSql.checkData(3, 0, "(10:15]:1");
        tdSql.checkData(4, 0, "(15:20]:1");
        tdSql.checkData(5, 0, "(20:25]:0");
        tdSql.checkData(6, 0, "(25:1.79769e+308]:1");
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 5, "count": 5, "infinity": true}\', 0) from tb;')
        tdSql.checkRows(7);
        tdSql.checkData(0, 0, "(-1.79769e+308:0]:2");
        tdSql.checkData(1, 0, "(0:5]:5");
        tdSql.checkData(2, 0, "(5:10]:5");
        tdSql.checkData(3, 0, "(10:15]:1");
        tdSql.checkData(4, 0, "(15:20]:1");
        tdSql.checkData(5, 0, "(20:25]:0");
        tdSql.checkData(6, 0, "(25:1.79769e+308]:1");

        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": -1.76e+308, "width": 5, "count": 1, "infinity": true}\', 0) from stb;')
        tdSql.checkRows(3);
        tdSql.checkData(0, 0, "(-1.79769e+308:-1.76e+308]:0");
        tdSql.checkData(1, 0, "(-1.76e+308:-1.76e+308]:0");
        tdSql.checkData(2, 0, "(-1.76e+308:1.79769e+308]:15");
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": -1.76e+308, "width": 5, "count": 1, "infinity": true}\', 0) from ctb;')
        tdSql.checkRows(3);
        tdSql.checkData(0, 0, "(-1.79769e+308:-1.76e+308]:0");
        tdSql.checkData(1, 0, "(-1.76e+308:-1.76e+308]:0");
        tdSql.checkData(2, 0, "(-1.76e+308:1.79769e+308]:15");
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": -1.76e+308, "width": 5, "count": 1, "infinity": true}\', 0) from tb;')
        tdSql.checkRows(3);
        tdSql.checkData(0, 0, "(-1.79769e+308:-1.76e+308]:0");
        tdSql.checkData(1, 0, "(-1.76e+308:-1.76e+308]:0");
        tdSql.checkData(2, 0, "(-1.76e+308:1.79769e+308]:15");

1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": -0.7e+308, "width": 0.7e+308, "count": 2, "infinity": false}\', 0) from stb;')
        tdSql.checkRows(2);
        tdSql.checkData(0, 0, "(-7e+307:0]:2");
        tdSql.checkData(1, 0, "(0:7e+307]:13");
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": -0.7e+308, "width": 0.7e+308, "count": 2, "infinity": false}\', 0) from ctb;')
        tdSql.checkRows(2);
        tdSql.checkData(0, 0, "(-7e+307:0]:2");
        tdSql.checkData(1, 0, "(0:7e+307]:13");
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": -0.7e+308, "width": 0.7e+308, "count": 2, "infinity": false}\', 0) from tb;')
        tdSql.checkRows(2);
        tdSql.checkData(0, 0, "(-7e+307:0]:2");
        tdSql.checkData(1, 0, "(0:7e+307]:13");

        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": -0.7e+308, "width": 0.7e+308, "count": 2, "infinity": true}\', 0) from stb;')
        tdSql.checkRows(4);
        tdSql.checkData(0, 0, "(-1.79769e+308:-7e+307]:0");
        tdSql.checkData(1, 0, "(-7e+307:0]:2");
        tdSql.checkData(2, 0, "(0:7e+307]:13");
        tdSql.checkData(3, 0, "(7e+307:1.79769e+308]:0");
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": -0.7e+308, "width": 0.7e+308, "count": 2, "infinity": true}\', 0) from ctb;')
        tdSql.checkRows(4);
        tdSql.checkData(0, 0, "(-1.79769e+308:-7e+307]:0");
        tdSql.checkData(1, 0, "(-7e+307:0]:2");
        tdSql.checkData(2, 0, "(0:7e+307]:13");
        tdSql.checkData(3, 0, "(7e+307:1.79769e+308]:0");
        tdSql.query('select histogram(col_tinyint, \'linear_bin\', \'{"start": -0.7e+308, "width": 0.7e+308, "count": 2, "infinity": true}\', 0) from tb;')
        tdSql.checkRows(4);
        tdSql.checkData(0, 0, "(-1.79769e+308:-7e+307]:0");
        tdSql.checkData(1, 0, "(-7e+307:0]:2");
        tdSql.checkData(2, 0, "(0:7e+307]:13");
        tdSql.checkData(3, 0, "(7e+307:1.79769e+308]:0");

        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": true, "width": 5, "count": 5, "infinity": false}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": false, "width": 5, "count": 5, "infinity": false}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": "abc", "width": 5, "count": 5, "infinity": false}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": "中文", "width": 5, "count": 5, "infinity": false}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": abc, "width": 5, "count": 5, "infinity": false}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": -1.80e+308, "width": 5, "count": 5, "infinity": false}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 1.80e+308, "width": 5, "count": 5, "infinity": false}\', 0) from stb;')

        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": true, "count": 5, "infinity": false}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": false, "count": 5, "infinity": false}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": "abc", "count": 5, "infinity": false}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": "中文", "count": 5, "infinity": false}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": abc, "count": 5, "infinity": false}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 0, "count": 5, "infinity": false}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": -1.80e+308, "count": 5, "infinity": false}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1.80e+308, "count": 5, "infinity": false}\', 0) from stb;')
1049

1050 1051 1052 1053 1054 1055 1056 1057 1058 1059
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": -1.4e+308, "width": 1.4e+308, "count": 3, "infinity": false}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": -1.4e+308, "width": 1.4e+308, "count": 3, "infinity": true}\', 0) from stb;')

        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": -1, "infinity": false}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": 0, "infinity": true}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": true, "infinity": true}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": false, "infinity": true}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": "abc", "infinity": true}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": "中文", "infinity": true}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": abc, "infinity": true}\', 0) from stb;')
1060 1061 1062 1063 1064 1065 1066 1067 1068 1069
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": 1.8e+308, "infinity": true}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": -1.8e+308, "infinity": true}\', 0) from stb;')

        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": 1, "infinity": 1}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": 1, "infinity": 0}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": 1, "infinity": -1.5}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": 1, "infinity": 1.8e+308}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": 1, "infinity": "abc"}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": 1, "infinity": "中文"}\', 0) from stb;')
        tdSql.error('select histogram(col_tinyint, \'linear_bin\', \'{"start": 0, "width": 1, "count": 1, "infinity": abc}\', 0) from stb;')
1070

1071 1072 1073 1074 1075 1076 1077 1078 1079
        return
        tdSql.execute('drop database db')
    def stop(self):
        tdSql.close()
        tdLog.success("%s successfully executed" % __file__)


tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())