@@ -23,32 +23,58 @@ class Data < ActiveRecord::Base
2323 table . boolean :boolean_column
2424 table . bigint :bigint_column
2525 end
26- Data . create ( :string_column => "Hello" ,
27- :date_column => @date_value ,
28- :datetime_column => @datetime_value ,
29- :boolean_column => false ,
30- :bigint_column => @bigint_value )
26+ Data . create ( string_column : "Hello" ,
27+ date_column : @date_value ,
28+ datetime_column : @datetime_value ,
29+ boolean_column : false ,
30+ bigint_column : @bigint_value )
31+ Data . create ( string_column : "Hello2" ,
32+ date_column : @date_value + 1 ,
33+ datetime_column : @datetime_value + 1 ,
34+ boolean_column : true ,
35+ bigint_column : -@bigint_value - 1 )
36+ end
37+
38+ teardown do
39+ ActiveRecord ::Base . connection . drop_table ( :data )
40+ end
41+
42+ test "one" do
43+ arrow = Data . all . select ( :id ) . to_arrow
44+ assert_equal ( <<-RECORD_BATCH , arrow . each_record_batch . first . to_s )
45+ id: [
46+ 1,
47+ 2
48+ ]
49+ RECORD_BATCH
3150 end
3251
3352 test "all" do
34- assert_equal ( <<-RECORD_BATCH , Data . all . to_arrow . each_record_batch . first . to_s )
53+ arrow = Data . all . to_arrow
54+ assert_equal ( <<-RECORD_BATCH , arrow . each_record_batch . first . to_s )
3555id: [
36- 1
56+ 1,
57+ 2
3758 ]
3859string_column: [
39- "Hello"
60+ "Hello",
61+ "Hello2"
4062 ]
4163date_column: [
42- #{ @date_value }
64+ #{ @date_value } ,
65+ #{ @date_value + 1 }
4366 ]
4467datetime_column: [
45- #{ @datetime_value . strftime ( "%Y-%m-%d %H:%M:%S.%9N" ) }
68+ #{ @datetime_value . strftime ( "%Y-%m-%d %H:%M:%S.%9N" ) } ,
69+ #{ ( @datetime_value + 1 ) . strftime ( "%Y-%m-%d %H:%M:%S.%9N" ) }
4670 ]
4771boolean_column: [
48- false
72+ false,
73+ true
4974 ]
5075bigint_column: [
51- #{ @bigint_value }
76+ #{ @bigint_value } ,
77+ #{ -@bigint_value - 1 }
5278 ]
5379 RECORD_BATCH
5480 end
0 commit comments