Class: Integer
- Inherits:
-
Object
show all
- Defined in:
- lib/wukong/schema.rb,
lib/wukong/extensions/emittable.rb
Overview
Basic types: SQL conversion
Class Method Summary
collapse
Class Method Details
57
|
# File 'lib/wukong/schema.rb', line 57
def to_avro() 'int' end
|
28
|
# File 'lib/wukong/schema.rb', line 28
def to_pig() 'int' end
|
8
|
# File 'lib/wukong/schema.rb', line 8
def to_sql() 'INT' end
|
.unbooleanize(bool) ⇒ Object
Express boolean as 1 (true) or 0 (false). In contravention of typical ruby semantics (but in a way that is more robust for wukong-like batch processing), the number 0, the string ‘0’, nil and false are all considered false. (This also makes the method idempotent: repeated calls give same result.)
63
64
65
66
67
68
|
# File 'lib/wukong/extensions/emittable.rb', line 63
def self.unbooleanize bool
case bool
when 0, '0', false, nil then 0
else 1
end
end
|