有效删除包含空值的行
对于包含许多行的表,删除包含任何空值的行的最有效方法是什么?
另外,为什么我会收到错误
错误:'时间(尝试使用变量时间而不先定义/分配
,
即使我在使用功能选择
时没有任何名为'时间'的内容?[ t;{(not;(null;x))} 每个 cols t; ()]
在 这个 S/O 答案?
What is the most efficient way to remove rows containing any null values, for a table with many rows?
Additionally, why do I get the error
ERROR: 'time (attempt to use variable time without defining/assigning first
even though I have nothing named as ‘time’ when using the functional select
?[t;{(not;(null;x))} each cols t; 0b; ()]
given in this S/Oanswer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的表是在内存中还是在磁盘上?
如果您的表位于内存中,那么简单的表单也可能是最快的。
如果表格在磁盘上展开,游戏就会改变。在展开表中,每一列都存储为一个文件。 Select 运算符的第二个参数是约束列表;每一个都是一棵解析树。上面的
null Flip t
会测试t
的每个单元格,而 Select 会连续应用约束:仅测试已通过先前约束的行以进行下一个约束。如果没有行满足第一个约束,则可能根本不需要读取后续列文件。由此遵循以下规则:按限制性降序列出约束 - 如果空值在某些列中更常见,请首先测试它们。
关于内存中测试,请注意,
not any
可能比all not
快很多,具体取决于 null 是否常见。Is your table in memory or splayed on disk?
If your table is in memory, then a simple form might also be the fastest.
If the table is splayed on disk, the game changes. In a splayed table each column is stored as a file. The second argument of the Select operator is a list of constraints; each one a parse tree. Whereas
null flip t
above tests every cell oft
, Select applies is constraints successively: only rows that have passed previous constraints are tested for the next. If no rows satisfy the first constraint/s subsequent column files may never need to be read at all.From this follows the rule: list your constraints in descending order of restrictiveness – if nulls are more common in certain columns, test them first.
Regarding an in-memory test, note that
not any
can be a good deal faster thanall not
, depending on whether nulls are common.