Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
7068d1ff
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7068d1ff
编写于
7月 12, 2017
作者:
A
Alexey Milovidov
提交者:
alexey-milovidov
7月 13, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Using lexer (incomplete) [#CLICKHOUSE-2].
上级
de75fa00
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
88 addition
and
391 deletion
+88
-391
dbms/src/DataStreams/tests/block_row_transforms.cpp
dbms/src/DataStreams/tests/block_row_transforms.cpp
+4
-7
dbms/src/DataStreams/tests/block_tab_separated_streams.cpp
dbms/src/DataStreams/tests/block_tab_separated_streams.cpp
+60
-60
dbms/src/DataTypes/tests/data_type_string.cpp
dbms/src/DataTypes/tests/data_type_string.cpp
+4
-4
dbms/src/IO/tests/hashing_read_buffer.cpp
dbms/src/IO/tests/hashing_read_buffer.cpp
+0
-4
dbms/src/IO/tests/read_buffer.cpp
dbms/src/IO/tests/read_buffer.cpp
+3
-4
dbms/src/IO/tests/read_buffer_perf.cpp
dbms/src/IO/tests/read_buffer_perf.cpp
+2
-3
dbms/src/IO/tests/read_float_perf.cpp
dbms/src/IO/tests/read_float_perf.cpp
+2
-3
dbms/src/Interpreters/tests/CMakeLists.txt
dbms/src/Interpreters/tests/CMakeLists.txt
+0
-3
dbms/src/Interpreters/tests/expression_analyzer.cpp
dbms/src/Interpreters/tests/expression_analyzer.cpp
+0
-158
dbms/src/Interpreters/tests/select_query.cpp
dbms/src/Interpreters/tests/select_query.cpp
+4
-4
dbms/src/Parsers/tests/lexer.cpp
dbms/src/Parsers/tests/lexer.cpp
+3
-3
dbms/src/Server/Client.cpp
dbms/src/Server/Client.cpp
+2
-2
dbms/src/Storages/tests/CMakeLists.txt
dbms/src/Storages/tests/CMakeLists.txt
+0
-3
dbms/src/Storages/tests/hit_log.cpp
dbms/src/Storages/tests/hit_log.cpp
+4
-4
dbms/src/Storages/tests/merge_tree.cpp
dbms/src/Storages/tests/merge_tree.cpp
+0
-129
未找到文件。
dbms/src/DataStreams/tests/block_row_transforms.cpp
浏览文件 @
7068d1ff
...
...
@@ -6,8 +6,8 @@
#include <Core/Block.h>
#include <Core/ColumnWithTypeAndName.h>
#include <IO/ReadBufferFrom
IStream
.h>
#include <IO/WriteBufferFrom
OStream
.h>
#include <IO/ReadBufferFrom
File
.h>
#include <IO/WriteBufferFrom
File
.h>
#include <DataTypes/DataTypesNumber.h>
#include <DataTypes/DataTypeString.h>
...
...
@@ -38,11 +38,8 @@ try
col2
.
column
=
col2
.
type
->
createColumn
();
sample
.
insert
(
col2
);
std
::
ifstream
istr
(
"test_in"
);
std
::
ofstream
ostr
(
"test_out"
);
ReadBufferFromIStream
in_buf
(
istr
);
WriteBufferFromOStream
out_buf
(
ostr
);
ReadBufferFromFile
in_buf
(
"test_in"
);
WriteBufferFromFile
out_buf
(
"test_out"
);
RowInputStreamPtr
row_input
=
std
::
make_shared
<
TabSeparatedRowInputStream
>
(
in_buf
,
sample
);
BlockInputStreamFromRowInputStream
block_input
(
row_input
,
sample
,
DEFAULT_INSERT_BLOCK_SIZE
,
0
,
0
);
...
...
dbms/src/DataStreams/tests/block_tab_separated_streams.cpp
浏览文件 @
7068d1ff
...
...
@@ -2,8 +2,8 @@
#include <list>
#include <iostream>
#include <IO/ReadBufferFrom
IStream
.h>
#include <IO/WriteBufferFrom
OStream
.h>
#include <IO/ReadBufferFrom
FileDescriptor
.h>
#include <IO/WriteBufferFrom
FileDescriptor
.h>
#include <DataTypes/DataTypesNumber.h>
#include <DataTypes/DataTypeString.h>
...
...
@@ -26,62 +26,62 @@ try
{
NamesAndTypesList
names_and_types_list
{
{
"WatchID"
,
std
::
make_shared
<
DataTypeUInt64
>
()},
{
"JavaEnable"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"Title"
,
std
::
make_shared
<
DataTypeString
>
()},
{
"EventTime"
,
std
::
make_shared
<
DataTypeDateTime
>
()},
{
"CounterID"
,
std
::
make_shared
<
DataTypeUInt32
>
()},
{
"ClientIP"
,
std
::
make_shared
<
DataTypeUInt32
>
()},
{
"RegionID"
,
std
::
make_shared
<
DataTypeUInt32
>
()},
{
"UniqID"
,
std
::
make_shared
<
DataTypeUInt64
>
()},
{
"CounterClass"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"OS"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"UserAgent"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"URL"
,
std
::
make_shared
<
DataTypeString
>
()},
{
"Referer"
,
std
::
make_shared
<
DataTypeString
>
()},
{
"ResolutionWidth"
,
std
::
make_shared
<
DataTypeUInt16
>
()},
{
"ResolutionHeight"
,
std
::
make_shared
<
DataTypeUInt16
>
()},
{
"ResolutionDepth"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"FlashMajor"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"FlashMinor"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"FlashMinor2"
,
std
::
make_shared
<
DataTypeString
>
()},
{
"NetMajor"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"NetMinor"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"UserAgentMajor"
,
std
::
make_shared
<
DataTypeUInt16
>
()},
{
"UserAgentMinor"
,
std
::
make_shared
<
DataTypeFixedString
>
(
2
)},
{
"CookieEnable"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"JavascriptEnable"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"IsMobile"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"MobilePhone"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"MobilePhoneModel"
,
std
::
make_shared
<
DataTypeString
>
()},
{
"Params"
,
std
::
make_shared
<
DataTypeString
>
()},
{
"IPNetworkID"
,
std
::
make_shared
<
DataTypeUInt32
>
()},
{
"TraficSourceID"
,
std
::
make_shared
<
DataTypeInt8
>
()},
{
"SearchEngineID"
,
std
::
make_shared
<
DataTypeUInt16
>
()},
{
"SearchPhrase"
,
std
::
make_shared
<
DataTypeString
>
()},
{
"AdvEngineID"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"IsArtifical"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"WindowClientWidth"
,
std
::
make_shared
<
DataTypeUInt16
>
()},
{
"WindowClientHeight"
,
std
::
make_shared
<
DataTypeUInt16
>
()},
{
"ClientTimeZone"
,
std
::
make_shared
<
DataTypeInt16
>
()},
{
"ClientEventTime"
,
std
::
make_shared
<
DataTypeDateTime
>
()},
{
"SilverlightVersion1"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"SilverlightVersion2"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"SilverlightVersion3"
,
std
::
make_shared
<
DataTypeUInt32
>
()},
{
"SilverlightVersion4"
,
std
::
make_shared
<
DataTypeUInt16
>
()},
{
"PageCharset"
,
std
::
make_shared
<
DataTypeString
>
()},
{
"CodeVersion"
,
std
::
make_shared
<
DataTypeUInt32
>
()},
{
"IsLink"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"IsDownload"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"IsNotBounce"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"FUniqID"
,
std
::
make_shared
<
DataTypeUInt64
>
()},
{
"OriginalURL"
,
std
::
make_shared
<
DataTypeString
>
()},
{
"HID"
,
std
::
make_shared
<
DataTypeUInt32
>
()},
{
"IsOldCounter"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"IsEvent"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"IsParameter"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"DontCountHits"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"WithHash"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"WatchID"
,
std
::
make_shared
<
DataTypeUInt64
>
()},
{
"JavaEnable"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"Title"
,
std
::
make_shared
<
DataTypeString
>
()},
{
"EventTime"
,
std
::
make_shared
<
DataTypeDateTime
>
()},
{
"CounterID"
,
std
::
make_shared
<
DataTypeUInt32
>
()},
{
"ClientIP"
,
std
::
make_shared
<
DataTypeUInt32
>
()},
{
"RegionID"
,
std
::
make_shared
<
DataTypeUInt32
>
()},
{
"UniqID"
,
std
::
make_shared
<
DataTypeUInt64
>
()},
{
"CounterClass"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"OS"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"UserAgent"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"URL"
,
std
::
make_shared
<
DataTypeString
>
()},
{
"Referer"
,
std
::
make_shared
<
DataTypeString
>
()},
{
"ResolutionWidth"
,
std
::
make_shared
<
DataTypeUInt16
>
()},
{
"ResolutionHeight"
,
std
::
make_shared
<
DataTypeUInt16
>
()},
{
"ResolutionDepth"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"FlashMajor"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"FlashMinor"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"FlashMinor2"
,
std
::
make_shared
<
DataTypeString
>
()},
{
"NetMajor"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"NetMinor"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"UserAgentMajor"
,
std
::
make_shared
<
DataTypeUInt16
>
()},
{
"UserAgentMinor"
,
std
::
make_shared
<
DataTypeFixedString
>
(
2
)},
{
"CookieEnable"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"JavascriptEnable"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"IsMobile"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"MobilePhone"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"MobilePhoneModel"
,
std
::
make_shared
<
DataTypeString
>
()},
{
"Params"
,
std
::
make_shared
<
DataTypeString
>
()},
{
"IPNetworkID"
,
std
::
make_shared
<
DataTypeUInt32
>
()},
{
"TraficSourceID"
,
std
::
make_shared
<
DataTypeInt8
>
()},
{
"SearchEngineID"
,
std
::
make_shared
<
DataTypeUInt16
>
()},
{
"SearchPhrase"
,
std
::
make_shared
<
DataTypeString
>
()},
{
"AdvEngineID"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"IsArtifical"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"WindowClientWidth"
,
std
::
make_shared
<
DataTypeUInt16
>
()},
{
"WindowClientHeight"
,
std
::
make_shared
<
DataTypeUInt16
>
()},
{
"ClientTimeZone"
,
std
::
make_shared
<
DataTypeInt16
>
()},
{
"ClientEventTime"
,
std
::
make_shared
<
DataTypeDateTime
>
()},
{
"SilverlightVersion1"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"SilverlightVersion2"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"SilverlightVersion3"
,
std
::
make_shared
<
DataTypeUInt32
>
()},
{
"SilverlightVersion4"
,
std
::
make_shared
<
DataTypeUInt16
>
()},
{
"PageCharset"
,
std
::
make_shared
<
DataTypeString
>
()},
{
"CodeVersion"
,
std
::
make_shared
<
DataTypeUInt32
>
()},
{
"IsLink"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"IsDownload"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"IsNotBounce"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"FUniqID"
,
std
::
make_shared
<
DataTypeUInt64
>
()},
{
"OriginalURL"
,
std
::
make_shared
<
DataTypeString
>
()},
{
"HID"
,
std
::
make_shared
<
DataTypeUInt32
>
()},
{
"IsOldCounter"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"IsEvent"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"IsParameter"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"DontCountHits"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
{
"WithHash"
,
std
::
make_shared
<
DataTypeUInt8
>
()},
};
/// we create a description of how to read data from the tab separated dump
...
...
@@ -98,8 +98,8 @@ try
/// read the data from row tsv file and simultaneously write to the block tsv file
{
ReadBufferFrom
IStream
in_buf
(
std
::
cin
);
WriteBufferFrom
OStream
out_buf
(
std
::
cout
);
ReadBufferFrom
FileDescriptor
in_buf
(
STDIN_FILENO
);
WriteBufferFrom
FileDescriptor
out_buf
(
STDOUT_FILENO
);
RowInputStreamPtr
row_in
=
std
::
make_shared
<
TabSeparatedRowInputStream
>
(
in_buf
,
sample
);
BlockInputStreamFromRowInputStream
in
(
row_in
,
sample
,
DEFAULT_INSERT_BLOCK_SIZE
,
0
,
0
);
...
...
dbms/src/DataTypes/tests/data_type_string.cpp
浏览文件 @
7068d1ff
...
...
@@ -5,8 +5,8 @@
#include <Common/Stopwatch.h>
#include <IO/ReadBufferFrom
IStream
.h>
#include <IO/WriteBufferFrom
OStream
.h>
#include <IO/ReadBufferFrom
FileDescriptor
.h>
#include <IO/WriteBufferFrom
FileDescriptor
.h>
#include <Columns/ColumnString.h>
#include <DataTypes/DataTypeString.h>
...
...
@@ -36,7 +36,7 @@ try
}
std
::
ofstream
ostr
(
"test"
);
WriteBufferFrom
OStream
out_buf
(
ostr
);
WriteBufferFrom
FileDescriptor
out_buf
(
STDOUT_FILENO
);
stopwatch
.
restart
();
data_type
.
serializeBinaryBulk
(
*
column
,
out_buf
,
0
,
0
);
...
...
@@ -49,7 +49,7 @@ try
std
::
shared_ptr
<
ColumnString
>
column
=
std
::
make_shared
<
ColumnString
>
();
std
::
ifstream
istr
(
"test"
);
ReadBufferFrom
IStream
in_buf
(
istr
);
ReadBufferFrom
FileDescriptor
in_buf
(
STDIN_FILENO
);
stopwatch
.
restart
();
data_type
.
deserializeBinaryBulk
(
*
column
,
in_buf
,
n
,
0
);
...
...
dbms/src/IO/tests/hashing_read_buffer.cpp
浏览文件 @
7068d1ff
...
...
@@ -24,10 +24,6 @@ void test(size_t data_size)
out
.
write
(
data
,
data_size
);
out
.
next
();
//std::cout.write(data, data_size);
//std::cout << std::endl;
//std::cout << io.str() << std::endl;
DB
::
ReadBufferFromIStream
source
(
io
,
read_buffer_block_size
);
DB
::
HashingReadBuffer
buf
(
source
);
...
...
dbms/src/IO/tests/read_buffer.cpp
浏览文件 @
7068d1ff
...
...
@@ -5,16 +5,15 @@
#include <Core/Types.h>
#include <IO/ReadHelpers.h>
#include <IO/ReadBufferFrom
IStream
.h>
#include <IO/ReadBufferFrom
String
.h>
int
main
(
int
argc
,
char
**
argv
)
{
try
{
std
::
stringstream
s
;
s
<<
"-123456 123.456 вася пе
\\
tтя
\t
'
\\
'xyz
\\\\
'"
;
DB
::
ReadBufferFromIStream
in
(
s
);
std
::
string
s
=
"-123456 123.456 вася пе
\\
tтя
\t
'
\\
'xyz
\\\\
'"
;
DB
::
ReadBufferFromString
in
(
s
);
DB
::
Int64
a
;
DB
::
Float64
b
;
...
...
dbms/src/IO/tests/read_buffer_perf.cpp
浏览文件 @
7068d1ff
...
...
@@ -5,15 +5,14 @@
#include <Core/Types.h>
#include <IO/ReadHelpers.h>
#include <IO/ReadBufferFrom
IStream
.h>
#include <IO/ReadBufferFrom
File
.h>
int
main
(
int
argc
,
char
**
argv
)
{
try
{
std
::
ifstream
istr
(
"test"
);
DB
::
ReadBufferFromIStream
in
(
istr
);
DB
::
ReadBufferFromFile
in
(
"test"
);
DB
::
Int64
a
=
0
;
DB
::
Float64
b
=
0
;
...
...
dbms/src/IO/tests/read_float_perf.cpp
浏览文件 @
7068d1ff
...
...
@@ -5,7 +5,7 @@
#include <Core/Types.h>
#include <IO/ReadHelpers.h>
#include <IO/ReadBufferFrom
IStream
.h>
#include <IO/ReadBufferFrom
File
.h>
#include <IO/CompressedReadBuffer.h>
...
...
@@ -13,8 +13,7 @@ int main(int argc, char ** argv)
{
try
{
std
::
ifstream
istr
(
"DevicePixelRatio"
);
DB
::
ReadBufferFromIStream
in
(
istr
);
DB
::
ReadBufferFromFile
in
(
"DevicePixelRatio"
);
DB
::
Float32
b
=
0
;
...
...
dbms/src/Interpreters/tests/CMakeLists.txt
浏览文件 @
7068d1ff
add_executable
(
expression expression.cpp
)
target_link_libraries
(
expression dbms
)
add_executable
(
expression_analyzer expression_analyzer.cpp
)
target_link_libraries
(
expression_analyzer dbms
)
add_executable
(
create_query create_query.cpp
)
target_link_libraries
(
create_query dbms
)
...
...
dbms/src/Interpreters/tests/expression_analyzer.cpp
已删除
100644 → 0
浏览文件 @
de75fa00
#include <Interpreters/ExpressionAnalyzer.h>
#include <Interpreters/ExpressionActions.h>
#include <Interpreters/Context.h>
#include <Parsers/ParserSelectQuery.h>
#include <Parsers/ASTSelectQuery.h>
#include <Parsers/formatAST.h>
#include <Parsers/parseQuery.h>
#include <Parsers/ExpressionListParsers.h>
#include <DataTypes/DataTypeFactory.h>
int
main
(
int
argc
,
char
**
argv
)
{
using
namespace
DB
;
try
{
if
(
argc
<
2
)
{
std
::
cerr
<<
"at least 1 argument expected"
<<
std
::
endl
;
return
1
;
}
Context
context
=
Context
::
createGlobal
();
NamesAndTypesList
columns
;
for
(
int
i
=
2
;
i
+
1
<
argc
;
i
+=
2
)
{
NameAndTypePair
col
;
col
.
name
=
argv
[
i
];
col
.
type
=
DataTypeFactory
::
instance
().
get
(
argv
[
i
+
1
]);
columns
.
push_back
(
col
);
}
ASTPtr
root
;
ParserPtr
parsers
[]
=
{
std
::
make_unique
<
ParserSelectQuery
>
(),
std
::
make_unique
<
ParserExpressionList
>
(
false
)};
for
(
size_t
i
=
0
;
i
<
sizeof
(
parsers
)
/
sizeof
(
parsers
[
0
]);
++
i
)
{
IParser
&
parser
=
*
parsers
[
i
];
const
char
*
pos
=
argv
[
1
];
const
char
*
end
=
argv
[
1
]
+
strlen
(
argv
[
1
]);
const
char
*
max_parsed_pos
=
pos
;
Expected
expected
=
""
;
if
(
parser
.
parse
(
pos
,
end
,
root
,
max_parsed_pos
,
expected
))
break
;
else
root
=
nullptr
;
}
if
(
!
root
)
{
std
::
cerr
<<
"invalid expression (should be select query or expression list)"
<<
std
::
endl
;
return
2
;
}
formatAST
(
*
root
,
std
::
cout
);
std
::
cout
<<
std
::
endl
;
ExpressionAnalyzer
analyzer
(
root
,
context
,
{},
columns
);
Names
required
=
analyzer
.
getRequiredColumns
();
std
::
cout
<<
"required columns:
\n
"
;
for
(
size_t
i
=
0
;
i
<
required
.
size
();
++
i
)
{
std
::
cout
<<
required
[
i
]
<<
"
\n
"
;
}
std
::
cout
<<
"
\n
"
;
std
::
cout
<<
"only consts:
\n\n
"
<<
analyzer
.
getConstActions
()
->
dumpActions
()
<<
"
\n
"
;
if
(
analyzer
.
hasAggregation
())
{
Names
key_names
;
AggregateDescriptions
aggregates
;
analyzer
.
getAggregateInfo
(
key_names
,
aggregates
);
std
::
cout
<<
"keys:
\n
"
;
for
(
size_t
i
=
0
;
i
<
key_names
.
size
();
++
i
)
std
::
cout
<<
key_names
[
i
]
<<
"
\n
"
;
std
::
cout
<<
"
\n
"
;
std
::
cout
<<
"aggregates:
\n
"
;
for
(
size_t
i
=
0
;
i
<
aggregates
.
size
();
++
i
)
{
AggregateDescription
desc
=
aggregates
[
i
];
std
::
cout
<<
desc
.
column_name
<<
" = "
<<
desc
.
function
->
getName
()
<<
" ( "
;
for
(
size_t
j
=
0
;
j
<
desc
.
argument_names
.
size
();
++
j
)
std
::
cout
<<
desc
.
argument_names
[
j
]
<<
" "
;
std
::
cout
<<
")
\n
"
;
}
std
::
cout
<<
"
\n
"
;
ExpressionActionsChain
before
;
if
(
analyzer
.
appendWhere
(
before
,
false
))
before
.
addStep
();
analyzer
.
appendAggregateFunctionsArguments
(
before
,
false
);
analyzer
.
appendGroupBy
(
before
,
false
);
before
.
finalize
();
ExpressionActionsChain
after
;
if
(
analyzer
.
appendHaving
(
after
,
false
))
after
.
addStep
();
analyzer
.
appendSelect
(
after
,
false
);
analyzer
.
appendOrderBy
(
after
,
false
);
after
.
addStep
();
analyzer
.
appendProjectResult
(
after
,
false
);
after
.
finalize
();
std
::
cout
<<
"before aggregation:
\n\n
"
;
for
(
size_t
i
=
0
;
i
<
before
.
steps
.
size
();
++
i
)
{
std
::
cout
<<
before
.
steps
[
i
].
actions
->
dumpActions
();
std
::
cout
<<
std
::
endl
;
}
std
::
cout
<<
"
\n
after aggregation:
\n\n
"
;
for
(
size_t
i
=
0
;
i
<
after
.
steps
.
size
();
++
i
)
{
std
::
cout
<<
after
.
steps
[
i
].
actions
->
dumpActions
();
std
::
cout
<<
std
::
endl
;
}
}
else
{
if
(
typeid_cast
<
ASTSelectQuery
*>
(
&*
root
))
{
ExpressionActionsChain
chain
;
if
(
analyzer
.
appendWhere
(
chain
,
false
))
chain
.
addStep
();
analyzer
.
appendSelect
(
chain
,
false
);
analyzer
.
appendOrderBy
(
chain
,
false
);
chain
.
addStep
();
analyzer
.
appendProjectResult
(
chain
,
false
);
chain
.
finalize
();
for
(
size_t
i
=
0
;
i
<
chain
.
steps
.
size
();
++
i
)
{
std
::
cout
<<
chain
.
steps
[
i
].
actions
->
dumpActions
();
std
::
cout
<<
std
::
endl
;
}
}
else
{
std
::
cout
<<
"unprojected actions:
\n\n
"
<<
analyzer
.
getActions
(
false
)
->
dumpActions
()
<<
"
\n
"
;
std
::
cout
<<
"projected actions:
\n\n
"
<<
analyzer
.
getActions
(
true
)
->
dumpActions
()
<<
"
\n
"
;
}
}
}
catch
(
Exception
&
e
)
{
std
::
cerr
<<
"Exception "
<<
e
.
what
()
<<
": "
<<
e
.
displayText
()
<<
"
\n
"
<<
e
.
getStackTrace
().
toString
();
return
3
;
}
return
0
;
}
dbms/src/Interpreters/tests/select_query.cpp
浏览文件 @
7068d1ff
...
...
@@ -5,8 +5,8 @@
#include <Poco/ConsoleChannel.h>
#include <IO/ReadBufferFrom
IStream
.h>
#include <IO/WriteBufferFrom
OStream
.h>
#include <IO/ReadBufferFrom
FileDescriptor
.h>
#include <IO/WriteBufferFrom
FileDescriptor
.h>
#include <Storages/StorageLog.h>
#include <Storages/System/attachSystemTables.h>
...
...
@@ -42,8 +42,8 @@ try
attachSystemTablesLocal
(
*
context
.
getDatabase
(
"system"
));
context
.
setCurrentDatabase
(
"default"
);
ReadBufferFrom
IStream
in
(
std
::
cin
);
WriteBufferFrom
OStream
out
(
std
::
cout
);
ReadBufferFrom
FileDescriptor
in
(
STDIN_FILENO
);
WriteBufferFrom
FileDescriptor
out
(
STDOUT_FILENO
);
executeQuery
(
in
,
out
,
/* allow_into_outfile = */
false
,
context
,
{});
...
...
dbms/src/Parsers/tests/lexer.cpp
浏览文件 @
7068d1ff
...
...
@@ -7,9 +7,9 @@
#include <IO/WriteHelpers.h>
/
**
How to test:
*
for i in ~/work/ClickHouse/dbms/tests/queries/0_stateless/*.sql; do echo $i; grep -q 'FORMAT' $i || ./lexer < $i || break; done
*
/
/
//
How to test:
///
for i in ~/work/ClickHouse/dbms/tests/queries/0_stateless/*.sql; do echo $i; grep -q 'FORMAT' $i || ./lexer < $i || break; done
//
/
using
namespace
DB
;
...
...
dbms/src/Server/Client.cpp
浏览文件 @
7068d1ff
...
...
@@ -730,9 +730,9 @@ private:
}
ASTPtr
parseQuery
(
IParser
::
Pos
&
pos
,
const
char
*
end
,
bool
allow_multi_statements
)
ASTPtr
parseQuery
(
const
char
*
&
pos
,
const
char
*
end
,
bool
allow_multi_statements
)
{
ParserQuery
parser
;
ParserQuery
parser
(
end
)
;
ASTPtr
res
;
if
(
is_interactive
)
...
...
dbms/src/Storages/tests/CMakeLists.txt
浏览文件 @
7068d1ff
...
...
@@ -9,9 +9,6 @@ target_link_libraries (storage_log dbms)
add_executable
(
hit_log hit_log.cpp
)
target_link_libraries
(
hit_log dbms
)
add_executable
(
merge_tree merge_tree.cpp
)
target_link_libraries
(
merge_tree dbms
)
add_executable
(
seek_speed_test seek_speed_test.cpp
)
target_link_libraries
(
seek_speed_test dbms
)
...
...
dbms/src/Storages/tests/hit_log.cpp
浏览文件 @
7068d1ff
...
...
@@ -2,8 +2,8 @@
#include <list>
#include <iostream>
#include <IO/ReadBufferFrom
IStream
.h>
#include <IO/WriteBufferFrom
OStream
.h>
#include <IO/ReadBufferFrom
FileDescriptor
.h>
#include <IO/WriteBufferFrom
FileDescriptor
.h>
#include <DataTypes/DataTypesNumber.h>
#include <DataTypes/DataTypeString.h>
...
...
@@ -117,7 +117,7 @@ try
/// read the data from tsv file and simultaneously write to table
if
(
argc
==
2
&&
0
==
strcmp
(
argv
[
1
],
"write"
))
{
ReadBufferFrom
IStream
in_buf
(
std
::
cin
);
ReadBufferFrom
FileDescriptor
in_buf
(
STDIN_FILENO
);
RowInputStreamPtr
in_
=
std
::
make_shared
<
TabSeparatedRowInputStream
>
(
in_buf
,
sample
);
BlockInputStreamFromRowInputStream
in
(
in_
,
sample
,
DEFAULT_INSERT_BLOCK_SIZE
,
0
,
0
);
...
...
@@ -128,7 +128,7 @@ try
/// read from it
if
(
argc
==
2
&&
0
==
strcmp
(
argv
[
1
],
"read"
))
{
WriteBufferFrom
OStream
out_buf
(
std
::
cout
);
WriteBufferFrom
FileDescriptor
out_buf
(
STDOUT_FILENO
);
QueryProcessingStage
::
Enum
stage
;
...
...
dbms/src/Storages/tests/merge_tree.cpp
已删除
100644 → 0
浏览文件 @
de75fa00
#include <iostream>
#include <Storages/StorageMergeTree.h>
#include <DataTypes/DataTypeDate.h>
#include <DataTypes/DataTypeArray.h>
#include <DataTypes/DataTypesNumber.h>
#include <DataStreams/TabSeparatedRowOutputStream.h>
#include <DataStreams/BlockOutputStreamFromRowOutputStream.h>
#include <DataStreams/copyData.h>
#include <Parsers/ExpressionListParsers.h>
#include <Parsers/ParserSelectQuery.h>
#include <Parsers/parseQuery.h>
int
main
(
int
argc
,
char
**
argv
)
try
{
using
namespace
DB
;
const
size_t
rows
=
12345
;
Context
context
=
Context
::
createGlobal
();
/// create a table with a pair of columns
NamesAndTypesListPtr
names_and_types
=
std
::
make_shared
<
NamesAndTypesList
>
();
names_and_types
->
push_back
(
NameAndTypePair
(
"d"
,
std
::
make_shared
<
DataTypeDate
>
()));
names_and_types
->
push_back
(
NameAndTypePair
(
"a"
,
std
::
make_shared
<
DataTypeArray
>
(
std
::
make_shared
<
DataTypeUInt32
>
())));
ASTPtr
primary_expr
;
Expected
expected
=
""
;
String
primary_expr_str
=
"d"
;
const
char
*
begin
=
primary_expr_str
.
data
();
const
char
*
end
=
begin
+
primary_expr_str
.
size
();
const
char
*
max_parsed_pos
=
begin
;
ParserExpressionList
parser
(
false
);
if
(
!
parser
.
parse
(
begin
,
end
,
primary_expr
,
max_parsed_pos
,
expected
))
throw
Poco
::
Exception
(
"Cannot parse "
+
primary_expr_str
);
MergeTreeData
::
MergingParams
params
;
params
.
mode
=
MergeTreeData
::
MergingParams
::
Ordinary
;
StoragePtr
table
=
StorageMergeTree
::
create
(
"./"
,
"default"
,
"test"
,
names_and_types
,
NamesAndTypesList
{},
NamesAndTypesList
{},
ColumnDefaults
{},
false
,
context
,
primary_expr
,
"d"
,
ASTPtr
{},
101
,
params
,
false
,
MergeTreeSettings
{});
table
->
startup
();
/// write into it
{
Block
block
;
ColumnWithTypeAndName
column1
;
column1
.
name
=
"d"
;
column1
.
type
=
table
->
getDataTypeByName
(
"d"
);
column1
.
column
=
column1
.
type
->
createColumn
();
ColumnUInt16
::
Container_t
&
vec1
=
typeid_cast
<
ColumnUInt16
&>
(
*
column1
.
column
).
getData
();
vec1
.
resize
(
rows
);
for
(
size_t
i
=
0
;
i
<
rows
;
++
i
)
vec1
[
i
]
=
10000
;
block
.
insert
(
column1
);
ColumnWithTypeAndName
column2
;
column2
.
name
=
"a"
;
column2
.
type
=
table
->
getDataTypeByName
(
"a"
);
column2
.
column
=
column2
.
type
->
createColumn
();
for
(
size_t
i
=
0
;
i
<
rows
;
++
i
)
column2
.
column
->
insert
(
Array
((
rand
()
%
10
)
==
0
?
(
rand
()
%
10
)
:
0
,
i
));
block
.
insert
(
column2
);
BlockOutputStreamPtr
out
=
table
->
write
({},
{});
out
->
write
(
block
);
}
/// read from it
{
Names
column_names
;
column_names
.
push_back
(
"d"
);
column_names
.
push_back
(
"a"
);
QueryProcessingStage
::
Enum
stage
;
ASTPtr
select
;
Expected
expected
=
""
;
String
select_str
=
"SELECT * FROM test"
;
const
char
*
begin
=
select_str
.
data
();
const
char
*
end
=
begin
+
select_str
.
size
();
const
char
*
max_parsed_pos
=
begin
;
ParserSelectQuery
parser
;
if
(
!
parser
.
parse
(
begin
,
end
,
select
,
max_parsed_pos
,
expected
))
throw
Poco
::
Exception
(
"Cannot parse "
+
primary_expr_str
);
BlockInputStreamPtr
in
=
table
->
read
(
column_names
,
select
,
context
,
stage
,
8192
,
1
)[
0
];
Block
sample
;
{
ColumnWithTypeAndName
col
;
col
.
type
=
names_and_types
->
front
().
type
;
sample
.
insert
(
std
::
move
(
col
));
}
{
ColumnWithTypeAndName
col
;
col
.
type
=
names_and_types
->
back
().
type
;
sample
.
insert
(
std
::
move
(
col
));
}
WriteBufferFromFileDescriptor
out_buf
(
STDOUT_FILENO
);
RowOutputStreamPtr
output_
=
std
::
make_shared
<
TabSeparatedRowOutputStream
>
(
out_buf
,
sample
);
BlockOutputStreamFromRowOutputStream
output
(
output_
);
copyData
(
*
in
,
output
);
}
return
0
;
}
catch
(
const
DB
::
Exception
&
e
)
{
std
::
cerr
<<
e
.
displayText
()
<<
", stack trace:
\n\n
"
<<
e
.
getStackTrace
().
toString
()
<<
std
::
endl
;
throw
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录