class Object
Constants
- CHUNK_SIZE
- IDS
-
Pre-build data so data generation is not part of the measured work.
- NAMES
- ROWS
- TYPES
Public Instance Methods
Source
# File benchmark/appender_ips.rb, line 28 def new_table(con) con.query('DROP TABLE IF EXISTS t') con.query('CREATE TABLE t (id INTEGER, name VARCHAR)') end
Source
# File sample/issue922_benchmark.rb, line 120 def query_via_parquet(con, data_frame, name, parquet_path) data_frame.write_parquet(parquet_path) con.query("CREATE OR REPLACE TABLE #{name} AS SELECT * FROM read_parquet('#{parquet_path}')") con.query("SELECT * FROM #{name}").to_a end
Source
# File sample/issue930_benchmark.rb, line 35 def register_as_table_with_create_table(con, csv, name) headers = csv.first.headers csv.rewind con.execute("CREATE OR REPLACE TABLE #{name} (#{headers.map { |h| "#{h} VARCHAR" }.join(', ')})") csv.each do |row| values = row.map { |cell| "'#{cell[1]}'" }.join(', ') con.execute("INSERT INTO #{name} VALUES (#{values})") end end
Source
# File benchmark/appender_ips.rb, line 33 def with_appender db = DuckDB::Database.open con = db.connect new_table(con) app = con.appender('t') yield app app.flush ensure con&.close db&.close end