Class: Iceberg::Table
- Inherits:
-
Object
- Object
- Iceberg::Table
- Defined in:
- lib/iceberg/table.rb
Direct Known Subclasses
Instance Method Summary collapse
- #append(df) ⇒ Object
- #current_schema ⇒ Object (also: #schema)
- #current_schema_id ⇒ Object (also: #schema_id)
- #current_snapshot ⇒ Object
- #current_snapshot_id ⇒ Object
- #default_partition_spec ⇒ Object
- #default_partition_spec_id ⇒ Object
- #default_sort_order ⇒ Object
- #default_sort_order_id ⇒ Object
- #encryption_keys ⇒ Object
- #format_version ⇒ Object
- #history ⇒ Object
-
#initialize(table, catalog) ⇒ Table
constructor
A new instance of Table.
-
#inspect ⇒ Object
hide internal state.
- #last_column_id ⇒ Object
- #last_partition_id ⇒ Object
- #last_sequence_number ⇒ Object
- #last_updated_at ⇒ Object
- #location ⇒ Object
- #metadata_log ⇒ Object
- #next_row_id ⇒ Object
- #next_sequence_number ⇒ Object
- #partition_spec_by_id(partition_spec_id) ⇒ Object
- #partition_specs ⇒ Object
- #partition_statistics ⇒ Object
- #partition_statistics_for_snapshot(snapshot_id) ⇒ Object
- #properties ⇒ Object
- #refresh ⇒ Object
- #scan(snapshot_id: nil) ⇒ Object
- #schema_by_id(schema_id) ⇒ Object
- #schemas ⇒ Object
- #snapshot_by_id(snapshot_id) ⇒ Object
- #snapshots ⇒ Object
- #sort_orders ⇒ Object
- #statistics ⇒ Object
- #statistics_for_snapshot(snapshot_id) ⇒ Object
- #to_a(snapshot_id: nil) ⇒ Object
- #to_polars(snapshot_id: nil, storage_options: nil) ⇒ Object
- #uuid ⇒ Object
Constructor Details
#initialize(table, catalog) ⇒ Table
Returns a new instance of Table.
3 4 5 6 |
# File 'lib/iceberg/table.rb', line 3 def initialize(table, catalog) @table = table @catalog = catalog end |
Instance Method Details
#append(df) ⇒ Object
161 162 163 164 165 166 |
# File 'lib/iceberg/table.rb', line 161 def append(df) check_catalog df = ArrowRecordBatch.new(df, schema.arrow_c_schema) if df.is_a?(Array) @table = @table.append(df.arrow_c_stream, @catalog) nil end |
#current_schema ⇒ Object Also known as: schema
53 54 55 |
# File 'lib/iceberg/table.rb', line 53 def current_schema .current_schema end |
#current_schema_id ⇒ Object Also known as: schema_id
58 59 60 |
# File 'lib/iceberg/table.rb', line 58 def current_schema_id .current_schema_id end |
#current_snapshot ⇒ Object
95 96 97 |
# File 'lib/iceberg/table.rb', line 95 def current_snapshot .current_snapshot end |
#current_snapshot_id ⇒ Object
99 100 101 |
# File 'lib/iceberg/table.rb', line 99 def current_snapshot_id .current_snapshot_id end |
#default_partition_spec ⇒ Object
71 72 73 |
# File 'lib/iceberg/table.rb', line 71 def default_partition_spec .default_partition_spec end |
#default_partition_spec_id ⇒ Object
75 76 77 |
# File 'lib/iceberg/table.rb', line 75 def default_partition_spec_id .default_partition_spec_id end |
#default_sort_order ⇒ Object
107 108 109 |
# File 'lib/iceberg/table.rb', line 107 def default_sort_order .default_sort_order end |
#default_sort_order_id ⇒ Object
111 112 113 |
# File 'lib/iceberg/table.rb', line 111 def default_sort_order_id .default_sort_order_id end |
#encryption_keys ⇒ Object
135 136 137 |
# File 'lib/iceberg/table.rb', line 135 def encryption_keys .encryption_keys end |
#format_version ⇒ Object
12 13 14 |
# File 'lib/iceberg/table.rb', line 12 def format_version .format_version end |
#history ⇒ Object
87 88 89 |
# File 'lib/iceberg/table.rb', line 87 def history .history end |
#inspect ⇒ Object
hide internal state
169 170 171 |
# File 'lib/iceberg/table.rb', line 169 def inspect to_s end |
#last_column_id ⇒ Object
32 33 34 |
# File 'lib/iceberg/table.rb', line 32 def last_column_id .last_column_id end |
#last_partition_id ⇒ Object
36 37 38 |
# File 'lib/iceberg/table.rb', line 36 def last_partition_id .last_partition_id end |
#last_sequence_number ⇒ Object
24 25 26 |
# File 'lib/iceberg/table.rb', line 24 def last_sequence_number .last_sequence_number end |
#last_updated_at ⇒ Object
40 41 42 43 |
# File 'lib/iceberg/table.rb', line 40 def last_updated_at ms = .last_updated_ms Time.at(ms / 1000, ms % 1000, :millisecond) end |
#location ⇒ Object
20 21 22 |
# File 'lib/iceberg/table.rb', line 20 def location .location end |
#metadata_log ⇒ Object
91 92 93 |
# File 'lib/iceberg/table.rb', line 91 def . end |
#next_row_id ⇒ Object
139 140 141 |
# File 'lib/iceberg/table.rb', line 139 def next_row_id .next_row_id end |
#next_sequence_number ⇒ Object
28 29 30 |
# File 'lib/iceberg/table.rb', line 28 def next_sequence_number .next_sequence_number end |
#partition_spec_by_id(partition_spec_id) ⇒ Object
67 68 69 |
# File 'lib/iceberg/table.rb', line 67 def partition_spec_by_id(partition_spec_id) .partition_spec_by_id(partition_spec_id) end |
#partition_specs ⇒ Object
63 64 65 |
# File 'lib/iceberg/table.rb', line 63 def partition_specs .partition_specs end |
#partition_statistics ⇒ Object
123 124 125 |
# File 'lib/iceberg/table.rb', line 123 def partition_statistics .partition_statistics end |
#partition_statistics_for_snapshot(snapshot_id) ⇒ Object
131 132 133 |
# File 'lib/iceberg/table.rb', line 131 def partition_statistics_for_snapshot(snapshot_id) .partition_statistics_for_snapshot(snapshot_id) end |
#properties ⇒ Object
115 116 117 |
# File 'lib/iceberg/table.rb', line 115 def properties .properties end |
#refresh ⇒ Object
8 9 10 |
# File 'lib/iceberg/table.rb', line 8 def refresh @table = @catalog.load_table(@table.identifier) end |
#scan(snapshot_id: nil) ⇒ Object
143 144 145 |
# File 'lib/iceberg/table.rb', line 143 def scan(snapshot_id: nil) TableScan.new(@table.scan(snapshot_id), self) end |
#schema_by_id(schema_id) ⇒ Object
49 50 51 |
# File 'lib/iceberg/table.rb', line 49 def schema_by_id(schema_id) .schema_by_id(schema_id) end |
#schemas ⇒ Object
45 46 47 |
# File 'lib/iceberg/table.rb', line 45 def schemas .schemas end |
#snapshot_by_id(snapshot_id) ⇒ Object
83 84 85 |
# File 'lib/iceberg/table.rb', line 83 def snapshot_by_id(snapshot_id) .snapshot_by_id(snapshot_id) end |
#snapshots ⇒ Object
79 80 81 |
# File 'lib/iceberg/table.rb', line 79 def snapshots .snapshots end |
#sort_orders ⇒ Object
103 104 105 |
# File 'lib/iceberg/table.rb', line 103 def sort_orders .sort_orders end |
#statistics ⇒ Object
119 120 121 |
# File 'lib/iceberg/table.rb', line 119 def statistics .statistics end |
#statistics_for_snapshot(snapshot_id) ⇒ Object
127 128 129 |
# File 'lib/iceberg/table.rb', line 127 def statistics_for_snapshot(snapshot_id) .statistics_for_snapshot(snapshot_id) end |
#to_a(snapshot_id: nil) ⇒ Object
147 148 149 |
# File 'lib/iceberg/table.rb', line 147 def to_a(snapshot_id: nil) scan(snapshot_id: snapshot_id).to_a end |
#to_polars(snapshot_id: nil, storage_options: nil) ⇒ Object
151 152 153 154 155 156 157 158 159 |
# File 'lib/iceberg/table.rb', line 151 def to_polars(snapshot_id: nil, storage_options: nil) require "polars-df" if Gem::Version.new(Polars::VERSION) < Gem::Version.new("0.26.1") raise "Requires polars-df >= 0.26.1" end Polars.scan_iceberg(self, snapshot_id:, storage_options:) end |
#uuid ⇒ Object
16 17 18 |
# File 'lib/iceberg/table.rb', line 16 def uuid .uuid end |