Class: OdpsDatahub::OdpsTableSchema
- Inherits:
-
Object
- Object
- OdpsDatahub::OdpsTableSchema
- Defined in:
- lib/fluent/plugin/odps/odps_table_schema.rb
Instance Attribute Summary collapse
-
#mCols ⇒ Object
Returns the value of attribute mCols.
Instance Method Summary collapse
- #appendColumn(name, type) ⇒ Object
- #getColumnCount ⇒ Object
- #getColumnType(idx) ⇒ Object
-
#initialize(jsonobj = nil) ⇒ OdpsTableSchema
constructor
A new instance of OdpsTableSchema.
Constructor Details
#initialize(jsonobj = nil) ⇒ OdpsTableSchema
Returns a new instance of OdpsTableSchema.
37 38 39 40 41 42 43 44 45 |
# File 'lib/fluent/plugin/odps/odps_table_schema.rb', line 37 def initialize(jsonobj = nil) @mCols = Array.new if jsonobj != nil columns = jsonobj["columns"] columns.each do |object| appendColumn(object["name"], object["type"]) end end end |
Instance Attribute Details
#mCols ⇒ Object
Returns the value of attribute mCols.
36 37 38 |
# File 'lib/fluent/plugin/odps/odps_table_schema.rb', line 36 def mCols @mCols end |
Instance Method Details
#appendColumn(name, type) ⇒ Object
58 59 60 61 |
# File 'lib/fluent/plugin/odps/odps_table_schema.rb', line 58 def appendColumn(name, type) col = OdpsTableColumn.new(name, type, @mCols.size) @mCols.push(col) end |
#getColumnCount ⇒ Object
47 48 49 |
# File 'lib/fluent/plugin/odps/odps_table_schema.rb', line 47 def getColumnCount @mCols.size end |
#getColumnType(idx) ⇒ Object
51 52 53 54 55 56 |
# File 'lib/fluent/plugin/odps/odps_table_schema.rb', line 51 def getColumnType(idx) if idx < 0 or idx >= @mCols.size raise "idx out of range" end @mCols.at(idx).mType end |