Class: Fluent::GroongaOutput::Schema::TypeGuesser

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/out_groonga.rb

Instance Method Summary collapse

Constructor Details

#initialize(sample_values) ⇒ TypeGuesser

Returns a new instance of TypeGuesser.



163
164
165
# File 'lib/fluent/plugin/out_groonga.rb', line 163

def initialize(sample_values)
  @sample_values = sample_values
end

Instance Method Details

#guessObject



167
168
169
170
171
172
173
174
175
# File 'lib/fluent/plugin/out_groonga.rb', line 167

def guess
  return "Time"          if time_values?
  return "Int32"         if int32_values?
  return "Int64"         if int64_values?
  return "Float"         if float_values?
  return "WGS84GeoPoint" if geo_point_values?

  "Text"
end

#vector?Boolean

Returns:



177
178
179
180
181
# File 'lib/fluent/plugin/out_groonga.rb', line 177

def vector?
  @sample_values.any? do |sample_value|
    sample_value.is_a?(Array)
  end
end