JingsongLi commented on code in PR #113: URL: https://github.com/apache/flink-table-store/pull/113#discussion_r871069928
########## flink-table-store-hive/src/main/java/org/apache/flink/table/store/TableStoreJobConf.java: ########## @@ -0,0 +1,181 @@ +/* + * 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 org.apache.flink.table.store; + +import org.apache.flink.configuration.ConfigOption; +import org.apache.flink.configuration.Configuration; +import org.apache.flink.table.store.file.FileStoreOptions; +import org.apache.flink.table.store.hive.HiveTypeUtils; +import org.apache.flink.table.types.logical.LogicalType; +import org.apache.flink.table.types.logical.utils.LogicalTypeParser; +import org.apache.flink.util.Preconditions; + +import org.apache.hadoop.hive.metastore.api.hive_metastoreConstants; +import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoUtils; +import org.apache.hadoop.mapred.JobConf; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Properties; +import java.util.stream.Collectors; + +/** + * Utility class to convert Hive table property keys and get file store specific configurations from + * {@link JobConf}. + */ +public class TableStoreJobConf { + + private static final String TBLPROPERTIES_PREFIX = "table-store."; + private static final String TBLPROPERTIES_PRIMARY_KEYS = TBLPROPERTIES_PREFIX + "primary-keys"; + private static final String INTERNAL_TBLPROPERTIES_PREFIX = + "table-store.internal.tblproperties."; + + private static final String INTERNAL_DB_NAME = "table-store.internal.db-name"; + private static final String INTERNAL_TABLE_NAME = "table-store.internal.table-name"; + private static final String INTERNAL_LOCATION = "table-store.internal.location"; + + private static final String INTERNAL_COLUMN_NAMES = "table-store.internal.column-names"; + + private static final String INTERNAL_COLUMN_TYPES = "table-store.internal.column-types"; + private static final String COLUMN_TYPES_SEPARATOR = "\0"; + + private static final String INTERNAL_PARTITION_COLUMN_NAMES = + "table-store.internal.partition-column-names"; + private static final String INTERNAL_PRIMARY_KEYS = "table-store.internal.primary-keys"; + + private static final String INTERNAL_FILE_STORE_USER = "table-store.internal.file-store.user"; + + private final JobConf jobConf; + + public TableStoreJobConf(JobConf jobConf) { + this.jobConf = jobConf; + } + + public static void update(Properties properties, Map<String, String> map) { Review Comment: `configureInputJobProperties`? Just keep full name. ########## flink-table-store-hive/src/main/java/org/apache/flink/table/store/TableStoreJobConf.java: ########## @@ -0,0 +1,181 @@ +/* + * 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 org.apache.flink.table.store; + +import org.apache.flink.configuration.ConfigOption; +import org.apache.flink.configuration.Configuration; +import org.apache.flink.table.store.file.FileStoreOptions; +import org.apache.flink.table.store.hive.HiveTypeUtils; +import org.apache.flink.table.types.logical.LogicalType; +import org.apache.flink.table.types.logical.utils.LogicalTypeParser; +import org.apache.flink.util.Preconditions; + +import org.apache.hadoop.hive.metastore.api.hive_metastoreConstants; +import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoUtils; +import org.apache.hadoop.mapred.JobConf; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Properties; +import java.util.stream.Collectors; + +/** + * Utility class to convert Hive table property keys and get file store specific configurations from + * {@link JobConf}. + */ +public class TableStoreJobConf { + + private static final String TBLPROPERTIES_PREFIX = "table-store."; + private static final String TBLPROPERTIES_PRIMARY_KEYS = TBLPROPERTIES_PREFIX + "primary-keys"; + private static final String INTERNAL_TBLPROPERTIES_PREFIX = + "table-store.internal.tblproperties."; + + private static final String INTERNAL_DB_NAME = "table-store.internal.db-name"; + private static final String INTERNAL_TABLE_NAME = "table-store.internal.table-name"; + private static final String INTERNAL_LOCATION = "table-store.internal.location"; + + private static final String INTERNAL_COLUMN_NAMES = "table-store.internal.column-names"; + + private static final String INTERNAL_COLUMN_TYPES = "table-store.internal.column-types"; + private static final String COLUMN_TYPES_SEPARATOR = "\0"; + + private static final String INTERNAL_PARTITION_COLUMN_NAMES = + "table-store.internal.partition-column-names"; + private static final String INTERNAL_PRIMARY_KEYS = "table-store.internal.primary-keys"; + + private static final String INTERNAL_FILE_STORE_USER = "table-store.internal.file-store.user"; + + private final JobConf jobConf; + + public TableStoreJobConf(JobConf jobConf) { + this.jobConf = jobConf; + } + + public static void update(Properties properties, Map<String, String> map) { + String tableNameString = properties.getProperty(hive_metastoreConstants.META_TABLE_NAME); Review Comment: Does `tableNameString` still useful? It is just used for printing? Can we remove this usage? -- 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]
