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

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

如果我尝试对创建的表而不是 View 执行相同的查询,则将正确获取输出。

任何帮助表示赞赏。

谢谢

最佳答案

这是一个错误,请升级到最新版本的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

关于hadoop - 在Cloudera Impala 1.2.3中使用date_sub()udf从 View 中查询时出现连接重置错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22226929/

10-16 03:22