Search code examples
minimuminfinitykdb+q-lang

Kdb/Q Group By Minimum gives infinity


Kdb calculates infinity for null column if group by is performed.

t:([]a: 1 1 2;b: 3 2 0n)
select min b by a from t

a       
1   2.0
2   ow

ow is infinity.

Is there any way I can get null(0n) for 2


Solution

  • That's the expected result; you need to update afterwards:

    update b:?[0w=b;0N;b] from select min b by a from t