KDB排除具有空值的行

big*_*377 2 null kdb

我有一个表,其中有一些具有空值的单元格(散布在数据集中).是否有任何简单的方法可以排除任何列中具有null的所有行?

我只是想避免这个......

select from T where not null col1, not null col2, not null col3, etc... 
Run Code Online (Sandbox Code Playgroud)

Rya*_*ton 7

使用简单的列表函数可以轻松读取代码或函数形式以提高速度.函数形式将更快,因为它不会扫描通过过滤器每个阶段的所有列.

q)t:flip `a`b`c`d`e!flip {5?(x;0N)} each til 10
q)t
a b c d e
---------
0       0
  1   1
  2 2 2
3 3   3 3
4 4 4 4 4
      5 5
        6
7 7
  8     8
9 9   9 9

// simple way
q)where all each not null t
,4
q)t where all each not null t
a b c d e
---------
4 4 4 4 4

// faster
q)?[t;{(not;(null;x))} each cols t; 0b; ()]
a b c d e
---------
4 4 4 4 4
Run Code Online (Sandbox Code Playgroud)