Add Iceberg properties in SHOW CREATE MATERIALIZED VIEW#12522
Add Iceberg properties in SHOW CREATE MATERIALIZED VIEW#12522findepi merged 2 commits intotrinodb:masterfrom
SHOW CREATE MATERIALIZED VIEW#12522Conversation
There was a problem hiding this comment.
Create the MV as it used to be created and update only the SHOW CREATE ... assertion:
Path schemaDirectory = getDistributedQueryRunner().getCoordinator().getBaseDataDir().resolve("iceberg_data/tpch");
assertThat((String) computeScalar("show create materialized view materialized_view_window"))
.matches("\\QCREATE MATERIALIZED VIEW " + qualifiedMaterializedViewName + "\n" +
"WITH (\n" +
" format = 'ORC',\n" +
" format_version = 2,\n" +
" location = '" + schemaDirectory + "/st_\\E[0-9a-f]+\\Q',\n" +
" partitioning = ARRAY['_date']\n" +
") AS\n" +
"SELECT\n" +
" _date\n" +
", sum(_bigint) OVER (PARTITION BY _date ORDER BY _date ASC) sum_ints\n" +
"FROM\n" +
" base_table1");There was a problem hiding this comment.
Thanks for your advice, I updated the commit.
There was a problem hiding this comment.
can icebergTable.location() be an empty string? when?
There was a problem hiding this comment.
This location is actually the location of the storage table, when the storage table is dropped and a storage table with an empty location with the same name is created, the location will be empty.
Full Screenshot:

In addition, does it need to be consistent with spark? Show location regardless of whether location is empty or not.

There was a problem hiding this comment.
This
locationis actually the location of the storage table, when the storage table is dropped and a storage table with an empty location with the same name is created, the location will be empty.
This is not a valid situation we need to care about.
If a storage table is manually replaced with something else, all sorts of problems may occur.
SHOW CREATE MATERIALIZED VIEW may fail in such case.
There was a problem hiding this comment.
thus, please remove the condition
There was a problem hiding this comment.
done, thanks!
Does this need to be modified? if so, I will submit another pr to modify it.
https://github.com/trinodb/trino/blob/master/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java#L1296
7029d2c to
45600b4
Compare
There was a problem hiding this comment.
On latest mater we're now also missing ORC_BLOOM_FILTER_COLUMNS and ORC_BLOOM_FILTER_FPP.
I would suggest extracting common code for this from IcebergMetadata#getTableMetadata and re-using it here to avoid the need to update in two places.
There was a problem hiding this comment.
Thanks for your advice!
I have another question, does SHOW CREATE TABLE need to show orc_bloom_filter_columns and orc_bloom_filter_fpp properties? These two properties are specific to the orc format and are not generic, I personally think they should be shown through $properties instead of SHOW CREATE TABLE, of course $properties can already show them now.
https://trino.io/docs/current/connector/iceberg.html#properties-table
There was a problem hiding this comment.
It looks like the bloom filter properties already don't show up in SHOW CREATE MV if bloom filter is not configured (correct me if I'm wrong). That behaviour seems ok to me.
It would be great if we also include a test in BaseIcebergMaterializedViewTest which uses the orc bloom filter properties.
There was a problem hiding this comment.
@raunaqmorarka I updated the testShowCreate() as I felt no need to add a separate test case to test this situation.
45600b4 to
8e444a6
Compare
8e444a6 to
8cca94b
Compare
|
Hi @findepi, could you please help me review or merge this PR when you have time? Thank you very much! |

Description
Show Iceberg location and format_version in
SHOW CREATE MATERIALIZED VIEW.Related issues, pull requests, and links
Fixes #12504
Documentation
(x) No documentation is needed.
Release notes
(x) Release notes entries required with the following suggested text: