constant.py 5.9 KB
Newer Older
C
cpwu 已提交
1 2
# -*- coding: utf-8 -*-

C
cpwu 已提交
3 4 5 6 7 8 9 10 11
# basic type
TAOS_DATA_TYPE  = [
    "INT", "BIGINT", "SMALLINT", "TINYINT", "INT UNSIGNED", "BIGINT UNSIGNED", "SMALLINT UNSIGNED", "TINYINT UNSIGNED",
    "FLOAT", "DOUBLE",
    "BOOL",
    "BINARY", "NCHAR", "VARCHAR",
    "TIMESTAMP",
    # "MEDIUMBLOB", "BLOB", # add in 3.x
    # "DECIMAL", "NUMERIC", # add in 3.x
C
cpwu 已提交
12
    "JSON", # only for tag
C
cpwu 已提交
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
]

TAOS_NUM_TYPE   = [
    "INT", "BIGINT", "SMALLINT", "TINYINT", "INT UNSIGNED", "BIGINT UNSIGNED", "SMALLINT UNSIGNED", "TINYINT UNSIGNED", "FLOAT", "DOUBLE",
    # "DECIMAL", "NUMERIC", # add in 3.x
]
TAOS_CHAR_TYPE  = [
    "BINARY", "NCHAR", "VARCHAR",
]
TAOS_BOOL_TYPE  = ["BOOL",]
TAOS_TS_TYPE    = ["TIMESTAMP",]
TAOS_BIN_TYPE   = [
    "MEDIUMBLOB", "BLOB", # add in 3.x
]

C
cpwu 已提交
28 29
TAOS_TIME_INIT = ["b", "u", "a", "s", "m", "h", "d", "w", "n", "y"]
TAOS_PRECISION = ["ms", "us", "ns"]
C
cpwu 已提交
30 31
PRECISION_DEFAULT = "ms"
PRECISION = PRECISION_DEFAULT
C
cpwu 已提交
32

C
cpwu 已提交
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 60 61 62 63 64 65 66 67 68 69 70 71 72 73
TAOS_KEYWORDS = [
    "ABORT",		"CREATE",		"IGNORE",		"NULL",			"STAR",
    "ACCOUNT",		"CTIME",		"IMMEDIATE",	"OF",			"STATE",
    "ACCOUNTS",		"DATABASE",		"IMPORT",		"OFFSET",		"STATEMENT",
    "ADD",			"DATABASES",	"IN",			"OR",			"STATE_WINDOW",
    "AFTER",		"DAYS",			"INITIALLY",	"ORDER",		"STORAGE",
    "ALL",			"DBS",			"INSERT",		"PARTITIONS",	"STREAM",
    "ALTER",		"DEFERRED",		"INSTEAD",		"PASS",			"STREAMS",
    "AND",			"DELIMITERS",	"INT",			"PLUS",			"STRING",
    "AS",			"DESC",			"INTEGER",		"PPS",			"SYNCDB",
    "ASC",			"DESCRIBE",		"INTERVAL",		"PRECISION",	"TABLE",
    "ATTACH",		"DETACH",		"INTO",			"PREV",			"TABLES",
    "BEFORE",		"DISTINCT", 	"IS",			"PRIVILEGE",	"TAG",
    "BEGIN",		"DIVIDE",		"ISNULL",		"QTIME",		"TAGS",
    "BETWEEN",		"DNODE",		"JOIN",			"QUERIES",		"TBNAME",
    "BIGINT",		"DNODES",		"KEEP",			"QUERY",		"TIMES",
    "BINARY",		"DOT",			"KEY",			"QUORUM",		"TIMESTAMP",
    "BITAND",		"DOUBLE",		"KILL",			"RAISE",		"TINYINT",
    "BITNOT",		"DROP",			"LE",			"REM",			"TOPIC",
    "BITOR",		"EACH",			"LIKE",			"REPLACE",		"TOPICS",
    "BLOCKS",		"END",			"LIMIT",		"REPLICA",		"TRIGGER",
    "BOOL",			"EQ",			"LINEAR",		"RESET",		"TSERIES",
    "BY",			"EXISTS",		"LOCAL",		"RESTRICT",		"UMINUS",
    "CACHE",		"EXPLAIN",		"LP",			"ROW",			"UNION",
    "CACHELAST",	"FAIL",			"LSHIFT",		"RP",			"UNSIGNED",
    "CASCADE",		"FILE",			"LT",			"RSHIFT",		"UPDATE",
    "CHANGE",		"FILL",			"MATCH",		"SCORES",		"UPLUS",
    "CLUSTER",		"FLOAT",		"MAXROWS",		"SELECT",		"USE",
    "COLON",		"FOR",			"MINROWS",		"SEMI",			"USER",
    "COLUMN",		"FROM",			"MINUS",		"SESSION",		"USERS",
    "COMMA",		"FSYNC",		"MNODES",		"SET",			"USING",
    "COMP",			"GE",			"MODIFY",		"SHOW",			"VALUES",
    "COMPACT",		"GLOB",			"MODULES",		"SLASH",		"VARIABLE",
    "CONCAT",		"GRANTS",		"NCHAR",		"SLIDING",		"VARIABLES",
    "CONFLICT",		"GROUP",		"NE",			"SLIMIT",		"VGROUPS",
    "CONNECTION",	"GT",			"NONE",			"SMALLINT",		"VIEW",
    "CONNECTIONS",	"HAVING",		"NOT",			"SOFFSET",		"VNODES",
    "CONNS",		"ID",			"NOTNULL",		"STABLE",		"WAL",
    "COPY",			"IF",			"NOW",			"STABLES",		"WHERE",
]

C
cpwu 已提交
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
NUM_FUNC = [
    "ABS", "ACOS", "ASIN", "ATAN", "CEIL", "COS", "FLOOR", "LOG", "POW", "ROUND", "SIN", "SQRT", "TAN",
]

STR_FUNC = [
    "CHAR_LENGTH", "CONCAT", "CONCAT_WS", "LENGTH", "LOWER","LTRIM", "RTRIM", "SUBSTR", "UPPER",
]

CONVER_FUNC = ["CASR", "TO_ISO8601", "TO_JSON", "TP_UNIXTIMESTAMP"]

SELECT_FUNC = [
    "APERCENTILE", "BOTTOM", "FIRST", "INTERP", "LAST", "MAX", "MIN", "PERCENTILE", "TAIL", "TOP", "UNIQUE",
]

AGG_FUNC = [
    "AVG", "COUNT", "ELAPSED", "LEASTSQUARES", "MODE", "SPREAD", "STDDEV", "SUM", "HYPERLOGLOG", "HISTOGRAM",
]

TS_FUNC = [
    "CSUM", "DERIVATIVE", "DIFF", "IRATE", "MAVG", "SAMPLE", "STATECOUNT", "STATEDURATION", "TWA"
]

C
cpwu 已提交
96
SYSINFO_FUNC = [
C
cpwu 已提交
97 98 99 100 101
    "DATABASE", "CLIENT_VERSION", "SERVER_VERSION", "SERVER_STATUS", "CURRENT_USER", "USER"
]



C
cpwu 已提交
102 103 104 105 106 107 108 109 110 111 112
# basic data type boundary
TINYINT_MAX             = 127
TINYINT_MIN             = -128

TINYINT_UN_MAX          = 255
TINYINT_UN_MIN          = 0

SMALLINT_MAX            = 32767
SMALLINT_MIN            = -32768

SMALLINT_UN_MAX         = 65535
C
cpwu 已提交
113
SMALLINT_UN_MIN         = 0
C
cpwu 已提交
114

C
cpwu 已提交
115 116
INT_MAX                 = 2_147_483_647
INT_MIN                 = -2_147_483_648
C
cpwu 已提交
117

C
cpwu 已提交
118
INT_UN_MAX              = 4_294_967_295
C
cpwu 已提交
119 120
INT_UN_MIN              = 0

C
cpwu 已提交
121 122
BIGINT_MAX              = 9_223_372_036_854_775_807
BIGINT_MIN              = -9_223_372_036_854_775_808
C
cpwu 已提交
123

C
cpwu 已提交
124
BIGINT_UN_MAX           = 18_446_744_073_709_551_615
C
cpwu 已提交
125 126 127 128 129 130 131 132 133 134
BIGINT_UN_MIN           = 0

FLOAT_MAX               = 3.40E+38
FLOAT_MIN               = -3.40E+38

DOUBLE_MAX              = 1.7E+308
DOUBLE_MIN              = -1.7E+308

# schema boundary
BINARY_LENGTH_MAX       = 16374
C
cpwu 已提交
135 136
NCAHR_LENGTH_MAX       = 4093
DBNAME_LENGTH_MAX      = 64
C
cpwu 已提交
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

STBNAME_LENGTH_MAX      = 192
STBNAME_LENGTH_MIN      = 1

TBNAME_LENGTH_MAX       = 192
TBNAME_LENGTH_MIN       = 1

CHILD_TBNAME_LENGTH_MAX = 192
CHILD_TBNAME_LENGTH_MIN = 1

TAG_NAME_LENGTH_MAX     = 64
TAG_NAME_LENGTH_MIN     = 1

COL_NAME_LENGTH_MAX     = 64
COL_NAME_LENGTH_MIN     = 1

TAG_COUNT_MAX           = 128
TAG_COUNT_MIN           = 1

COL_COUNT_MAX           = 4096
COL_COUNT_MIN           = 2

TAG_COL_COUNT_MAX       = 4096
TAG_COL_COUNT_MIN       = 3

C
cpwu 已提交
162 163 164
MNODE_SHM_SIZE_MAX      = 2_147_483_647
MNODE_SHM_SIZE_MIN      = 6_292_480
MNODE_SHM_SIZE_DEFAULT  = 6_292_480
C
cpwu 已提交
165

C
cpwu 已提交
166 167 168
VNODE_SHM_SIZE_MAX      = 2_147_483_647
VNODE_SHM_SIZE_MIN      = 6_292_480
VNODE_SHM_SIZE_DEFAULT  = 31_458_304
C
cpwu 已提交
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183

# time_init
TIME_MS = 1
TIME_US = TIME_MS/1000
TIME_NS = TIME_US/1000

TIME_S = 1000 * TIME_MS
TIME_M = 60 * TIME_S
TIME_H = 60 * TIME_M
TIME_D = 24 * TIME_H
TIME_W = 7 * TIME_D
TIME_N = 30 * TIME_D
TIME_Y = 365 * TIME_D


C
cpwu 已提交
184 185
# session parameters
INTERVAL_MIN = 1 * TIME_MS if PRECISION == PRECISION_DEFAULT else 1 * TIME_US
C
cpwu 已提交
186

C
cpwu 已提交
187

C
cpwu 已提交
188 189 190
# streams and related agg-function
SMA_INDEX_FUNCTIONS = ["MIN", "MAX"]
ROLLUP_FUNCTIONS = ["AVG", "SUM", "MIN", "MAX", "LAST", "FIRST"]
C
cpwu 已提交
191
BLOCK_FUNCTIONS = ["SUM", "MIN", "MAX"]
C
cpwu 已提交
192 193 194 195 196 197
SMA_WATMARK_MAXDELAY_INIT = ['a', "s", "m"]
WATERMARK_MAX = 900000
WATERMARK_MIN = 0

MAX_DELAY_MAX = 900000
MAX_DELAY_MIN = 1