support outputtype

This commit is contained in:
dapan1121 2021-03-15 13:53:16 +08:00
parent b59f6c180f
commit c47646d2b0
6 changed files with 1155 additions and 1147 deletions

View File

@ -100,137 +100,139 @@
#define TK_IF 81 #define TK_IF 81
#define TK_EXISTS 82 #define TK_EXISTS 82
#define TK_AS 83 #define TK_AS 83
#define TK_PPS 84 #define TK_OUTPUTTYPE 84
#define TK_TSERIES 85 #define TK_PPS 85
#define TK_DBS 86 #define TK_TSERIES 86
#define TK_STORAGE 87 #define TK_DBS 87
#define TK_QTIME 88 #define TK_STORAGE 88
#define TK_CONNS 89 #define TK_QTIME 89
#define TK_STATE 90 #define TK_CONNS 90
#define TK_KEEP 91 #define TK_STATE 91
#define TK_CACHE 92 #define TK_KEEP 92
#define TK_REPLICA 93 #define TK_CACHE 93
#define TK_QUORUM 94 #define TK_REPLICA 94
#define TK_DAYS 95 #define TK_QUORUM 95
#define TK_MINROWS 96 #define TK_DAYS 96
#define TK_MAXROWS 97 #define TK_MINROWS 97
#define TK_BLOCKS 98 #define TK_MAXROWS 98
#define TK_CTIME 99 #define TK_BLOCKS 99
#define TK_WAL 100 #define TK_CTIME 100
#define TK_FSYNC 101 #define TK_WAL 101
#define TK_COMP 102 #define TK_FSYNC 102
#define TK_PRECISION 103 #define TK_COMP 103
#define TK_UPDATE 104 #define TK_PRECISION 104
#define TK_CACHELAST 105 #define TK_UPDATE 105
#define TK_PARTITIONS 106 #define TK_CACHELAST 106
#define TK_LP 107 #define TK_PARTITIONS 107
#define TK_RP 108 #define TK_LP 108
#define TK_UNSIGNED 109 #define TK_RP 109
#define TK_TAGS 110 #define TK_UNSIGNED 110
#define TK_USING 111 #define TK_TAGS 111
#define TK_COMMA 112 #define TK_USING 112
#define TK_NULL 113 #define TK_COMMA 113
#define TK_SELECT 114 #define TK_NULL 114
#define TK_UNION 115 #define TK_SELECT 115
#define TK_ALL 116 #define TK_UNION 116
#define TK_DISTINCT 117 #define TK_ALL 117
#define TK_FROM 118 #define TK_DISTINCT 118
#define TK_VARIABLE 119 #define TK_FROM 119
#define TK_INTERVAL 120 #define TK_VARIABLE 120
#define TK_FILL 121 #define TK_INTERVAL 121
#define TK_SLIDING 122 #define TK_FILL 122
#define TK_ORDER 123 #define TK_SLIDING 123
#define TK_BY 124 #define TK_ORDER 124
#define TK_ASC 125 #define TK_BY 125
#define TK_DESC 126 #define TK_ASC 126
#define TK_GROUP 127 #define TK_DESC 127
#define TK_HAVING 128 #define TK_GROUP 128
#define TK_LIMIT 129 #define TK_HAVING 129
#define TK_OFFSET 130 #define TK_LIMIT 130
#define TK_SLIMIT 131 #define TK_OFFSET 131
#define TK_SOFFSET 132 #define TK_SLIMIT 132
#define TK_WHERE 133 #define TK_SOFFSET 133
#define TK_NOW 134 #define TK_WHERE 134
#define TK_RESET 135 #define TK_NOW 135
#define TK_QUERY 136 #define TK_RESET 136
#define TK_ADD 137 #define TK_QUERY 137
#define TK_COLUMN 138 #define TK_ADD 138
#define TK_TAG 139 #define TK_COLUMN 139
#define TK_CHANGE 140 #define TK_TAG 140
#define TK_SET 141 #define TK_CHANGE 141
#define TK_KILL 142 #define TK_SET 142
#define TK_CONNECTION 143 #define TK_KILL 143
#define TK_STREAM 144 #define TK_CONNECTION 144
#define TK_COLON 145 #define TK_STREAM 145
#define TK_ABORT 146 #define TK_COLON 146
#define TK_AFTER 147 #define TK_ABORT 147
#define TK_ATTACH 148 #define TK_AFTER 148
#define TK_BEFORE 149 #define TK_ATTACH 149
#define TK_BEGIN 150 #define TK_BEFORE 150
#define TK_CASCADE 151 #define TK_BEGIN 151
#define TK_CLUSTER 152 #define TK_CASCADE 152
#define TK_CONFLICT 153 #define TK_CLUSTER 153
#define TK_COPY 154 #define TK_CONFLICT 154
#define TK_DEFERRED 155 #define TK_COPY 155
#define TK_DELIMITERS 156 #define TK_DEFERRED 156
#define TK_DETACH 157 #define TK_DELIMITERS 157
#define TK_EACH 158 #define TK_DETACH 158
#define TK_END 159 #define TK_EACH 159
#define TK_EXPLAIN 160 #define TK_END 160
#define TK_FAIL 161 #define TK_EXPLAIN 161
#define TK_FOR 162 #define TK_FAIL 162
#define TK_IGNORE 163 #define TK_FOR 163
#define TK_IMMEDIATE 164 #define TK_IGNORE 164
#define TK_INITIALLY 165 #define TK_IMMEDIATE 165
#define TK_INSTEAD 166 #define TK_INITIALLY 166
#define TK_MATCH 167 #define TK_INSTEAD 167
#define TK_KEY 168 #define TK_MATCH 168
#define TK_OF 169 #define TK_KEY 169
#define TK_RAISE 170 #define TK_OF 170
#define TK_REPLACE 171 #define TK_RAISE 171
#define TK_RESTRICT 172 #define TK_REPLACE 172
#define TK_ROW 173 #define TK_RESTRICT 173
#define TK_STATEMENT 174 #define TK_ROW 174
#define TK_TRIGGER 175 #define TK_STATEMENT 175
#define TK_VIEW 176 #define TK_TRIGGER 176
#define TK_COUNT 177 #define TK_VIEW 177
#define TK_SUM 178 #define TK_COUNT 178
#define TK_AVG 179 #define TK_SUM 179
#define TK_MIN 180 #define TK_AVG 180
#define TK_MAX 181 #define TK_MIN 181
#define TK_FIRST 182 #define TK_MAX 182
#define TK_LAST 183 #define TK_FIRST 183
#define TK_TOP 184 #define TK_LAST 184
#define TK_BOTTOM 185 #define TK_TOP 185
#define TK_STDDEV 186 #define TK_BOTTOM 186
#define TK_PERCENTILE 187 #define TK_STDDEV 187
#define TK_APERCENTILE 188 #define TK_PERCENTILE 188
#define TK_LEASTSQUARES 189 #define TK_APERCENTILE 189
#define TK_HISTOGRAM 190 #define TK_LEASTSQUARES 190
#define TK_DIFF 191 #define TK_HISTOGRAM 191
#define TK_SPREAD 192 #define TK_DIFF 192
#define TK_TWA 193 #define TK_SPREAD 193
#define TK_INTERP 194 #define TK_TWA 194
#define TK_LAST_ROW 195 #define TK_INTERP 195
#define TK_RATE 196 #define TK_LAST_ROW 196
#define TK_IRATE 197 #define TK_RATE 197
#define TK_SUM_RATE 198 #define TK_IRATE 198
#define TK_SUM_IRATE 199 #define TK_SUM_RATE 199
#define TK_AVG_RATE 200 #define TK_SUM_IRATE 200
#define TK_AVG_IRATE 201 #define TK_AVG_RATE 201
#define TK_TBID 202 #define TK_AVG_IRATE 202
#define TK_SEMI 203 #define TK_TBID 203
#define TK_NONE 204 #define TK_SEMI 204
#define TK_PREV 205 #define TK_NONE 205
#define TK_LINEAR 206 #define TK_PREV 206
#define TK_IMPORT 207 #define TK_LINEAR 207
#define TK_METRIC 208 #define TK_IMPORT 208
#define TK_TBNAME 209 #define TK_METRIC 209
#define TK_JOIN 210 #define TK_TBNAME 210
#define TK_METRICS 211 #define TK_JOIN 211
#define TK_INSERT 212 #define TK_METRICS 212
#define TK_INTO 213 #define TK_INSERT 213
#define TK_VALUES 214 #define TK_INTO 214
#define TK_VALUES 215

View File

@ -132,6 +132,7 @@ typedef struct SCreateDbInfo {
typedef struct SCreateFuncInfo { typedef struct SCreateFuncInfo {
SStrToken name; SStrToken name;
SStrToken path; SStrToken path;
TAOS_FIELD output;
} SCreateFuncInfo; } SCreateFuncInfo;

View File

@ -194,7 +194,7 @@ cmd ::= CREATE ACCOUNT ids(X) PASS ids(Y) acct_optr(Z).
{ setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &X, &Y, &Z);} { setCreateAcctSql(pInfo, TSDB_SQL_CREATE_ACCT, &X, &Y, &Z);}
cmd ::= CREATE DATABASE ifnotexists(Z) ids(X) db_optr(Y). { setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &X, &Y, &Z);} cmd ::= CREATE DATABASE ifnotexists(Z) ids(X) db_optr(Y). { setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &X, &Y, &Z);}
cmd ::= CREATE TOPIC ifnotexists(Z) ids(X) topic_optr(Y). { setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &X, &Y, &Z);} cmd ::= CREATE TOPIC ifnotexists(Z) ids(X) topic_optr(Y). { setCreateDbInfo(pInfo, TSDB_SQL_CREATE_DB, &X, &Y, &Z);}
cmd ::= CREATE FUNCTION ids(X) AS ids(Y). { setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &X, &Y);} cmd ::= CREATE FUNCTION ids(X) AS ids(Y) OUTPUTTYPE typename(Z). { setCreateFuncInfo(pInfo, TSDB_SQL_CREATE_FUNCTION, &X, &Y, &Z);}
cmd ::= CREATE USER ids(X) PASS ids(Y). { setCreateUserSql(pInfo, &X, &Y);} cmd ::= CREATE USER ids(X) PASS ids(Y). { setCreateUserSql(pInfo, &X, &Y);}
pps(Y) ::= . { Y.n = 0; } pps(Y) ::= . { Y.n = 0; }

View File

@ -866,7 +866,7 @@ void setCreateDbInfo(SSqlInfo *pInfo, int32_t type, SStrToken *pToken, SCreateDb
pInfo->pMiscInfo->dbOpt.ignoreExists = pIgExists->n; // sql.y has: ifnotexists(X) ::= IF NOT EXISTS. {X.n = 1;} pInfo->pMiscInfo->dbOpt.ignoreExists = pIgExists->n; // sql.y has: ifnotexists(X) ::= IF NOT EXISTS. {X.n = 1;}
} }
void setCreateFuncInfo(SSqlInfo *pInfo, int32_t type, SStrToken *pName, SStrToken *pPath) { void setCreateFuncInfo(SSqlInfo *pInfo, int32_t type, SStrToken *pName, SStrToken *pPath, TAOS_FIELD *output) {
pInfo->type = type; pInfo->type = type;
if (pInfo->pMiscInfo == NULL) { if (pInfo->pMiscInfo == NULL) {
pInfo->pMiscInfo = calloc(1, sizeof(SMiscInfo)); pInfo->pMiscInfo = calloc(1, sizeof(SMiscInfo));
@ -874,6 +874,7 @@ void setCreateFuncInfo(SSqlInfo *pInfo, int32_t type, SStrToken *pName, SStrToke
pInfo->pMiscInfo->funcOpt.name = *pName; pInfo->pMiscInfo->funcOpt.name = *pName;
pInfo->pMiscInfo->funcOpt.path = *pPath; pInfo->pMiscInfo->funcOpt.path = *pPath;
pInfo->pMiscInfo->funcOpt.output = *output;
} }

View File

@ -245,7 +245,8 @@ static SKeyword keywordTable[] = {
{"TOPIC", TK_TOPIC}, {"TOPIC", TK_TOPIC},
{"TOPICS", TK_TOPICS}, {"TOPICS", TK_TOPICS},
{"FUNCTION", TK_FUNCTION}, {"FUNCTION", TK_FUNCTION},
{"FUNCTIONS", TK_FUNCTIONS} {"FUNCTIONS", TK_FUNCTIONS},
{"OUTPUTTYPE", TK_OUTPUTTYPE}
}; };
static const char isIdChar[] = { static const char isIdChar[] = {

File diff suppressed because it is too large Load Diff