Clickhouse:较大的文件似乎会引发缓冲区和诊断问题?
Clickhouse: larger files seem to be kicking a buffer and diagnostic issue?
我正在 windows docker 桌面上使用 clickhouse docker 图像 10:
https://hub.docker.com/r/yandex/clickhouse-server/
我已启动容器,运行 正在加载数据。我是 运行 这个问题,CH 抱怨在 xyz 行之前期待一个逗号,但我知道在记事本 ++ 中打开文件后实际上有一个逗号应该是:
Code: 27. DB::Exception: Cannot parse input: expected , before . . .
或者行尾有问题:
Code: 117. DB::Exception: Expected end of line: (at row 127249)
它也抱怨:
Could not print diagnostic info because two last rows aren't in buffer (rare case)
我注意到对于相对较小的文件我没有遇到任何问题(少于 30k 行)。但是更大的文件是个问题。我之前测试过这些文件,所以我知道它们很好并且可以加载。这似乎是图像中 clickhouse 的问题,因为它甚至无法打印出诊断信息。任何想法可能是什么问题?
编辑:示例
在下面的数据中,我得到了上述错误之一。我使用 R 编写了一个要加载的 1000,000 行文件的脚本:
#generate my data-----------------------------------------------------------
library(data.table)
set.seed(22)
u = runif(1000000, 0, 60) # "noise" to add or subtract from some timepoint
x = runif(1000000, 0, 1)
my_table =
data.table(
pudt=as.POSIXct(u, origin = "2017-02-03 08:00:00"),
count = round(x,2)
)
my_table[
,pudt:=as.character(pudt)]
#write out--------------------------------------
fwrite(my_table, "my_data.csv", row.names = F, col.names = F)
#create my table in clickhouse client
CREATE TABLE test(
pudt DateTime,
count Float32
)engine = Log;
#load the data in powershell-----
$files = Get-ChildItem "where my files are . . . "
foreach ($f in $files){
$outfile = $f.FullName | Write-Host
Get-Date | Write-Host
"Start loading" + $f.FullName | Write-Host
`cat $f.FullName | docker run -i --rm --link some-clickhouse-server:clickhouse-client yandex/clickhouse-client -m --host some-clickhouse-server --query="INSERT INTO test FORMAT CSV"`
"End loading" + $f.FullName | Write-Host
[GC]::Collect()
}
我得到的错误是:
Code: 117. DB::Exception: Expected end of line: (at row 144020)
Could not print diagnostic info because two last rows aren't in buffer (rare case)
我检查了文件,并没有真正发现我知道的问题:
好像是CH官方的bug,我去测试看看:
https://groups.google.com/forum/#!topic/clickhouse/Ofbtz5B7_Fw
更新:
通过在 13.9 上构建自定义 clickhouse-client 映像解决了该问题。现在完美运行。
我正在 windows docker 桌面上使用 clickhouse docker 图像 10:
https://hub.docker.com/r/yandex/clickhouse-server/
我已启动容器,运行 正在加载数据。我是 运行 这个问题,CH 抱怨在 xyz 行之前期待一个逗号,但我知道在记事本 ++ 中打开文件后实际上有一个逗号应该是:
Code: 27. DB::Exception: Cannot parse input: expected , before . . .
或者行尾有问题:
Code: 117. DB::Exception: Expected end of line: (at row 127249)
它也抱怨:
Could not print diagnostic info because two last rows aren't in buffer (rare case)
我注意到对于相对较小的文件我没有遇到任何问题(少于 30k 行)。但是更大的文件是个问题。我之前测试过这些文件,所以我知道它们很好并且可以加载。这似乎是图像中 clickhouse 的问题,因为它甚至无法打印出诊断信息。任何想法可能是什么问题?
编辑:示例
在下面的数据中,我得到了上述错误之一。我使用 R 编写了一个要加载的 1000,000 行文件的脚本:
#generate my data-----------------------------------------------------------
library(data.table)
set.seed(22)
u = runif(1000000, 0, 60) # "noise" to add or subtract from some timepoint
x = runif(1000000, 0, 1)
my_table =
data.table(
pudt=as.POSIXct(u, origin = "2017-02-03 08:00:00"),
count = round(x,2)
)
my_table[
,pudt:=as.character(pudt)]
#write out--------------------------------------
fwrite(my_table, "my_data.csv", row.names = F, col.names = F)
#create my table in clickhouse client
CREATE TABLE test(
pudt DateTime,
count Float32
)engine = Log;
#load the data in powershell-----
$files = Get-ChildItem "where my files are . . . "
foreach ($f in $files){
$outfile = $f.FullName | Write-Host
Get-Date | Write-Host
"Start loading" + $f.FullName | Write-Host
`cat $f.FullName | docker run -i --rm --link some-clickhouse-server:clickhouse-client yandex/clickhouse-client -m --host some-clickhouse-server --query="INSERT INTO test FORMAT CSV"`
"End loading" + $f.FullName | Write-Host
[GC]::Collect()
}
我得到的错误是:
Code: 117. DB::Exception: Expected end of line: (at row 144020)
Could not print diagnostic info because two last rows aren't in buffer (rare case)
我检查了文件,并没有真正发现我知道的问题:
好像是CH官方的bug,我去测试看看:
https://groups.google.com/forum/#!topic/clickhouse/Ofbtz5B7_Fw
更新:
通过在 13.9 上构建自定义 clickhouse-client 映像解决了该问题。现在完美运行。