Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AMORO-2338] Incorrect display of props in hive upgrade page #2339

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import com.netease.arctic.server.catalog.MixedHiveCatalogImpl;
import com.netease.arctic.server.catalog.ServerCatalog;
import com.netease.arctic.server.dashboard.ServerTableDescriptor;
import com.netease.arctic.server.dashboard.ServerTableProperties;
import com.netease.arctic.server.dashboard.model.AMSColumnInfo;
import com.netease.arctic.server.dashboard.model.AmoroSnapshotsOfTable;
import com.netease.arctic.server.dashboard.model.DDLInfo;
Expand Down Expand Up @@ -248,7 +247,6 @@ public void getUpgradeHiveTableProperties(Context ctx) throws IllegalAccessExcep
.filter(key -> !key.endsWith("_DEFAULT"))
.forEach(
key -> keyValues.put(tableProperties.get(key), tableProperties.get(key + "_DEFAULT")));
ServerTableProperties.HIDDEN_EXPOSED.forEach(keyValues::remove);
Map<String, String> hiveProperties =
AmsUtil.getNotDeprecatedAndNotInternalStaticFields(HiveTableProperties.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.netease.arctic.ams.api.Constants;
import com.netease.arctic.ams.api.TableIdentifier;
import com.netease.arctic.server.utils.Configurations;
import com.netease.arctic.table.HiddenProperties;

import java.io.File;
import java.io.PrintWriter;
Expand Down Expand Up @@ -99,6 +100,7 @@ public static Map<String, String> getNotDeprecatedAndNotInternalStaticFields(Cla
// filter out the non-static fields
.filter(f -> Modifier.isStatic(f.getModifiers()))
.filter(f -> f.getAnnotation(Deprecated.class) == null)
.filter(f -> f.getAnnotation(HiddenProperties.class) == null)
// collect to list
.collect(Collectors.toList());

Expand Down
33 changes: 33 additions & 0 deletions core/src/main/java/com/netease/arctic/table/HiddenProperties.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 com.netease.arctic.table;

import static java.lang.annotation.ElementType.FIELD;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Annotation for hidden properties. TableProperties annotated with this annotation will not be
* displayed on the relevant pages of the AMS.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(FIELD)
public @interface HiddenProperties {}
56 changes: 37 additions & 19 deletions core/src/main/java/com/netease/arctic/table/TableProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,18 @@

private TableProperties() {}

@HiddenProperties
public static final String TABLE_PARTITION_PROPERTIES = "table.partition-properties";

@HiddenProperties
public static final String BASE_TABLE_MAX_TRANSACTION_ID = "base.table.max-transaction-id";

public static final String PARTITION_OPTIMIZED_SEQUENCE = "max-txId";
public static final String PARTITION_BASE_OPTIMIZED_TIME = "base-op-time";
@HiddenProperties public static final String PARTITION_OPTIMIZED_SEQUENCE = "max-txId";
@HiddenProperties public static final String PARTITION_BASE_OPTIMIZED_TIME = "base-op-time";

public static final String LOCATION = "location";
@HiddenProperties public static final String LOCATION = "location";

public static final String TABLE_CREATE_TIME = "table.create-timestamp";
@HiddenProperties public static final String TABLE_CREATE_TIME = "table.create-timestamp";
public static final long TABLE_CREATE_TIME_DEFAULT = 0L;

/** table watermark related properties */
Expand All @@ -60,9 +62,9 @@
"table.event-time-field.datetime-number-format";
public static final String TABLE_EVENT_TIME_NUMBER_FORMAT_DEFAULT = EVENT_TIME_TIMESTAMP_MS;

public static final String WATERMARK_TABLE = "watermark.table";
@HiddenProperties public static final String WATERMARK_TABLE = "watermark.table";

public static final String WATERMARK_BASE_STORE = "watermark.base";
@HiddenProperties public static final String WATERMARK_BASE_STORE = "watermark.base";

/** table optimize related properties */
public static final String ENABLE_SELF_OPTIMIZING = "self-optimizing.enabled";
Expand Down Expand Up @@ -191,9 +193,9 @@
"|.*[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}-m[0-9]+\\.avro"; // UUID-m0.avro

/** table write related properties */
public static final String FILE_FORMAT_PARQUET = "parquet";
@HiddenProperties public static final String FILE_FORMAT_PARQUET = "parquet";

public static final String FILE_FORMAT_ORC = "orc";
@HiddenProperties public static final String FILE_FORMAT_ORC = "orc";
public static final String BASE_FILE_FORMAT = "base.write.format";
public static final String BASE_FILE_FORMAT_DEFAULT = FILE_FORMAT_PARQUET;

Expand All @@ -220,19 +222,29 @@

public static final String WRITE_DISTRIBUTION_MODE =
org.apache.iceberg.TableProperties.WRITE_DISTRIBUTION_MODE;

@HiddenProperties
public static final String WRITE_DISTRIBUTION_MODE_NONE =
org.apache.iceberg.TableProperties.WRITE_DISTRIBUTION_MODE_NONE;

@HiddenProperties
public static final String WRITE_DISTRIBUTION_MODE_HASH =
org.apache.iceberg.TableProperties.WRITE_DISTRIBUTION_MODE_HASH;

@HiddenProperties
public static final String WRITE_DISTRIBUTION_MODE_RANGE =
org.apache.iceberg.TableProperties.WRITE_DISTRIBUTION_MODE_RANGE;

public static final String WRITE_DISTRIBUTION_MODE_DEFAULT = WRITE_DISTRIBUTION_MODE_HASH;

public static final String WRITE_DISTRIBUTION_HASH_MODE = "write.distribution.hash-mode";
public static final String WRITE_DISTRIBUTION_HASH_PARTITION = "partition-key";
public static final String WRITE_DISTRIBUTION_HASH_PRIMARY = "primary-key";
@HiddenProperties public static final String WRITE_DISTRIBUTION_HASH_PARTITION = "partition-key";
@HiddenProperties public static final String WRITE_DISTRIBUTION_HASH_PRIMARY = "primary-key";

@HiddenProperties
public static final String WRITE_DISTRIBUTION_HASH_PRIMARY_PARTITION = "primary-partition-key";
public static final String WRITE_DISTRIBUTION_HASH_AUTO = "auto";

@HiddenProperties public static final String WRITE_DISTRIBUTION_HASH_AUTO = "auto";
public static final String WRITE_DISTRIBUTION_HASH_MODE_DEFAULT = WRITE_DISTRIBUTION_HASH_AUTO;

public static final String BASE_REFRESH_INTERVAL = "base.refresh-interval";
Expand All @@ -254,8 +266,8 @@
@Deprecated public static final String ENABLE_LOG_STORE_LEGACY = "log-store.enable";

public static final String LOG_STORE_TYPE = "log-store.type";
public static final String LOG_STORE_STORAGE_TYPE_KAFKA = "kafka";
public static final String LOG_STORE_STORAGE_TYPE_PULSAR = "pulsar";
@HiddenProperties public static final String LOG_STORE_STORAGE_TYPE_KAFKA = "kafka";
@HiddenProperties public static final String LOG_STORE_STORAGE_TYPE_PULSAR = "pulsar";
public static final String LOG_STORE_STORAGE_TYPE_DEFAULT = LOG_STORE_STORAGE_TYPE_KAFKA;

public static final String LOG_STORE_ADDRESS = "log-store.address";
Expand All @@ -268,25 +280,31 @@
public static final String LOG_STORE_DATA_VERSION = "log-store.data-version";
public static final String LOG_STORE_DATA_VERSION_DEFAULT = "v1";

public static final String LOG_STORE_PROPERTIES_PREFIX = "properties.";
@HiddenProperties public static final String LOG_STORE_PROPERTIES_PREFIX = "properties.";

public static final String OWNER = "owner";

/** table format related properties */
public static final String TABLE_FORMAT = "table-format";
@HiddenProperties public static final String TABLE_FORMAT = "table-format";

@HiddenProperties
public static final String MIXED_FORMAT_PRIMARY_KEY_FIELDS = "mixed-format.primary-key-fields";

@HiddenProperties
public static final String MIXED_FORMAT_TABLE_STORE = "mixed-format.table-store";
public static final String MIXED_FORMAT_TABLE_STORE_BASE = "base";
public static final String MIXED_FORMAT_TABLE_STORE_CHANGE = "change";

@HiddenProperties public static final String MIXED_FORMAT_TABLE_STORE_BASE = "base";
@HiddenProperties public static final String MIXED_FORMAT_TABLE_STORE_CHANGE = "change";

@HiddenProperties
public static final String MIXED_FORMAT_CHANGE_STORE_IDENTIFIER =
"mixed-format.change.identifier";

/** Protected properties which should not be read by user. */
public static final Set<String> READ_PROTECTED_PROPERTIES = new HashSet<>();
@HiddenProperties public static final Set<String> READ_PROTECTED_PROPERTIES = new HashSet<>();

Check warning on line 304 in core/src/main/java/com/netease/arctic/table/TableProperties.java

View check run for this annotation

Codecov / codecov/patch

core/src/main/java/com/netease/arctic/table/TableProperties.java#L304

Added line #L304 was not covered by tests

/** Protected properties which should not be written by user. */
public static final Set<String> WRITE_PROTECTED_PROPERTIES = new HashSet<>();
@HiddenProperties public static final Set<String> WRITE_PROTECTED_PROPERTIES = new HashSet<>();

Check warning on line 307 in core/src/main/java/com/netease/arctic/table/TableProperties.java

View check run for this annotation

Codecov / codecov/patch

core/src/main/java/com/netease/arctic/table/TableProperties.java#L307

Added line #L307 was not covered by tests

static {
READ_PROTECTED_PROPERTIES.add(TableProperties.BASE_TABLE_MAX_TRANSACTION_ID);
Expand Down