English 中文(简体)
假设情况
原标题:Hive count over partition by in case when
  • 时间:2016-10-05 06:48:45
  •  标签:
  • hive
  • hiveql

我有两个问题:

select count(*) over (partition by col1) from t1

以及

select case when count(*) over (partition by col1) >1 then 1 else 0 end from t1

第一个罚款。 然而,第二种错误是:

Invalid column reference  count : (possible column names are: <all columns in t1>)

将任何栏目名称改为*,载于count

What causes the problem? I haven t found any restrictions in dosc for case when 以及 over partition by together.

问题回答

Try this:

select COUNT(CASE WHEN >1 THEN 1 ELSE 0 END) over (partition by col1) from t1;




相关问题
How to connect to Hadoop/Hive from .NET

I am working on a solution where I will have a Hadoop cluster with Hive running and I want to send jobs and hive queries from a .NET application to be processed and get notified when they are done. I ...

Difference between Pig and Hive? Why have both? [closed]

My background - 4 weeks old in the Hadoop world. Dabbled a bit in Hive, Pig and Hadoop using Cloudera s Hadoop VM. Have read Google s paper on Map-Reduce and GFS (PDF link). I understand that- Pig s ...

Even data distribution on hadoop/hive

I am trying a small hadoop setup (for experimentation) with just 2 machines. I am loading about 13GB of data, a table of around 39 million rows, with a replication factor of 1 using Hive. My problem ...

Building Apache Hive - impossible to resolve dependencies

I am trying out the Apache Hive as per http://wiki.apache.org/hadoop/Hive/GettingStarted and am getting this error from Ivy: Downloaded file size doesn t match expected Content Length for http://...

热门标签