我不擅长 SQL,我想在下面的查询中使用分区来获取 MAX,但是当我在没有该最大驱动列的 where 子句的情况下使用相同的查询时,它会说该列不存在,但是如果我从 where 中删除该列我可以在选择中看到存在相同的列。
select
MAX(case when total_split_count = 0 or total_split_count is null then total_split_count else 1 end) OVER (PARTITION BY ia.col1,ia.col2,ia.col3,ia.col4,ia.col5,ia.col6) as bb
from audits.tbl_name ia
where bb = 1
Run Code Online (Sandbox Code Playgroud)
错误:列“bb”不存在位置:304
其中 bb = 1 ^ 1 语句失败。
但查询使用 where 子句运行:
select
MAX(case when total_split_count = 0 or total_split_count is null then total_split_count else 1 end) OVER (PARTITION BY ia.col1,ia.col2,ia.col3,ia.col4,ia.col5,ia.col6) as bb
from audits.tbl_name ia
Run Code Online (Sandbox Code Playgroud)
注意:我在运行时通过“as”创建了该列。
这是vi编辑器中file1的输出 -
xyz|123|2013-12-22|2014-02-28
xyz|123|2013-12-29|2014-01-04
xyz|123|2013-12-29|2014-01-04
xyz|123|2013-12-29|2014-01-04
xyz|123|2013-12-29|2014-01-04
xyz|123|2013-12-29|2014-01-04
xyz|123|2013-12-29|2014-01-04
Run Code Online (Sandbox Code Playgroud)
所以在每一行的末尾我得到'$'所以它的意思是行尾.
我想从hadoop文件系统中读取unix框中的逐行记录:
示例 -
while read line
do
echo "input record " $line
###some other logic i have here....
done < /user/want/to/read/from/hadoop/part00
Run Code Online (Sandbox Code Playgroud)
上面的代码片段显示错误 -
**: cannot open [No such file or directory]**
Run Code Online (Sandbox Code Playgroud)
如何使用Unix工具从Hadoop中读取?
在克隆任何 repo 之前,我已经编写了完整的代码,现在我决定直接从 pycharm IDE 将整个代码推送到新的 repo 中。
有谁知道怎么做。