Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/trino-plugin-toolkit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@
<optional>true</optional>
</dependency>

<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.trino.plugin.base.util;

import com.google.errorprone.annotations.FormatMethod;
import io.trino.spi.TrinoException;

import static io.trino.spi.StandardErrorCode.INVALID_PROCEDURE_ARGUMENT;
import static java.lang.String.format;

public final class Procedures
{
private Procedures() {}

@FormatMethod
public static void checkProcedureArgument(boolean condition, String message, Object... args)
Comment thread
homar marked this conversation as resolved.
Outdated
{
if (!condition) {
throw new TrinoException(INVALID_PROCEDURE_ARGUMENT, format(message, args));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@
import static io.trino.plugin.hive.HiveCompressionCodec.ZSTD;
import static io.trino.plugin.iceberg.CatalogType.HIVE_METASTORE;
import static io.trino.plugin.iceberg.IcebergFileFormat.ORC;
import static java.util.concurrent.TimeUnit.DAYS;
import static java.util.concurrent.TimeUnit.SECONDS;

public class IcebergConfig
{
public static final int FORMAT_VERSION_SUPPORT_MIN = 1;
public static final int FORMAT_VERSION_SUPPORT_MAX = 2;
public static final String EXPIRE_SNAPSHOTS_MIN_RETENTION = "iceberg.expire_snapshots.min-retention";
public static final String DELETE_ORPHAN_FILES_MIN_RETENTION = "iceberg.delete_orphan_files.min-retention";

private IcebergFileFormat fileFormat = ORC;
private HiveCompressionCodec compressionCodec = ZSTD;
Expand All @@ -45,6 +48,8 @@ public class IcebergConfig
private boolean projectionPushdownEnabled = true;
private Optional<String> hiveCatalogName = Optional.empty();
private int formatVersion = FORMAT_VERSION_SUPPORT_MIN;
private Duration expireSnapshotsMinRetention = new Duration(7, DAYS);
private Duration deleteOrphanFilesMinRetention = new Duration(7, DAYS);

public CatalogType getCatalogType()
{
Expand Down Expand Up @@ -202,4 +207,32 @@ public IcebergConfig setFormatVersion(int formatVersion)
this.formatVersion = formatVersion;
return this;
}

@NotNull
public Duration getExpireSnapshotsMinRetention()
{
return expireSnapshotsMinRetention;
}

@Config(EXPIRE_SNAPSHOTS_MIN_RETENTION)
@ConfigDescription("Minimal retention period for expire_snapshot procedure")
public IcebergConfig setExpireSnapshotsMinRetention(Duration expireSnapshotsMinRetention)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there documentation you would like to extend already?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not aware of any documentation but I may be missing something.

{
this.expireSnapshotsMinRetention = expireSnapshotsMinRetention;
return this;
}

@NotNull
public Duration getDeleteOrphanFilesMinRetention()
{
return deleteOrphanFilesMinRetention;
}

@Config(DELETE_ORPHAN_FILES_MIN_RETENTION)
@ConfigDescription("Minimal retention period for delete_orphan_files procedure")
public IcebergConfig setDeleteOrphanFilesMinRetention(Duration deleteOrphanFilesMinRetention)
{
this.deleteOrphanFilesMinRetention = deleteOrphanFilesMinRetention;
return this;
}
}
Loading