Skip to content

Commit

Permalink
Add views to SQL support
Browse files Browse the repository at this point in the history
  • Loading branch information
mosabua authored and electrum committed Jul 23, 2021
1 parent ef1c946 commit 3c8042b
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion docs/src/main/sphinx/connector/iceberg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ supports the following features:
* :doc:`/sql/insert`
* :doc:`/sql/delete`, see also :ref:`iceberg-delete`
* :ref:`sql-schema-table-management`, see also :ref:`iceberg-tables`
* :ref:`sql-materialized-views-management`
* :ref:`sql-materialized-views-management`, see also
:ref:`iceberg-materialized-views`
* :ref:`sql-views-management`

.. _iceberg-tables:
Expand Down Expand Up @@ -197,6 +198,8 @@ The connector supports queries of the table partitions. Given a table ``custome
``SELECT * FROM iceberg.testdb."customer_orders$partitions"`` shows the table partitions, including the minimum
and maximum values for the partition columns.

.. _iceberg-table-properties:

Iceberg table properties
------------------------

Expand Down Expand Up @@ -226,3 +229,35 @@ and a file system location of ``/var/my_tables/test_table``::
format = 'PARQUET',
partitioning = ARRAY['c1', 'c2'],
location = '/var/my_tables/test_table')

.. _iceberg-materialized-views:

Materialized views
------------------

The Iceberg connector supports :ref:`sql-materialized-views-management`. In the
underlying system each materialized view consists of a view definition and an
Iceberg storage table. The storage table name is stored as a materialized view
property. The data is stored in that storage table.

You can use the :ref:`iceberg-table-properties` to control the created storage
table and therefore the layout and performance. For example, you can use the
following clause with :doc:`/sql/create-materialized-view` to use the ORC format
for the data files and partition the storage per day using the column
``_date``::

WITH ( format = 'ORC', partitioning = ARRAY['event_date'] )

Updating the data in the materialized view with
:doc:`/sql/refresh-materialized-view` deletes the data from the storage table,
and inserts new data that is the result of executing the materialized view
query.

.. warning::

There is a small time window between the commit of the delete and insert,
when the materialized view is empty. If the commit operation for the insert
fails, the materialized view remains empty.

Dropping a materialized view with :doc:`/sql/refresh-materialized-view` removes
the definition and the storage table.

0 comments on commit 3c8042b

Please sign in to comment.