-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: 'global_rule' is a boolean value #1473
Comments
I guess the problem happens there: I am not quite understand the tombstone mechanism. Is the memory footprint so high that we need to use some trick? Can we implement an iterator to hide the detail? |
@spacewander you are right. If the original data is deleted, it is marked as "false". This is why we need to check the data type first.
can you provide an example? I can't imagine it. |
In Lua, we can implement custom iterator to iterate table, for instance: local t = {{"a"}, false, {"b"}}
local function _iterate_values(self, tab)
while true do
self.idx = self.idx + 1
local v = tab[self.idx]
if type(v) == "table" then
return self.idx, v
end
if v == nil then
return nil, nil
end
-- skip other type of values
end
end
local function iterate_values(tab)
local iter = setmetatable({idx = 0}, {__call = _iterate_values})
return iter, tab, 0
end
local j = 0
for k = 1, 1e5 do
for i, v in iterate_values(t) do
j = j + i
end
end
|
Well done, a very good solution. We can use this method to iterate over all values. |
Steps to reproduce:
One photo from community:
This patch should be fine, and we need to add test case for confirming.
The text was updated successfully, but these errors were encountered: