Twp-download: command not found
时间: 2023-12-16 07:27:46 浏览: 46
根据提供的引用内容,Twp-download不是Docker的命令,因此可能是由于拼写错误或未安装所致。请尝试使用正确的命令或安装所需的软件包。如果您确定该命令存在于某个软件包中,请尝试使用以下命令在CentOS上安装该软件包:
```shell
sudo yum install <package-name>
```
请将<package-name>替换为您要安装的软件包名称。如果您不确定软件包的名称,请查看软件包的官方文档或使用以下命令搜索软件包:
```shell
sudo yum search <keyword>
```
请将<keyword>替换为您要搜索的关键字。
相关问题
String sql = "SELECT id, data_cal_date, stock_block_code, stock_block_name, " + "SUM(block_ref_compact_bal) AS block_ref_compact_bal " + "FROM (" + " SELECT UUID() AS id, '" + lastTD + "' AS data_cal_date, " + " biv.stock_block_code, " + " biv.stock_block_name, " + " ztd.lend_rate * ztd.lend_num * twp.close_price / SUM(ztd.lend_num * twp.close_price) AS block_ref_compact_bal " + " FROM bid_info_view biv " + " LEFT JOIN zrq_trade_detail ztd ON biv.ts_code = ztd.ts_code " + " LEFT JOIN temp_wind_price twp ON biv.ts_code = twp.ts_code " + " GROUP BY biv.stock_block_code, biv.stock_block_name" + ") t " + "GROUP BY id, data_cal_date, stock_block_code, stock_block_name"; tEnv.executeSql(sql).print(); 其中一个ts_code 存在多个lend_rate,报错Expression 'ztd.lend_rate' is not being grouped
在你提供的代码中,报错是由于你在SELECT子句中引用了一个未在GROUP BY子句中进行分组的列 ztd.lend_rate。Flink SQL要求在SELECT子句中引用的列必须要么进行聚合,要么在GROUP BY子句中进行分组。
为了解决这个问题,你可以在GROUP BY子句中添加 ztd.lend_rate 列,或者将其包装在聚合函数中。以下是修改后的代码示例:
```java
String sql = "SELECT id, data_cal_date, stock_block_code, stock_block_name, " +
"SUM(block_ref_compact_bal) AS block_ref_compact_bal " +
"FROM (" +
" SELECT UUID() AS id, '" + lastTD + "' AS data_cal_date, " +
" biv.stock_block_code, " +
" biv.stock_block_name, " +
" SUM(ztd.lend_rate * ztd.lend_num * twp.close_price) / SUM(ztd.lend_num * twp.close_price) AS block_ref_compact_bal " +
" FROM bid_info_view biv " +
" LEFT JOIN zrq_trade_detail ztd ON biv.ts_code = ztd.ts_code " +
" LEFT JOIN temp_wind_price twp ON biv.ts_code = twp.ts_code " +
" GROUP BY biv.stock_block_code, biv.stock_block_name, ztd.lend_rate" +
") t " +
"GROUP BY id, data_cal_date, stock_block_code, stock_block_name";
tEnv.executeSql(sql).print();
```
在这个修改后的代码中,我们将 ztd.lend_rate 列添加到了 GROUP BY 子句中,以满足 Flink SQL 的要求。或者,你也可以使用 SUM 聚合函数来对 ztd.lend_rate 进行聚合,这样就不需要将其添加到 GROUP BY 子句中。
请确保根据你的业务需求选择适当的解决方案。
String sql = "select id,data_cal_date,stock_block_code,stock_block_name,block_ref_compact_bal from(" + "SELECT UUID() as id,'" + lastTD + "' as data_cal_date," + "biv.stock_block_code," + "biv.stock_block_name," + "sum (ztd.lend_rate * ztd.lend_num * twp.close_price / sum(ztd.lend_num * twp.close_price)) as block_ref_compact_bal " + "from bid_info_view biv " + "left join zrq_trade_detail ztd on " + "biv.ts_code = ztd.ts_code " + "left join temp_wind_price twp " + "on biv.ts_code = twp.ts_code " + "group by biv.stock_block_code,biv.stock_block_name " + ")"; tEnv.executeSql(sql).print(); 报错SQL validation failed. From line 1, column 178 to line 1, column 267: Aggregate expressions cannot be nested
在你提供的代码中,报错是由于在聚合函数中嵌套了另一个聚合函数导致的。在 Flink SQL 中,聚合函数不能嵌套使用。
具体来说,你使用了两个聚合函数:`SUM(ztd.lend_rate * ztd.lend_num * twp.close_price)` 和 `SUM(ztd.lend_num * twp.close_price)`。这是不允许的。
为了解决这个问题,你可以将第一个聚合函数的计算结果提取为一个子查询,然后在外部查询中使用该结果进行计算。以下是修改后的代码示例:
```java
String sql = "SELECT id, data_cal_date, stock_block_code, stock_block_name, " +
"SUM(block_ref_compact_bal) AS block_ref_compact_bal " +
"FROM (" +
" SELECT UUID() AS id, '" + lastTD + "' AS data_cal_date, " +
" biv.stock_block_code, " +
" biv.stock_block_name, " +
" ztd.lend_rate * ztd.lend_num * twp.close_price / SUM(ztd.lend_num * twp.close_price) AS block_ref_compact_bal " +
" FROM bid_info_view biv " +
" LEFT JOIN zrq_trade_detail ztd ON biv.ts_code = ztd.ts_code " +
" LEFT JOIN temp_wind_price twp ON biv.ts_code = twp.ts_code " +
" GROUP BY biv.stock_block_code, biv.stock_block_name" +
") t " +
"GROUP BY id, data_cal_date, stock_block_code, stock_block_name";
tEnv.executeSql(sql).print();
```
在这个修改后的代码中,我们将第一个聚合函数的计算结果提取为子查询,并在外部查询中进行了第二个聚合函数的计算。这样就避免了聚合函数嵌套的问题。
请注意,如果你的 Flink 版本较低,可能不支持将聚合函数用于聚合结果的情况。在这种情况下,你可能需要将聚合函数的计算逻辑拆分为多个步骤,在中间步骤使用临时表或视图来保存部分结果。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)