Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
c2559805
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,发现更多精彩内容 >>
提交
c2559805
编写于
3月 09, 2012
作者:
A
Alexey Milovidov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dbms: development [#CONV-2944].
上级
d9a68ccf
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
35 addition
and
7 deletion
+35
-7
dbms/include/DB/Interpreters/Context.h
dbms/include/DB/Interpreters/Context.h
+3
-1
dbms/src/DataStreams/tests/filter_stream.cpp
dbms/src/DataStreams/tests/filter_stream.cpp
+2
-5
dbms/src/Interpreters/loadMetadata.cpp
dbms/src/Interpreters/loadMetadata.cpp
+7
-0
dbms/src/Interpreters/tests/expression.cpp
dbms/src/Interpreters/tests/expression.cpp
+3
-0
dbms/src/Server/Handler.cpp
dbms/src/Server/Handler.cpp
+11
-0
dbms/src/Server/Server.cpp
dbms/src/Server/Server.cpp
+9
-1
未找到文件。
dbms/include/DB/Interpreters/Context.h
浏览文件 @
c2559805
...
...
@@ -40,10 +40,11 @@ struct Context
StorageFactoryPtr
storage_factory
;
/// Движки таблиц.
NamesAndTypesList
columns
;
/// Столбцы текущей обрабатываемой таблицы.
Settings
settings
;
/// Настройки выполнения запроса.
Logger
*
log
;
/// Логгер.
mutable
SharedPtr
<
Poco
::
FastMutex
>
mutex
;
/// Для доступа и модификации разделяемых объектов.
Context
()
:
databases
(
new
Databases
),
functions
(
new
Functions
),
mutex
(
new
Poco
::
FastMutex
)
{}
Context
()
:
databases
(
new
Databases
),
functions
(
new
Functions
),
log
(
&
Logger
::
get
(
"Context"
)),
mutex
(
new
Poco
::
FastMutex
)
{}
/** В сервере есть глобальный контекст.
* При соединении, он копируется в контекст сессии.
...
...
@@ -63,6 +64,7 @@ struct Context
storage_factory
=
rhs
.
storage_factory
;
columns
=
rhs
.
columns
;
settings
=
rhs
.
settings
;
log
=
rhs
.
log
;
mutex
=
rhs
.
mutex
;
}
};
...
...
dbms/src/DataStreams/tests/filter_stream.cpp
浏览文件 @
c2559805
...
...
@@ -18,8 +18,7 @@
#include <DB/DataTypes/DataTypesNumberFixed.h>
#include <DB/Functions/FunctionsArithmetic.h>
#include <DB/Functions/FunctionsComparison.h>
#include <DB/Functions/FunctionsLibrary.h>
#include <DB/Parsers/ParserSelectQuery.h>
#include <DB/Parsers/formatAST.h>
...
...
@@ -56,9 +55,7 @@ int main(int argc, char ** argv)
DB
::
Context
context
;
context
.
columns
.
push_back
(
DB
::
NameAndTypePair
(
"number"
,
new
DB
::
DataTypeUInt64
));
(
*
context
.
functions
)[
"modulo"
]
=
new
DB
::
FunctionModulo
;
(
*
context
.
functions
)[
"equals"
]
=
new
DB
::
FunctionEquals
;
(
*
context
.
functions
)[
"notEquals"
]
=
new
DB
::
FunctionNotEquals
;
context
.
functions
=
DB
::
FunctionsLibrary
::
get
();
Poco
::
SharedPtr
<
DB
::
Expression
>
expression
=
new
DB
::
Expression
(
ast
,
context
);
...
...
dbms/src/Interpreters/loadMetadata.cpp
浏览文件 @
c2559805
...
...
@@ -52,11 +52,18 @@ void loadMetadata(Context & context)
if
(
!
it
->
isDirectory
())
continue
;
/// Для директории .svn
if
(
it
.
name
().
at
(
0
)
==
'.'
)
continue
;
executeCreateQuery
(
"ATTACH DATABASE "
+
it
.
name
(),
context
,
it
.
name
(),
it
->
path
());
/// Цикл по таблицам
for
(
Poco
::
DirectoryIterator
jt
(
it
->
path
());
jt
!=
dir_end
;
++
jt
)
{
if
(
jt
->
isDirectory
())
continue
;
/// Файлы имеют имена вида table_name.sql
if
(
jt
.
name
().
compare
(
jt
.
name
().
size
()
-
4
,
4
,
".sql"
))
throw
Exception
(
"Incorrect file extension: "
+
jt
.
name
()
+
" in metadata directory "
+
it
->
path
(),
ErrorCodes
::
INCORRECT_FILE_NAME
);
...
...
dbms/src/Interpreters/tests/expression.cpp
浏览文件 @
c2559805
...
...
@@ -5,7 +5,10 @@
#include <DB/IO/WriteBufferFromOStream.h>
#include <DB/Columns/ColumnString.h>
#include <DB/DataTypes/DataTypesNumberFixed.h>
#include <DB/DataTypes/DataTypeString.h>
#include <DB/Functions/FunctionsLibrary.h>
...
...
dbms/src/Server/Handler.cpp
浏览文件 @
c2559805
#include <Poco/URI.h>
#include <Poco/NumberParser.h>
#include <DB/Core/ErrorCodes.h>
...
...
@@ -34,6 +35,16 @@ void HTTPRequestHandler::processQuery(Poco::Net::NameValueCollection & params, s
WriteBufferFromOStream
out
(
ostr
);
Context
context
=
server
.
global_context
;
/// Некоторые настройки могут быть переопределены в запросе.
if
(
params
.
has
(
"asynchronous"
))
context
.
settings
.
asynchronous
=
0
!=
Poco
::
NumberParser
::
parseUnsigned
(
params
.
get
(
"asynchronous"
));
if
(
params
.
has
(
"max_block_size"
))
context
.
settings
.
max_block_size
=
Poco
::
NumberParser
::
parseUnsigned
(
params
.
get
(
"max_block_size"
));
if
(
params
.
has
(
"max_query_size"
))
context
.
settings
.
max_query_size
=
Poco
::
NumberParser
::
parseUnsigned
(
params
.
get
(
"max_query_size"
));
if
(
params
.
has
(
"max_threads"
))
context
.
settings
.
max_threads
=
Poco
::
NumberParser
::
parseUnsigned
(
params
.
get
(
"max_threads"
));
executeQuery
(
in
,
out
,
context
,
query_plan
);
if
(
query_plan
)
...
...
dbms/src/Server/Server.cpp
浏览文件 @
c2559805
...
...
@@ -51,7 +51,10 @@ int Server::main(const std::vector<std::string> & args)
{
/// Заранее инициализируем DateLUT, чтобы первая инициализация потом не влияла на измеряемую скорость выполнения.
Yandex
::
DateLUTSingleton
::
instance
();
/** Контекст содержит всё, что влияет на обработку запроса:
* настройки, набор функций, типов данных, агрегатных функций, баз данных...
*/
global_context
.
path
=
config
.
getString
(
"path"
);
global_context
.
functions
=
FunctionsLibrary
::
get
();
global_context
.
aggregate_function_factory
=
new
AggregateFunctionFactory
;
...
...
@@ -64,6 +67,11 @@ int Server::main(const std::vector<std::string> & args)
(
*
global_context
.
databases
)[
"system"
][
"numbers"
]
=
new
StorageSystemNumbers
(
"numbers"
);
global_context
.
current_database
=
config
.
getString
(
"default_database"
,
"default"
);
global_context
.
settings
.
asynchronous
=
config
.
getBool
(
"asynchronous"
,
global_context
.
settings
.
asynchronous
);
global_context
.
settings
.
max_block_size
=
config
.
getInt
(
"max_block_size"
,
global_context
.
settings
.
max_block_size
);
global_context
.
settings
.
max_query_size
=
config
.
getInt
(
"max_query_size"
,
global_context
.
settings
.
max_query_size
);
global_context
.
settings
.
max_threads
=
config
.
getInt
(
"max_threads"
,
global_context
.
settings
.
max_threads
);
Poco
::
Net
::
ServerSocket
socket
(
Poco
::
Net
::
SocketAddress
(
"[::]:"
+
config
.
getString
(
"http_port"
)));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录