class OdpsDatahub::OdpsTableRecord

Attributes

mSchema[R]
mValues[R]

Public Class Methods

new(schema) click to toggle source
# File lib/fluent/plugin/odps/odps_table.rb, line 32
def initialize(schema)
  @mSchema = schema
  @mValues = Array.new(@mSchema.getColumnCount)
end

Public Instance Methods

getColumnsCount() click to toggle source
# File lib/fluent/plugin/odps/odps_table.rb, line 37
def getColumnsCount
  @mSchema.getColumnCount
end
getTableSchema() click to toggle source
# File lib/fluent/plugin/odps/odps_table.rb, line 41
def getTableSchema
  @mSchema
end
getValue(idx) click to toggle source
# File lib/fluent/plugin/odps/odps_table.rb, line 45
def getValue(idx)
  if idx < 0 or idx >= @mSchema.getColumnCount
    raise "idx out of range"
  end
  @mValues.at(idx)
end
setBigInt(idx, value) click to toggle source
# File lib/fluent/plugin/odps/odps_table.rb, line 56
def setBigInt(idx, value)
  if value.is_a?Integer
    setValue(idx, value)
  else
    raise "value show be Integer"
  end
end
setBoolean(idx, value) click to toggle source
# File lib/fluent/plugin/odps/odps_table.rb, line 72
def setBoolean(idx, value)
  if value != false and value != true
    raise "value must be bool"
  end
  setValue(idx, value)
end
setDateTime(idx, value) click to toggle source
# File lib/fluent/plugin/odps/odps_table.rb, line 79
def setDateTime(idx, value)
  if value.is_a?Integer and value >= $DATETIME_MIN_TICKS and  value <=> $DATETIME_MAX_TICKS
    setValue(idx, value)
  else
    raise "DateTime out of range or value show be Integer"
  end
end
setDouble(idx, value) click to toggle source
# File lib/fluent/plugin/odps/odps_table.rb, line 64
def setDouble(idx, value)
  if value.is_a?Float
    setValue(idx, value)
  else
    raise "value show be Float"
  end
end
setNullValue(idx) click to toggle source
# File lib/fluent/plugin/odps/odps_table.rb, line 52
def setNullValue(idx)
  setValue(idx, nil)
end
setString(idx, value) click to toggle source
# File lib/fluent/plugin/odps/odps_table.rb, line 87
def setString(idx, value)
  if value.is_a?String and value.length < $STRING_MAX_LENTH
    setValue(idx, value)
  else
    raise "value show be String and len < #$STRING_MAX_LENTH"
  end
end

Private Instance Methods

setValue(idx, value) click to toggle source
# File lib/fluent/plugin/odps/odps_table.rb, line 96
def setValue(idx, value)
  if idx < 0 or idx >= @mSchema.getColumnCount
    raise "idx out of range"
  end
  @mValues[idx] = value
end