rdblue commented on a change in pull request #3387:
URL: https://github.com/apache/iceberg/pull/3387#discussion_r749816365
##########
File path: core/src/main/java/org/apache/iceberg/TableProperties.java
##########
@@ -244,4 +245,41 @@ private TableProperties() {
public static final String UPSERT_MODE_ENABLE = "write.upsert.enable";
public static final boolean UPSERT_MODE_ENABLE_DEFAULT = false;
+
+ /**
+ * Get a table property for a specific Iceberg action's config option.
+ * <p>
+ * For example, {@link
org.apache.iceberg.actions.RewriteDataFiles#TARGET_FILE_SIZE_BYTES} corresponds
to
+ * table property actions.rewrite-data-files.target-file-size-bytes
+ *
+ * @param action name of the iceberg action, retrieved from the NAME
variable of the specific action if exists.
+ * The name is assumed to be in lower-case-kebab-style.
+ * @param option config option name, typically defined as public static
variables in the specific action.
+ * The name is assumed to be in lower-case-kebab-style.
+ * @return table property name
+ */
+ public static String actionTableProperty(String action, String option) {
+ return String.format("actions.%s.%s", action, option);
+ }
+
+ /**
+ * Get a table property for a specific Iceberg action and strategy's config
option.
+ * <p>
+ * For example, {@link
org.apache.iceberg.actions.BinPackStrategy#MIN_INPUT_FILES} corresponds to
+ * table property
actions.rewrite-data-files.strategies.binpack.min-input-files
+ *
+ * @param action name of the iceberg action, retrieved from the NAME
variable of the specific action if exists.
+ * The name is assumed to be in lower-case-kebab-style.
+ * @param strategy name of the strategy, retrieved from the name method of
the specific strategy,
+ * such as {@link
org.apache.iceberg.actions.RewriteStrategy#name()}.
+ * The name is assumed to be in
CAPITALIZED_CASE_SNAKE_STYLE, and is converted to
+ * lower-case-kebab-style in the config key.
+ * @param option config option name, typically defined as public static
variables in the specific strategy.
+ * The name is assumed to be in lower-case-kebab-style.
+ * @return table property name
+ */
+ public static String actionStrategyTableProperty(String action, String
strategy, String option) {
Review comment:
I think that the idea behind using properties is that users don't need
to know which properties are defined by the strategy or which are defined by
the action. The error message is "not supported by the action or the strategy".
So let's just keep this to `actions.<action-name>.<option>` to keep it simple.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]