Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
b843ea5b
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,发现更多精彩内容 >>
提交
b843ea5b
编写于
7月 11, 2017
作者:
V
Vitaliy Lyudvichenko
提交者:
alexey-milovidov
7月 11, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Resolves #964. Fixed input_format_skip_unknown_fields for negative numbers. [#CLICKHOUSE-3]
上级
78921294
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
17 addition
and
15 deletion
+17
-15
dbms/src/Common/ConfigProcessor.cpp
dbms/src/Common/ConfigProcessor.cpp
+2
-6
dbms/src/Functions/FunctionsStringSearch.cpp
dbms/src/Functions/FunctionsStringSearch.cpp
+1
-1
dbms/src/IO/ReadHelpers.cpp
dbms/src/IO/ReadHelpers.cpp
+2
-2
dbms/src/Storages/MergeTree/MergeTreeData.cpp
dbms/src/Storages/MergeTree/MergeTreeData.cpp
+1
-1
dbms/src/TableFunctions/TableFunctionRemote.cpp
dbms/src/TableFunctions/TableFunctionRemote.cpp
+1
-1
dbms/tests/queries/0_stateless/00374_json_each_row_input_with_noisy_fields.reference
...ess/00374_json_each_row_input_with_noisy_fields.reference
+1
-0
dbms/tests/queries/0_stateless/00374_json_each_row_input_with_noisy_fields.sh
..._stateless/00374_json_each_row_input_with_noisy_fields.sh
+9
-4
未找到文件。
dbms/src/Common/ConfigProcessor.cpp
浏览文件 @
b843ea5b
...
...
@@ -11,15 +11,11 @@
#include <Poco/Util/XMLConfiguration.h>
#include <Common/ZooKeeper/ZooKeeperNodeCache.h>
#include <Common/StringUtils.h>
using
namespace
Poco
::
XML
;
static
bool
endsWith
(
const
std
::
string
&
s
,
const
std
::
string
&
suffix
)
{
return
s
.
size
()
>=
suffix
.
size
()
&&
s
.
substr
(
s
.
size
()
-
suffix
.
size
())
==
suffix
;
}
/// Extracts from a string the first encountered number consisting of at least two digits.
static
std
::
string
numberFromHost
(
const
std
::
string
&
s
)
{
...
...
@@ -27,7 +23,7 @@ static std::string numberFromHost(const std::string & s)
{
std
::
string
res
;
size_t
j
=
i
;
while
(
j
<
s
.
size
()
&&
is
digit
(
s
[
j
]))
while
(
j
<
s
.
size
()
&&
is
NumericASCII
(
s
[
j
]))
res
+=
s
[
j
++
];
if
(
res
.
size
()
>=
2
)
{
...
...
dbms/src/Functions/FunctionsStringSearch.cpp
浏览文件 @
b843ea5b
...
...
@@ -587,7 +587,7 @@ struct ReplaceRegexpImpl
{
if
(
s
[
i
]
==
'\\'
&&
i
+
1
<
s
.
size
())
{
if
(
is
digit
(
s
[
i
+
1
]))
/// Substitution
if
(
is
NumericASCII
(
s
[
i
+
1
]))
/// Substitution
{
if
(
!
now
.
empty
())
{
...
...
dbms/src/IO/ReadHelpers.cpp
浏览文件 @
b843ea5b
...
...
@@ -683,7 +683,7 @@ void skipJSONFieldPlain(ReadBuffer & buf, const StringRef & name_of_filed)
NullSink
sink
;
readJSONStringInto
(
sink
,
buf
);
}
else
if
(
isNumericASCII
(
*
buf
.
position
()))
/// skip number
else
if
(
isNumericASCII
(
*
buf
.
position
())
||
*
buf
.
position
()
==
'-'
||
*
buf
.
position
()
==
'+'
)
/// skip number
{
double
v
;
if
(
!
tryReadFloatText
(
v
,
buf
))
...
...
@@ -737,7 +737,7 @@ void skipJSONFieldPlain(ReadBuffer & buf, const StringRef & name_of_filed)
}
else
{
throw
Exception
(
"Unexpected symbol for key '"
+
name_of_filed
.
toString
()
+
"'"
,
ErrorCodes
::
INCORRECT_DATA
);
throw
Exception
(
"Unexpected symbol
'"
+
std
::
string
(
*
buf
.
position
(),
1
)
+
"'
for key '"
+
name_of_filed
.
toString
()
+
"'"
,
ErrorCodes
::
INCORRECT_DATA
);
}
}
...
...
dbms/src/Storages/MergeTree/MergeTreeData.cpp
浏览文件 @
b843ea5b
...
...
@@ -1706,7 +1706,7 @@ static std::pair<String, DayNum_t> getMonthNameAndDayNum(const Field & partition
?
toString
(
partition
.
get
<
UInt64
>
())
:
partition
.
safeGet
<
String
>
();
if
(
month_name
.
size
()
!=
6
||
!
std
::
all_of
(
month_name
.
begin
(),
month_name
.
end
(),
is
digit
))
if
(
month_name
.
size
()
!=
6
||
!
std
::
all_of
(
month_name
.
begin
(),
month_name
.
end
(),
is
NumericASCII
))
throw
Exception
(
"Invalid partition format: "
+
month_name
+
". Partition should consist of 6 digits: YYYYMM"
,
ErrorCodes
::
INVALID_PARTITION_NAME
);
...
...
dbms/src/TableFunctions/TableFunctionRemote.cpp
浏览文件 @
b843ea5b
...
...
@@ -52,7 +52,7 @@ static bool parseNumber(const String & description, size_t l, size_t r, size_t &
res
=
0
;
for
(
size_t
pos
=
l
;
pos
<
r
;
pos
++
)
{
if
(
!
is
digit
(
description
[
pos
]))
if
(
!
is
NumericASCII
(
description
[
pos
]))
return
false
;
res
=
res
*
10
+
description
[
pos
]
-
'0'
;
if
(
res
>
1e15
)
...
...
dbms/tests/queries/0_stateless/00374_json_each_row_input_with_noisy_fields.reference
浏览文件 @
b843ea5b
...
...
@@ -3,3 +3,4 @@
0
1 ok
1 ok
1 ok
dbms/tests/queries/0_stateless/00374_json_each_row_input_with_noisy_fields.sh
浏览文件 @
b843ea5b
#!/usr/bin/env bash
clickhouse-client
-n
--query
"DROP TABLE IF EXISTS test.json_noisy; CREATE TABLE test.json_noisy (d1 UInt8, d2 String) ENGINE = Memory"
set
-e
clickhouse-client
-q
"DROP TABLE IF EXISTS test.json_noisy"
clickhouse-client
-q
"CREATE TABLE test.json_noisy (d1 UInt8, d2 String) ENGINE = Memory"
echo
'{"d1" : 1, "d2" : "ok"}
{ }
{"t1" : 0, "t2":true,"t3":false, "t4":null,"t5":[],"t6":"trash" }
{"d2":"ok","t1":[[[]],true, null, false, "1","2",9.03,101], "t2":[["1","2"]], "d1":"1"}
{"d2":"ok","t1":[[[]],true, null, false, "1","2", 0.03, 1], "d1":"1", "t2":["1","2"]}'
\
| clickhouse-client
-n
--query
"SET input_format_skip_unknown_fields = 1; INSERT INTO test.json_noisy FORMAT JSONEachRow"
{"d2":"ok","t1":[[[]],true, null, false, "1","2", 0.03, 1], "d1":"1", "t2":["1","2"]}
{"t0" : -0.1, "t1" : +1, "t2" : 0, "t3" : [0.0, -0.1], "d2" : "ok", "d1" : 1}'
\
| clickhouse-client
--input_format_skip_unknown_fields
=
1
-q
"INSERT INTO test.json_noisy FORMAT JSONEachRow"
clickhouse-client
-n
--query
"SELECT * FROM test.json_noisy; DROP TABLE IF EXISTS test.json_noisy;"
clickhouse-client
--max_threads
=
1
-q
"SELECT * FROM test.json_noisy"
clickhouse-client
-q
"DROP TABLE IF EXISTS test.json_noisy"
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录