Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
4b30b316
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,发现更多精彩内容 >>
提交
4b30b316
编写于
5月 19, 2020
作者:
A
Alexander Tokmakov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
try fix build
上级
175b7aed
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
83 addition
and
64 deletion
+83
-64
.gitmodules
.gitmodules
+8
-3
cmake/find_cassandra.cmake
cmake/find_cassandra.cmake
+6
-2
contrib/CMakeLists.txt
contrib/CMakeLists.txt
+1
-0
contrib/cassandra
contrib/cassandra
+1
-1
contrib/libuv
contrib/libuv
+1
-0
src/CMakeLists.txt
src/CMakeLists.txt
+5
-0
src/Dictionaries/CassandraBlockInputStream.cpp
src/Dictionaries/CassandraBlockInputStream.cpp
+30
-30
src/Dictionaries/CassandraDictionarySource.cpp
src/Dictionaries/CassandraDictionarySource.cpp
+26
-25
src/Dictionaries/ya.make
src/Dictionaries/ya.make
+3
-1
src/Functions/ya.make
src/Functions/ya.make
+1
-1
tests/integration/test_dictionaries_all_layouts_and_sources/external_sources.py
..._dictionaries_all_layouts_and_sources/external_sources.py
+1
-1
未找到文件。
.gitmodules
浏览文件 @
4b30b316
...
...
@@ -95,9 +95,6 @@
[submodule "contrib/rapidjson"]
path = contrib/rapidjson
url = https://github.com/Tencent/rapidjson
[submodule "contrib/cassandra"]
path = contrib/cassandra
url = https://github.com/datastax/cpp-driver.git
[submodule "contrib/fastops"]
path = contrib/fastops
url = https://github.com/ClickHouse-Extras/fastops
...
...
@@ -160,3 +157,11 @@
[submodule "contrib/openldap"]
path = contrib/openldap
url = https://github.com/openldap/openldap.git
[submodule "contrib/cassandra"]
path = contrib/cassandra
url = https://github.com/tavplubix/cpp-driver.git
branch = ch-tmp
[submodule "contrib/libuv"]
path = contrib/libuv
url = https://github.com/libuv/libuv.git
branch = v1.x
cmake/find_cassandra.cmake
浏览文件 @
4b30b316
if
(
NOT DEFINED ENABLE_CASSANDRA OR ENABLE_CASSANDRA
)
if
(
NOT EXISTS
"
${
ClickHouse_SOURCE_DIR
}
/contrib/cassandra"
)
if
(
NOT EXISTS
"
${
ClickHouse_SOURCE_DIR
}
/contrib/libuv"
)
message
(
WARNING
"submodule contrib/libuv is missing. to fix try run:
\n
git submodule update --init --recursive"
)
elseif
(
NOT EXISTS
"
${
ClickHouse_SOURCE_DIR
}
/contrib/cassandra"
)
message
(
WARNING
"submodule contrib/cassandra is missing. to fix try run:
\n
git submodule update --init --recursive"
)
else
()
set
(
LIBUV_ROOT_DIR
"
${
ClickHouse_SOURCE_DIR
}
/contrib/libuv"
)
set
(
CASSANDRA_INCLUDE_DIR
"
${
ClickHouse_SOURCE_DIR
}
/contrib/cassandra/include/"
)
set
(
CASSANDRA_LIBRARY cassandra
)
set
(
LIBUV_LIBRARY uv_a
)
set
(
CASSANDRA_LIBRARY cassandra_static
)
set
(
USE_CASSANDRA 1
)
set
(
CASS_ROOT_DIR
"
${
ClickHouse_SOURCE_DIR
}
/contrib/cassandra"
)
...
...
contrib/CMakeLists.txt
浏览文件 @
4b30b316
...
...
@@ -319,5 +319,6 @@ if (USE_FASTOPS)
endif
()
if
(
USE_CASSANDRA
)
add_subdirectory
(
libuv
)
add_subdirectory
(
cassandra
)
endif
()
cassandra
@
5c0f2a62
Subproject commit
fd9b73d4acfd85293ab304be64e2e1e2109e521d
Subproject commit
5c0f2a62bdc63dcc390d771c9afaa9dc34eb8e5b
libuv
@
cc51217a
Subproject commit cc51217a317e96510fbb284721d5e6bc2af31e33
src/CMakeLists.txt
浏览文件 @
4b30b316
...
...
@@ -356,6 +356,11 @@ if (USE_OPENCL)
target_include_directories
(
clickhouse_common_io SYSTEM BEFORE PRIVATE
${
OpenCL_INCLUDE_DIRS
}
)
endif
()
if
(
USE_CASSANDRA
)
dbms_target_link_libraries
(
PRIVATE
${
CASSANDRA_LIBRARY
}
)
dbms_target_include_directories
(
SYSTEM BEFORE PRIVATE
${
CASS_INCLUDE_DIR
}
)
endif
()
dbms_target_include_directories
(
PUBLIC
${
DBMS_INCLUDE_DIR
}
)
target_include_directories
(
clickhouse_common_io PUBLIC
${
DBMS_INCLUDE_DIR
}
)
...
...
src/Dictionaries/CassandraBlockInputStream.cpp
浏览文件 @
4b30b316
...
...
@@ -22,14 +22,14 @@ namespace ErrorCodes
}
CassandraBlockInputStream
::
CassandraBlockInputStream
(
CassSession
*
session
,
const
std
::
string
&
query_str
,
CassSession
*
session
_
,
const
std
::
string
&
query_str
_
,
const
DB
::
Block
&
sample_block
,
const
size_t
max_block_size
)
:
session
{
session
}
,
statement
{
cass_statement_new
(
query_str
.
c_str
(),
0
)}
,
query_str
{
query_str
}
,
max_block_size
{
max_block_size
}
const
size_t
max_block_size
_
)
:
session
(
session_
)
,
statement
(
cass_statement_new
(
query_str_
.
c_str
(),
0
))
,
query_str
(
query_str_
)
,
max_block_size
(
max_block_size_
)
{
cass_statement_set_paging_size
(
statement
,
max_block_size
);
this
->
has_more_pages
=
cass_true
;
...
...
@@ -51,77 +51,77 @@ namespace
{
switch
(
type
)
{
case
ValueType
::
UInt8
:
case
ValueType
::
vt
UInt8
:
{
cass_uint32_t
_value
;
cass_value_get_uint32
(
value
,
&
_value
);
static_cast
<
ColumnUInt8
&>
(
column
).
insertValue
(
_value
);
break
;
}
case
ValueType
::
UInt16
:
case
ValueType
::
vt
UInt16
:
{
cass_uint32_t
_value
;
cass_value_get_uint32
(
value
,
&
_value
);
static_cast
<
ColumnUInt16
&>
(
column
).
insertValue
(
_value
);
break
;
}
case
ValueType
::
UInt32
:
case
ValueType
::
vt
UInt32
:
{
cass_uint32_t
_value
;
cass_value_get_uint32
(
value
,
&
_value
);
static_cast
<
ColumnUInt32
&>
(
column
).
insertValue
(
_value
);
break
;
}
case
ValueType
::
UInt64
:
case
ValueType
::
vt
UInt64
:
{
cass_int64_t
_value
;
cass_value_get_int64
(
value
,
&
_value
);
static_cast
<
ColumnUInt64
&>
(
column
).
insertValue
(
_value
);
break
;
}
case
ValueType
::
Int8
:
case
ValueType
::
vt
Int8
:
{
cass_int8_t
_value
;
cass_value_get_int8
(
value
,
&
_value
);
static_cast
<
ColumnInt8
&>
(
column
).
insertValue
(
_value
);
break
;
}
case
ValueType
::
Int16
:
case
ValueType
::
vt
Int16
:
{
cass_int16_t
_value
;
cass_value_get_int16
(
value
,
&
_value
);
static_cast
<
ColumnInt16
&>
(
column
).
insertValue
(
_value
);
break
;
}
case
ValueType
::
Int32
:
case
ValueType
::
vt
Int32
:
{
cass_int32_t
_value
;
cass_value_get_int32
(
value
,
&
_value
);
static_cast
<
ColumnInt32
&>
(
column
).
insertValue
(
_value
);
break
;
}
case
ValueType
::
Int64
:
case
ValueType
::
vt
Int64
:
{
cass_int64_t
_value
;
cass_value_get_int64
(
value
,
&
_value
);
static_cast
<
ColumnInt64
&>
(
column
).
insertValue
(
_value
);
break
;
}
case
ValueType
::
Float32
:
case
ValueType
::
vt
Float32
:
{
cass_float_t
_value
;
cass_value_get_float
(
value
,
&
_value
);
static_cast
<
ColumnFloat32
&>
(
column
).
insertValue
(
_value
);
break
;
}
case
ValueType
::
Float64
:
case
ValueType
::
vt
Float64
:
{
cass_double_t
_value
;
cass_value_get_double
(
value
,
&
_value
);
static_cast
<
ColumnFloat64
&>
(
column
).
insertValue
(
_value
);
break
;
}
case
ValueType
::
String
:
case
ValueType
::
vt
String
:
{
const
char
*
_value
;
size_t
_value_length
;
...
...
@@ -129,21 +129,21 @@ namespace
static_cast
<
ColumnString
&>
(
column
).
insertData
(
_value
,
_value_length
);
break
;
}
case
ValueType
::
Date
:
case
ValueType
::
vt
Date
:
{
cass_int64_t
_value
;
cass_value_get_int64
(
value
,
&
_value
);
static_cast
<
ColumnUInt16
&>
(
column
).
insertValue
(
UInt32
{
cass_date_from_epoch
(
_value
)});
// FIXME
break
;
}
case
ValueType
::
DateTime
:
case
ValueType
::
vt
DateTime
:
{
cass_int64_t
_value
;
cass_value_get_int64
(
value
,
&
_value
);
static_cast
<
ColumnUInt32
&>
(
column
).
insertValue
(
_value
);
break
;
}
case
ValueType
::
UUID
:
case
ValueType
::
vt
UUID
:
{
CassUuid
_value
;
cass_value_get_uuid
(
value
,
&
_value
);
...
...
@@ -166,7 +166,7 @@ namespace
MutableColumns
columns
(
description
.
sample_block
.
columns
());
CassFuture
*
query_future
=
cass_session_execute
(
session
,
statement
);
const
CassResult
*
result
=
cass_future_get_result
(
query_future
);
const
CassResult
*
result
_tmp
=
cass_future_get_result
(
query_future
);
if
(
result
==
nullptr
)
{
const
char
*
error_message
;
...
...
@@ -176,12 +176,12 @@ namespace
throw
Exception
{
error_message
,
ErrorCodes
::
CASSANDRA_INTERNAL_ERROR
};
}
const
CassRow
*
row
=
cass_result_first_row
(
result
);
const
CassRow
*
row
=
cass_result_first_row
(
result
_tmp
);
const
CassValue
*
map
=
cass_row_get_column
(
row
,
0
);
CassIterator
*
iterator
=
cass_iterator_from_map
(
map
);
while
(
cass_iterator_next
(
iterator
))
{
const
CassValue
*
_key
=
cass_iterator_get_map_key
(
iterator
);
const
CassValue
*
_value
=
cass_iterator_get_map_value
(
iterator
);
CassIterator
*
iterator
_tmp
=
cass_iterator_from_map
(
map
);
while
(
cass_iterator_next
(
iterator
_tmp
))
{
const
CassValue
*
_key
=
cass_iterator_get_map_key
(
iterator
_tmp
);
const
CassValue
*
_value
=
cass_iterator_get_map_value
(
iterator
_tmp
);
auto
pair_values
=
{
std
::
make_pair
(
_key
,
0ul
),
std
::
make_pair
(
_value
,
1ul
)};
for
(
const
auto
&
[
value
,
idx
]
:
pair_values
)
{
if
(
description
.
types
[
idx
].
second
)
{
...
...
@@ -194,13 +194,13 @@ namespace
}
}
has_more_pages
=
cass_result_has_more_pages
(
result
);
has_more_pages
=
cass_result_has_more_pages
(
result
_tmp
);
if
(
has_more_pages
)
{
cass_statement_set_paging_state
(
statement
,
result
);
cass_statement_set_paging_state
(
statement
,
result
_tmp
);
}
cass_result_free
(
result
);
cass_result_free
(
result
_tmp
);
return
description
.
sample_block
.
cloneWithColumns
(
std
::
move
(
columns
));
}
...
...
src/Dictionaries/CassandraDictionarySource.cpp
浏览文件 @
4b30b316
...
...
@@ -15,7 +15,8 @@ namespace DB
const
Poco
::
Util
::
AbstractConfiguration
&
config
,
const
std
::
string
&
config_prefix
,
Block
&
sample_block
,
const
Context
&
/* context */
)
->
DictionarySourcePtr
{
const
Context
&
/* context */
,
bool
/*check_config*/
)
->
DictionarySourcePtr
{
#if USE_CASSANDRA
return
std
::
make_unique
<
CassandraDictionarySource
>
(
dict_struct
,
config
,
config_prefix
+
".cassandra"
,
sample_block
);
#else
...
...
@@ -49,42 +50,42 @@ namespace ErrorCodes
static
const
size_t
max_block_size
=
8192
;
CassandraDictionarySource
::
CassandraDictionarySource
(
const
DB
::
DictionaryStructure
&
dict_struct
,
const
std
::
string
&
host
,
UInt16
port
,
const
std
::
string
&
user
,
const
std
::
string
&
password
,
const
std
::
string
&
method
,
const
std
::
string
&
db
,
const
DB
::
Block
&
sample_block
)
:
dict_struct
{
dict_struct
}
,
host
{
host
}
,
port
{
port
}
,
user
{
user
}
,
password
{
password
}
,
method
{
method
}
,
db
{
db
}
,
sample_block
{
sample_block
}
,
cluster
{
cass_cluster_new
()}
,
session
{
cass_session_new
()}
const
DB
::
DictionaryStructure
&
dict_struct_
,
const
std
::
string
&
host_
,
UInt16
port
_
,
const
std
::
string
&
user_
,
const
std
::
string
&
password_
,
const
std
::
string
&
method_
,
const
std
::
string
&
db_
,
const
DB
::
Block
&
sample_block_
)
:
dict_struct
(
dict_struct_
)
,
host
(
host_
)
,
port
(
port_
)
,
user
(
user_
)
,
password
(
password_
)
,
method
(
method_
)
,
db
(
db_
)
,
sample_block
(
sample_block_
)
,
cluster
(
cass_cluster_new
())
,
session
(
cass_session_new
())
{
cass_cluster_set_contact_points
(
cluster
,
toConnectionString
(
host
,
port
).
c_str
());
}
CassandraDictionarySource
::
CassandraDictionarySource
(
const
DB
::
DictionaryStructure
&
dict_struct
,
const
Poco
::
Util
::
AbstractConfiguration
&
config
,
const
std
::
string
&
config_prefix
,
DB
::
Block
&
sample_block
)
const
DB
::
DictionaryStructure
&
dict_struct_
,
const
Poco
::
Util
::
AbstractConfiguration
&
config
,
const
std
::
string
&
config_prefix
,
DB
::
Block
&
sample_block_
)
:
CassandraDictionarySource
(
dict_struct
,
dict_struct
_
,
config
.
getString
(
config_prefix
+
".host"
),
config
.
getUInt
(
config_prefix
+
".port"
),
config
.
getString
(
config_prefix
+
".user"
,
""
),
config
.
getString
(
config_prefix
+
".password"
,
""
),
config
.
getString
(
config_prefix
+
".method"
,
""
),
config
.
getString
(
config_prefix
+
".db"
,
""
),
sample_block
)
sample_block
_
)
{
}
...
...
src/Dictionaries/ya.make
浏览文件 @
4b30b316
...
...
@@ -16,6 +16,8 @@ SRCS(
CacheDictionary_generate1.cpp
CacheDictionary_generate2.cpp
CacheDictionary_generate3.cpp
CassandraBlockInputStream.cpp
CassandraDictionarySource.cpp
ClickHouseDictionarySource.cpp
ComplexKeyCacheDictionary.cpp
ComplexKeyCacheDictionary_createAttributeWithType.cpp
...
...
@@ -24,8 +26,8 @@ SRCS(
ComplexKeyCacheDictionary_generate3.cpp
ComplexKeyCacheDictionary_setAttributeValue.cpp
ComplexKeyCacheDictionary_setDefaultAttributeValue.cpp
ComplexKeyHashedDictionary.cpp
ComplexKeyDirectDictionary.cpp
ComplexKeyHashedDictionary.cpp
DictionaryBlockInputStreamBase.cpp
DictionaryFactory.cpp
DictionarySourceFactory.cpp
...
...
src/Functions/ya.make
浏览文件 @
4b30b316
...
...
@@ -281,10 +281,10 @@ SRCS(
rand64.cpp
randConstant.cpp
rand.cpp
randomFixedString.cpp
randomPrintableASCII.cpp
randomString.cpp
randomStringUTF8.cpp
randomFixedString.cpp
regexpQuoteMeta.cpp
registerFunctionsArithmetic.cpp
registerFunctionsComparison.cpp
...
...
tests/integration/test_dictionaries_all_layouts_and_sources/external_sources.py
浏览文件 @
4b30b316
...
...
@@ -2,7 +2,7 @@
import
warnings
import
pymysql.cursors
import
pymongo
import
cassandra
import
cassandra
.cluster
import
redis
import
aerospike
from
tzlocal
import
get_localzone
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录