我在CentOS 6.4上运行MariaDB(10.0.2-MariaDB),并希望使用MariaDB的CONNECT-Engine从一些日志文件中读取。由于日志文件很大,我用两个CSV文件重新创建了错误,每个文件由一行组成。
MariaDB [jedi]> create table test1 ( a char(10), b char(10) ) engine=CONNECT table_type=CSV file_name='/tmp/test1.csv' sep_char=';' compress=0 multiple=0;
Query OK, 0 rows affected (0.00 sec)
MariaDB [jedi]> create table test2 ( a char(10), b char(10) ) engine=CONNECT table_type=CSV file_name='/tmp/test2.csv' sep_char=';' compress=0 multiple=0;
Query OK, 0 rows affected (0.01 sec)
MariaDB [jedi]> select * from test1;
+------+------+
| a | b |
+------+------+
| test | bla |
+------+------+
1 row in set (0.00 sec)
MariaDB [jedi]> select * from test2;
+-------+------+
| a | b |
+-------+------+
| test2 | blub |
+-------+------+
1 row in set (0.00 sec)
现在有趣的功能是将这些文件合并到一个表中,这应该是可能的(https://kb.askmonty.org/en/connect-table-types-data-files/#multiple-file-tables表示)。
但如果我这样做:
MariaDB [jedi]> create table test_all ( a char(10), b char(10) ) engine=CONNECT table_type=CSV file_name='/tmp/test*.csv' sep_char=';' compress=0 multiple=1;
Query OK, 0 rows affected (0.00 sec)
MariaDB [jedi]> select * from test_all;
ERROR 2013 (HY000): Lost connection to MySQL server during query
有人知道解释吗?别介意“compress = 0”,我还测试了从gzip文件中读取的内容,它就像一个魅力...直到你尝试从两个文件读入一个表。
谢谢, 延