在cloudera impala 1.2.3中使用date_sub()udf从视图查询时获取连接重置错误

时间:2014-03-06 14:08:12

标签: hadoop cloudera impala

我编写了一个查询来在Impala中创建一个视图。该视图包含一个字段record_date,其字符串数据类型为格式为yyyy-MM-dd hh:mm:ss。在尝试使用date_sub('2014-01-30 00:00:00',1)执行提取上一个日期记录的查询时,我收到如下错误:

错误:与impalad通信时出错:TSocket读取0个字节。

如果我尝试在创建的表而不是视图上执行相同的查询,我将正确获取输出。

感谢任何帮助。

由于

1 个答案:

答案 0 :(得分:0)

这是一个错误,请升级到最新版本的Impala,因为它似乎已经从1.2.3开始修复,这已经很老了。

此问题无法在Impala 2.2上重现:

[localhost:21000] > create table test_ts_string ( x string );
[localhost:21000] > create view test_ts_string_view as select * from test_ts_string;

... insert data ..

[localhost:21000] > select x, date_sub(x, 1) from test_ts_string;
Query: select x, date_sub(x, 1) from test_ts_string
+---------------------+---------------------+
| x                   | date_sub(x, 1)      |
+---------------------+---------------------+
| 2009-01-01 00:00:00 | 2008-12-31 00:00:00 |
| 2009-01-01 00:01:00 | 2008-12-31 00:01:00 |
| 2009-04-01 00:00:00 | 2009-03-31 00:00:00 |
| 2009-04-01 00:01:00 | 2009-03-31 00:01:00 |
| 2009-03-01 00:00:00 | 2009-02-28 00:00:00 |
| 2009-03-01 00:01:00 | 2009-02-28 00:01:00 |
| 2009-02-01 00:00:00 | 2009-01-31 00:00:00 |
| 2009-02-01 00:01:00 | 2009-01-31 00:01:00 |
+---------------------+---------------------+
Fetched 8 row(s) in 0.22s

[localhost:21000] > select x, date_sub(x, 1) from test_ts_string_view;
+---------------------+---------------------+
| x                   | _c1                 |
+---------------------+---------------------+
| 2009-01-01 00:00:00 | 2008-12-31 00:00:00 |
| 2009-01-01 00:01:00 | 2008-12-31 00:01:00 |
| 2009-04-01 00:00:00 | 2009-03-31 00:00:00 |
| 2009-04-01 00:01:00 | 2009-03-31 00:01:00 |
| 2009-03-01 00:00:00 | 2009-02-28 00:00:00 |
| 2009-03-01 00:01:00 | 2009-02-28 00:01:00 |
| 2009-02-01 00:00:00 | 2009-01-31 00:00:00 |
| 2009-02-01 00:01:00 | 2009-01-31 00:01:00 |
+---------------------+---------------------+
Fetched 8 row(s) in 4.92s