我是Hive的新手并且引发了sql技术。我曾在spark sql中尝试过limit子句。但它只支持从零开始到特定限制的特定限制。但我想从特定的起始点检索行到特定的终点。可以请任何人建议实现此目的的方法。
Query1 :: SELECT * FROM `Emp` LIMIT 10; - this query supports in both sql and spark sql
但
Query2 :: SELECT * FROM `Emp` LIMIT 10,20; - to retrive rows from 10 to 20 supports in sql, but not in spark sql.
答案 0 :(得分:0)
尝试修改LEFT JOIN:
var res = aFlightList
.GroupBy(item =>
// State that you want to group by date
item.FlightDate,
// Will be called for each pair, you don't use the key as it's already part of the original object you will return, here for each group you'll only return a single item, the lowest priced one and will end up with an IEnumerable containing the cheapest one of each group
(key, pairs) => pairs
.OrderBy(p => p.PriceView)
.First());
答案 1 :(得分:0)
您可以在HQL中使用ROW_NUMBER
SELECT *,ROW_NUMBER over (Order by id) as rowid FROM `Emp`
where rowid > 10 and rowid <=20;