diff --git a/src/client/inc/tscLocalMerge.h b/src/client/inc/tscLocalMerge.h
index d38885ab2ee9734ae948e19d4816dcc8a8f73ce6..397a60d140e52d0a9e0e6a67ca57025793ba9cbf 100644
--- a/src/client/inc/tscLocalMerge.h
+++ b/src/client/inc/tscLocalMerge.h
@@ -20,8 +20,8 @@
extern "C" {
#endif
-#include "qextbuffer.h"
-#include "qfill.h"
+#include "qExtbuffer.h"
+#include "qFill.h"
#include "taosmsg.h"
#include "tlosertree.h"
#include "tsclient.h"
diff --git a/src/client/inc/tscUtil.h b/src/client/inc/tscUtil.h
index 786133a8f35ff582d2add90523d5760a20b6398c..590f205e1da87d3bc434f374b6c173905a46c184 100644
--- a/src/client/inc/tscUtil.h
+++ b/src/client/inc/tscUtil.h
@@ -23,11 +23,11 @@ extern "C" {
/*
* @date 2018/09/30
*/
-#include "os.h"
-#include "tbuffer.h"
#include "exception.h"
-#include "qextbuffer.h"
+#include "os.h"
+#include "qExtbuffer.h"
#include "taosdef.h"
+#include "tbuffer.h"
#include "tscLocalMerge.h"
#include "tsclient.h"
diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h
index 3f548c18ca313bbca98710f4bccee4992a6d3320..3b19a475dcd0b157ea551d0729fce6e579fa0320 100644
--- a/src/client/inc/tsclient.h
+++ b/src/client/inc/tsclient.h
@@ -30,9 +30,9 @@ extern "C" {
#include "tsqlfunction.h"
#include "tutil.h"
-#include "qexecutor.h"
+#include "qExecutor.h"
+#include "qTsbuf.h"
#include "qsqlparser.h"
-#include "qtsbuf.h"
#include "tcmdtype.h"
// forward declaration
diff --git a/src/client/src/tscFunctionImpl.c b/src/client/src/tscFunctionImpl.c
index fb15e4efd565e276e0b359e0c93c6b4790e0a38b..72ccd5adc6ee835e9e25f9b9b8b2511cad797910 100644
--- a/src/client/src/tscFunctionImpl.c
+++ b/src/client/src/tscFunctionImpl.c
@@ -14,15 +14,15 @@
*/
#include "os.h"
-#include "qextbuffer.h"
-#include "qfill.h"
-#include "qhistogram.h"
-#include "qpercentile.h"
-#include "qsyntaxtreefunction.h"
-#include "qtsbuf.h"
+#include "qAst.h"
+#include "qExtbuffer.h"
+#include "qFill.h"
+#include "qHistogram.h"
+#include "qPercentile.h"
+#include "qSyntaxtreefunction.h"
+#include "qTsbuf.h"
#include "taosdef.h"
#include "taosmsg.h"
-#include "qast.h"
#include "tscLog.h"
#include "tscSubquery.h"
#include "tscompression.h"
diff --git a/src/client/src/tscLocal.c b/src/client/src/tscLocal.c
index 83700ce0a573ccf15a474a58ec4ebfda2634e2fd..7f336daa91ea621db3c10ccabd2f93c5a76e0fd1 100644
--- a/src/client/src/tscLocal.c
+++ b/src/client/src/tscLocal.c
@@ -16,14 +16,14 @@
#include "os.h"
#include "taosmsg.h"
-#include "tcache.h"
-#include "tscUtil.h"
-#include "tsclient.h"
+#include "qExtbuffer.h"
#include "taosdef.h"
+#include "tcache.h"
+#include "tname.h"
#include "tscLog.h"
-#include "qextbuffer.h"
+#include "tscUtil.h"
#include "tschemautil.h"
-#include "tname.h"
+#include "tsclient.h"
static void tscSetLocalQueryResult(SSqlObj *pSql, const char *val, const char *columnName, int16_t type, size_t valueLength);
diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c
index b97e48644991686c2f2aa6400c2e2b5898702878..09db65a1051abec0c2781169a5605047b550ec8b 100644
--- a/src/client/src/tscSQLParser.c
+++ b/src/client/src/tscSQLParser.c
@@ -18,9 +18,9 @@
#define _DEFAULT_SOURCE
#include "os.h"
+#include "qAst.h"
#include "taos.h"
#include "taosmsg.h"
-#include "qast.h"
#include "tcompare.h"
#include "tname.h"
#include "tscLog.h"
diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c
index 6a14d3a65e33b4f5edf8feafcbb909723bf8bdb2..77584f168c5800610019d24d4c84f504402265ea 100644
--- a/src/client/src/tscSql.c
+++ b/src/client/src/tscSql.c
@@ -15,7 +15,7 @@
#include "hash.h"
#include "os.h"
-#include "qast.h"
+#include "qAst.h"
#include "tcache.h"
#include "tnote.h"
#include "trpc.h"
diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c
index 1dbc52efb0868042b28f4e358c7af0df878e47e8..5d26d09fae1dcc6c947375004703a9e6621ec629 100644
--- a/src/client/src/tscSubquery.c
+++ b/src/client/src/tscSubquery.c
@@ -14,8 +14,8 @@
*/
#include "os.h"
-#include "qtsbuf.h"
-#include "qast.h"
+#include "qAst.h"
+#include "qTsbuf.h"
#include "tcompare.h"
#include "tscLog.h"
#include "tscSubquery.h"
diff --git a/src/client/src/tscUtil.c b/src/client/src/tscUtil.c
index 4e6133663eb0d7d2ae7908eb2622a665e6010008..27f6727339fbd6cb6cf802ab3216572ca2fe8d81 100644
--- a/src/client/src/tscUtil.c
+++ b/src/client/src/tscUtil.c
@@ -13,11 +13,11 @@
* along with this program. If not, see .
*/
-#include "os.h"
-#include "hash.h"
#include "tscUtil.h"
+#include "hash.h"
+#include "os.h"
+#include "qAst.h"
#include "taosmsg.h"
-#include "qast.h"
#include "tcache.h"
#include "tkey.h"
#include "tmd5.h"
diff --git a/src/query/inc/qast.h b/src/query/inc/qAst.h
similarity index 100%
rename from src/query/inc/qast.h
rename to src/query/inc/qAst.h
diff --git a/src/query/inc/qexecutor.h b/src/query/inc/qExecutor.h
similarity index 99%
rename from src/query/inc/qexecutor.h
rename to src/query/inc/qExecutor.h
index 97a7565de8d5dfc88884ccd725141984a7a9cb81..127c38a6f836196641ec1179da680d872e0eac8e 100644
--- a/src/query/inc/qexecutor.h
+++ b/src/query/inc/qExecutor.h
@@ -18,10 +18,10 @@
#include "os.h"
#include "hash.h"
-#include "qfill.h"
-#include "qresultbuf.h"
+#include "qFill.h"
+#include "qResultbuf.h"
+#include "qTsbuf.h"
#include "qsqlparser.h"
-#include "qtsbuf.h"
#include "query.h"
#include "taosdef.h"
#include "tarray.h"
diff --git a/src/query/inc/qextbuffer.h b/src/query/inc/qExtbuffer.h
similarity index 98%
rename from src/query/inc/qextbuffer.h
rename to src/query/inc/qExtbuffer.h
index 2cbef2b1bea66654b262a3fb37061477969960f2..b57c48933f0878ca86384219b1c7f66446db28eb 100644
--- a/src/query/inc/qextbuffer.h
+++ b/src/query/inc/qExtbuffer.h
@@ -28,7 +28,7 @@ extern "C" {
#include "tdataformat.h"
#include "talgo.h"
-#define DEFAULT_PAGE_SIZE (1024L*64) // 16k larger than the SHistoInfo
+#define DEFAULT_PAGE_SIZE (1024L*4) // 16k larger than the SHistoInfo
#define MAX_TMPFILE_PATH_LENGTH PATH_MAX
#define INITIAL_ALLOCATION_BUFFER_SIZE 64
diff --git a/src/query/inc/qfill.h b/src/query/inc/qFill.h
similarity index 99%
rename from src/query/inc/qfill.h
rename to src/query/inc/qFill.h
index ee5974708a1f16161456c582caabd3eceeb6e57e..db6a69c2c5a98b4b6716d4b3ae3890adacb6c2a3 100644
--- a/src/query/inc/qfill.h
+++ b/src/query/inc/qFill.h
@@ -21,8 +21,8 @@ extern "C" {
#endif
#include "os.h"
+#include "qExtbuffer.h"
#include "taosdef.h"
-#include "qextbuffer.h"
typedef struct {
STColumn col; // column info
diff --git a/src/query/inc/qhistogram.h b/src/query/inc/qHistogram.h
similarity index 100%
rename from src/query/inc/qhistogram.h
rename to src/query/inc/qHistogram.h
diff --git a/src/query/inc/qpercentile.h b/src/query/inc/qPercentile.h
similarity index 98%
rename from src/query/inc/qpercentile.h
rename to src/query/inc/qPercentile.h
index c1227dad77d278d9534df229b8a68c2b4f305a54..52f666c338aae175aceb117c2919c2229c2e0cfa 100644
--- a/src/query/inc/qpercentile.h
+++ b/src/query/inc/qPercentile.h
@@ -16,7 +16,7 @@
#ifndef TDENGINE_QPERCENTILE_H
#define TDENGINE_QPERCENTILE_H
-#include "qextbuffer.h"
+#include "qExtbuffer.h"
typedef struct MinMaxEntry {
union {
diff --git a/src/query/inc/qresultbuf.h b/src/query/inc/qResultbuf.h
similarity index 99%
rename from src/query/inc/qresultbuf.h
rename to src/query/inc/qResultbuf.h
index f901474cc1a6f8feeb416fe01f4a96be6e713d90..41fccd177dc7b384b199028a60b17ffafa061cfc 100644
--- a/src/query/inc/qresultbuf.h
+++ b/src/query/inc/qResultbuf.h
@@ -20,9 +20,9 @@
extern "C" {
#endif
-#include "os.h"
-#include "qextbuffer.h"
#include "hash.h"
+#include "os.h"
+#include "qExtbuffer.h"
typedef struct SArray* SIDList;
diff --git a/src/query/inc/qsyntaxtreefunction.h b/src/query/inc/qSyntaxtreefunction.h
similarity index 100%
rename from src/query/inc/qsyntaxtreefunction.h
rename to src/query/inc/qSyntaxtreefunction.h
diff --git a/src/query/inc/qtsbuf.h b/src/query/inc/qTsbuf.h
similarity index 100%
rename from src/query/inc/qtsbuf.h
rename to src/query/inc/qTsbuf.h
diff --git a/src/query/inc/qutil.h b/src/query/inc/qUtil.h
similarity index 100%
rename from src/query/inc/qutil.h
rename to src/query/inc/qUtil.h
diff --git a/src/query/src/qast.c b/src/query/src/qAst.c
similarity index 99%
rename from src/query/src/qast.c
rename to src/query/src/qAst.c
index 42f9f214f5785a76e26904f844f4501c0e4aff0c..c2578c15c0536ea222f376e833a8fe11fa269229 100644
--- a/src/query/src/qast.c
+++ b/src/query/src/qAst.c
@@ -16,17 +16,17 @@
#include "os.h"
-#include "tname.h"
-#include "qast.h"
-#include "tsdb.h"
#include "exception.h"
+#include "qAst.h"
+#include "qSyntaxtreefunction.h"
#include "qsqlparser.h"
-#include "qsyntaxtreefunction.h"
#include "taosdef.h"
#include "taosmsg.h"
#include "tarray.h"
#include "tbuffer.h"
#include "tcompare.h"
+#include "tname.h"
+#include "tsdb.h"
#include "tskiplist.h"
#include "tsqlfunction.h"
#include "tstoken.h"
diff --git a/src/query/src/qexecutor.c b/src/query/src/qExecutor.c
similarity index 99%
rename from src/query/src/qexecutor.c
rename to src/query/src/qExecutor.c
index 9348f702d0242cae6f114d1b84b44bde8811364c..b4f825a7c2ccb6ca1f7f457fba812f6046e6cd77 100644
--- a/src/query/src/qexecutor.c
+++ b/src/query/src/qExecutor.c
@@ -13,19 +13,19 @@
* along with this program. If not, see .
*/
#include "os.h"
+#include "qFill.h"
+#include "taosmsg.h"
#include "tcache.h"
#include "tglobal.h"
-#include "qfill.h"
-#include "taosmsg.h"
#include "exception.h"
#include "hash.h"
-#include "qast.h"
-#include "qexecutor.h"
-#include "qresultbuf.h"
+#include "qAst.h"
+#include "qExecutor.h"
+#include "qResultbuf.h"
+#include "qUtil.h"
#include "query.h"
#include "queryLog.h"
-#include "qutil.h"
#include "tlosertree.h"
#include "tscompression.h"
#include "ttime.h"
diff --git a/src/query/src/qextbuffer.c b/src/query/src/qExtbuffer.c
similarity index 99%
rename from src/query/src/qextbuffer.c
rename to src/query/src/qExtbuffer.c
index afcf90212366cea331ba100d4c4a8974102d5fc5..69c5f0e24fe6361d41953c35fce1380b97d4e752 100644
--- a/src/query/src/qextbuffer.c
+++ b/src/query/src/qExtbuffer.c
@@ -12,16 +12,15 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
+#include "qExtbuffer.h"
#include "os.h"
-#include "tulog.h"
-#include "qextbuffer.h"
+#include "queryLog.h"
#include "taos.h"
#include "taosdef.h"
#include "taosmsg.h"
#include "tsqlfunction.h"
-#include "ttime.h"
+#include "tulog.h"
#include "tutil.h"
-#include "queryLog.h"
#define COLMODEL_GET_VAL(data, schema, allrow, rowId, colId) \
(data + (schema)->pFields[colId].offset * (allrow) + (rowId) * (schema)->pFields[colId].field.bytes)
diff --git a/src/query/src/qfill.c b/src/query/src/qFill.c
similarity index 99%
rename from src/query/src/qfill.c
rename to src/query/src/qFill.c
index 65951a5b9e22786525d6b9f61672853f3be3d93d..9dec2598bc1bcb3a143ae4906718a741624f392a 100644
--- a/src/query/src/qfill.c
+++ b/src/query/src/qFill.c
@@ -13,9 +13,9 @@
* along with this program. If not, see .
*/
+#include "qFill.h"
#include "os.h"
-#include "qfill.h"
-#include "qextbuffer.h"
+#include "qExtbuffer.h"
#include "taosdef.h"
#include "taosmsg.h"
#include "tsqlfunction.h"
diff --git a/src/query/src/qfilterfunc.c b/src/query/src/qFilterfunc.c
similarity index 99%
rename from src/query/src/qfilterfunc.c
rename to src/query/src/qFilterfunc.c
index 6f336434e1d2c03903bdc0a9ef59ff6daa63be11..7e9f5c7da5cf6e7e09ac96d1878bc109fc4812ab 100644
--- a/src/query/src/qfilterfunc.c
+++ b/src/query/src/qFilterfunc.c
@@ -16,7 +16,7 @@
#define _DEFAULT_SOURCE
#include "os.h"
-#include "qexecutor.h"
+#include "qExecutor.h"
#include "taosmsg.h"
#include "tcompare.h"
#include "tsqlfunction.h"
diff --git a/src/query/src/qhistogram.c b/src/query/src/qHistogram.c
similarity index 99%
rename from src/query/src/qhistogram.c
rename to src/query/src/qHistogram.c
index 26482e9f142728f0b097511f98ca2e297e34ef7b..7835d824699c46b2daa4a805ae163b5240f2c4e0 100644
--- a/src/query/src/qhistogram.c
+++ b/src/query/src/qHistogram.c
@@ -14,7 +14,7 @@
*/
#include "os.h"
-#include "qhistogram.h"
+#include "qHistogram.h"
#include "taosdef.h"
#include "taosmsg.h"
#include "tlosertree.h"
diff --git a/src/query/src/qparserImpl.c b/src/query/src/qParserImpl.c
similarity index 100%
rename from src/query/src/qparserImpl.c
rename to src/query/src/qParserImpl.c
diff --git a/src/query/src/qpercentile.c b/src/query/src/qPercentile.c
similarity index 99%
rename from src/query/src/qpercentile.c
rename to src/query/src/qPercentile.c
index dc5ecb796a6eb6e4b8be04aaa35618ae2e5ab532..c4490a01e79408ec2bf09527049082f9c05566c8 100644
--- a/src/query/src/qpercentile.c
+++ b/src/query/src/qPercentile.c
@@ -13,12 +13,12 @@
* along with this program. If not, see .
*/
+#include "qPercentile.h"
#include "os.h"
-#include "tulog.h"
-#include "qpercentile.h"
+#include "queryLog.h"
#include "taosdef.h"
#include "taosmsg.h"
-#include "queryLog.h"
+#include "tulog.h"
tExtMemBuffer *releaseBucketsExceptFor(tMemBucket *pMemBucket, int16_t segIdx, int16_t slotIdx) {
tExtMemBuffer *pBuffer = NULL;
diff --git a/src/query/src/qresultbuf.c b/src/query/src/qResultbuf.c
similarity index 99%
rename from src/query/src/qresultbuf.c
rename to src/query/src/qResultbuf.c
index 646d8b79863ccaaf01aa86d6bbd8505dbf364626..f2194bbfb510c0d654963358c44c4255d8d95f29 100644
--- a/src/query/src/qresultbuf.c
+++ b/src/query/src/qResultbuf.c
@@ -1,6 +1,6 @@
-#include "qresultbuf.h"
+#include "qResultbuf.h"
#include "hash.h"
-#include "qextbuffer.h"
+#include "qExtbuffer.h"
#include "queryLog.h"
#include "taoserror.h"
diff --git a/src/query/src/qsyntaxtreefunction.c b/src/query/src/qSyntaxtreefunction.c
similarity index 99%
rename from src/query/src/qsyntaxtreefunction.c
rename to src/query/src/qSyntaxtreefunction.c
index 5719bb0188d6739d327112631c4a0fc82335fb30..2104edfd910bba1a1701800387545c4f58dfb625 100644
--- a/src/query/src/qsyntaxtreefunction.c
+++ b/src/query/src/qSyntaxtreefunction.c
@@ -15,7 +15,7 @@
#include "os.h"
-#include "qsyntaxtreefunction.h"
+#include "qSyntaxtreefunction.h"
#include "taosdef.h"
#include "tutil.h"
diff --git a/src/query/src/qtokenizer.c b/src/query/src/qTokenizer.c
similarity index 100%
rename from src/query/src/qtokenizer.c
rename to src/query/src/qTokenizer.c
diff --git a/src/query/src/qtsbuf.c b/src/query/src/qTsbuf.c
similarity index 99%
rename from src/query/src/qtsbuf.c
rename to src/query/src/qTsbuf.c
index b84fbded38d8ada4d4f426201ea4f747a062e37e..20b29107f5ebaffb6807223f6e9763496ca668aa 100644
--- a/src/query/src/qtsbuf.c
+++ b/src/query/src/qTsbuf.c
@@ -1,7 +1,7 @@
-#include "qtsbuf.h"
+#include "qTsbuf.h"
+#include "taoserror.h"
#include "tscompression.h"
#include "tutil.h"
-#include "taoserror.h"
static int32_t getDataStartOffset();
static void TSBufUpdateVnodeInfo(STSBuf* pTSBuf, int32_t index, STSVnodeBlockInfo* pBlockInfo);
diff --git a/src/query/src/qutil.c b/src/query/src/qUtil.c
similarity index 99%
rename from src/query/src/qutil.c
rename to src/query/src/qUtil.c
index 4c3595b0be2d26219aadc12892edb4207c88c880..be8447149331ecf3ede4c0873f6ced9c6c385022 100644
--- a/src/query/src/qutil.c
+++ b/src/query/src/qUtil.c
@@ -19,8 +19,8 @@
#include "taosmsg.h"
#include "ttime.h"
-#include "qexecutor.h"
-#include "qutil.h"
+#include "qExecutor.h"
+#include "qUtil.h"
int32_t getOutputInterResultBufSize(SQuery* pQuery) {
int32_t size = 0;
diff --git a/src/query/tests/astTest.cpp b/src/query/tests/astTest.cpp
index df2708721647410e0230a90e689e1c713c8c2592..99f03a7ff8185f8537ebb243e00bce77992db344 100644
--- a/src/query/tests/astTest.cpp
+++ b/src/query/tests/astTest.cpp
@@ -3,8 +3,8 @@
#include
#include
+#include "qAst.h"
#include "taosmsg.h"
-#include "qast.h"
#include "tsdb.h"
#include "tskiplist.h"
diff --git a/src/query/tests/histogramTest.cpp b/src/query/tests/histogramTest.cpp
index c23f0f59241d7bbc7527f7fe332fe97b666acbcc..4a5f7fbbbed18b0a2c2cd7fff7ad3101cfa11c41 100644
--- a/src/query/tests/histogramTest.cpp
+++ b/src/query/tests/histogramTest.cpp
@@ -9,7 +9,7 @@
#include "tstoken.h"
#include "tutil.h"
-#include "qhistogram.h"
+#include "qHistogram.h"
/* test validate the names for table/database */
TEST(testCase, histogram_binary_search) {
diff --git a/src/query/tests/resultBufferTest.cpp b/src/query/tests/resultBufferTest.cpp
index bf6f3bb50fd6886ae1b8dbf853e88dcaa119e10f..f822deeb7351db64a59c4b4e7b493cdd951f4efc 100644
--- a/src/query/tests/resultBufferTest.cpp
+++ b/src/query/tests/resultBufferTest.cpp
@@ -2,7 +2,7 @@
#include
#include
-#include "qresultbuf.h"
+#include "qResultbuf.h"
#include "taos.h"
#include "tsdb.h"
diff --git a/src/query/tests/tsBufTest.cpp b/src/query/tests/tsBufTest.cpp
index f81326195778a68259c96e06f713f968be597fd0..e9827518e189a078c6f7cba421a3e9b82f199a40 100644
--- a/src/query/tests/tsBufTest.cpp
+++ b/src/query/tests/tsBufTest.cpp
@@ -5,10 +5,10 @@
#include "taos.h"
#include "tsdb.h"
+#include "qTsbuf.h"
#include "tstoken.h"
#include "ttime.h"
#include "tutil.h"
-#include "qtsbuf.h"
namespace {
/**