constant.py 5.1 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
# 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 已提交
85
SMALLINT_UN_MIN         = 0
C
cpwu 已提交
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106

INT_MAX                 = 2147483647
INT_MIN                 = -2147483648

INT_UN_MAX              = 4294967295
INT_UN_MIN              = 0

BIGINT_MAX              = 9223372036854775807
BIGINT_MIN              = -9223372036854775808

BIGINT_UN_MAX           = 18446744073709551615
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 已提交
107 108
NCAHR_LENGTH_MAX       = 4093
DBNAME_LENGTH_MAX      = 64
C
cpwu 已提交
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

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

MNODE_SHM_SIZE_MAX      = 2147483647
MNODE_SHM_SIZE_MIN      = 6292480
MNODE_SHM_SIZE_DEFAULT  = 6292480

VNODE_SHM_SIZE_MAX      = 2147483647
VNODE_SHM_SIZE_MIN      = 6292480
C
cpwu 已提交
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
VNODE_SHM_SIZE_DEFAULT  = 31458304

# 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 已提交
156 157
# session parameters
INTERVAL_MIN = 1 * TIME_MS if PRECISION == PRECISION_DEFAULT else 1 * TIME_US
C
cpwu 已提交
158

C
cpwu 已提交
159

C
cpwu 已提交
160 161 162
# streams and related agg-function
SMA_INDEX_FUNCTIONS = ["MIN", "MAX"]
ROLLUP_FUNCTIONS = ["AVG", "SUM", "MIN", "MAX", "LAST", "FIRST"]
C
cpwu 已提交
163 164 165 166 167 168
SMA_WATMARK_MAXDELAY_INIT = ['a', "s", "m"]
WATERMARK_MAX = 900000
WATERMARK_MIN = 0

MAX_DELAY_MAX = 900000
MAX_DELAY_MIN = 1