Presto 0.141t Documentation

11.1. Black Hole Connector

11.1. Black Hole Connector

The Black Hole connector is a testbed for performing various kinds of tests. Primarily it is designed for high performance testing of other components. Thus it works like the /dev/null device on Unix-like operating systems for data writing and like /dev/null or /dev/zero for data reading. However it also has some other features that allow testing Presto in a more controlled manner. Metadata for any tables created via this connector is kept in memory on the coordinator and discarded when Presto restarts. Created tables are by default always empty, and any data written to them will be ignored and data reads will return no rows.

During table creation, a desired rows number can be specified. In such case, writes will behave in the same way, but reads will always return specified number of some constant rows. You shouldn’t rely on the content of such rows.

Warning

This connector will not work properly with multiple coordinators, since each coordinator will have a different metadata.

Configuration

To configure the Black Hole connector, create a catalog properties file etc/catalog/blackhole.properties with the following contents:

connector.name=blackhole

Examples

Create a table using the blackhole connector:

CREATE TABLE blackhole.test.nation AS
SELECT * from tpch.tiny.nation;

Insert data into a table in the blackhole connector:

INSERT INTO blackhole.test.nation
SELECT * FROM tpch.tiny.nation;

Select from the blackhole connector:

SELECT count(*) FROM blackhole.test.nation;

The above query will always return zero.

Create a table with constant number of rows (500 * 1000 * 2000):

CREATE TABLE blackhole.test.nation (
  nationkey bigint,
  name varchar
)
WITH (
  split_count = 500,
  pages_per_split = 1000,
  rows_per_page = 2000
);

Now query it:

SELECT count(*) FROM blackhole.test.nation;

The above query will return 1,000,000,000.

Length of variable length columns can be controled using field_length table property (default value is equal to 16):

CREATE TABLE blackhole.test.nation (
  nationkey bigint,
  name varchar
)
WITH (
  split_count = 500,
  pages_per_split = 1000,
  rows_per_page = 2000,
  field_length = 100
);

The consuming/producing rate can be slowed down using the page_processing_delay table property. Setting this property to ‘5s’ will lead to 5 seconds sleep before consuming or producing new page:

CREATE TABLE blackhole.test.delay (
  dummy bigint
)
WITH (
  split_count = 1,
  pages_per_split = 1,
  rows_per_page = 1,
  page_processing_delay = '5s'
);

select count(*) from blackhole.test.delay;
 _col0
-------
     1
(1 row)

Query 20151109_104031_00006_tp8hq, FINISHED, 1 node
Splits: 2 total, 2 done (100.00%)
0:05 [1 rows, 0B] [0 rows/s, 0B/s]