Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/modifiers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ end
#TODO: Verificar se tem colunas duplicatas
FilterModifier(columns::Symbol...) = FilterModifier([columns...])

const EasyWarnings = Set()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problema que esse aviso fica armazenado no módulo. Caso a pessoa crie um novo stream, ela não vai ser avisada. Outra parada, o Set eu acho que é imutável. Dá uma conferida nisso.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Poderíamos tornar esse warn checker um atributo do Stream e em determinados procedimentos limpamos ele pra evitar que isso acabe inibindo o aviso de um futuro erro. Vou pensar mais um pouco nesse problema.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acho que teria que ser ... Problema que você nunca sabe o que está vindo.

warn(str::String, warnChecker::Set) = str in warnChecker || (@warn str) == nothing && push!(warnChecker, str)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Na verdade seria String ou Symbol. Tem que conferir se no dataframe o nome da coluna sempre vem em Symbol. Se for é symbol aqui.


function apply!(modifier::FilterModifier, data::DataFrame, event::Int)
columns = Symbol[]
for col in modifier.columns
if !(col in propertynames(data))
#TODO: Colocar para avisar somente uma única vez do problema.
@warn "O stream não possui a $col"
warn("O stream não possui a $col", EasyWarnings)
else
push!(columns, col)
end
Expand Down