logstash-plugins/logstash-integration-jdbc

prepared_statement_bind_values in jdbc_streaming doesn't handle nested fields

jsvd opened this issue · 0 comments

jsvd commented

This is because the ParameterHandler class tries to identify if there's either an interpolated reference (i.e. "%{[field]}") or a field reference (e.g. "[field]") in the values of prepared_statement_bind_values.

However, to detect the field references, a regex is used:

if given_value =~ /\A\s*\[[^\]]+\]\s*\z/
  return FieldParameter.new(given_value)
end

This regex can't handle nested field references:

irb(main):003:0> "[field]" =~ /\A\s*\[[^\]]+\]\s*\z/
=> 0
irb(main):004:0> "[nested][field]" =~ /\A\s*\[[^\]]+\]\s*\z/
=> nil

For now the workaround is to replace a "[nested][field]" reference with a "%{[nested][field]}" interpolation