Data Pipeline Case Studies
Join Labels
Build a compact label string from the first records in a stream.
Join Labels
join_labels.lua
local limit =
local joined = ""
local count = 0
for _, label in ipairs({"red", "green", "blue"}) do
if count < limit then
if joined ~= "" then
joined = joined .. "|"
end
joined = joined .. label
count = count + 1
end
end
print("limit=" .. limit)
print("count=" .. count)
print("joined=" .. joined)
local limit =
local joined = ""
local count = 0
for _, label in ipairs({"red", "green", "blue"}) do
if count < limit then
if joined ~= "" then
joined = joined .. "|"
end
joined = joined .. label
count = count + 1
end
end
print("limit=" .. limit)
print("count=" .. count)
print("joined=" .. joined)
local limit =
local joined = ""
local count = 0
for _, label in ipairs({"red", "green", "blue"}) do
if count < limit then
if joined ~= "" then
joined = joined .. "|"
end
joined = joined .. label
count = count + 1
end
end
print("limit=" .. limit)
print("count=" .. count)
print("joined=" .. joined)
limit
The selected limit controls how many labels enter the joined output.
separator
The pipeline appends separators only between selected labels.