imay commented on a change in pull request #3712: URL: https://github.com/apache/incubator-doris/pull/3712#discussion_r432205716
########## File path: fe/src/main/java/org/apache/doris/load/loadv2/etl/EtlJobConfig.java ########## @@ -0,0 +1,487 @@ +// 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.doris.load.loadv2.etl; + +import com.google.common.collect.Lists; +import com.google.common.collect.ImmutableMap; +import com.google.gson.FieldNamingPolicy; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +import java.io.Serializable; +import java.util.Comparator; +import java.util.List; +import java.util.Map; + +/** jobconfig.json file format + * { + * "tables": { + * 10014: { + * "indexes": [{ + * "index_id": 10014, + * "columns": [{ + * "column_name": "k1", + * "column_type": "SMALLINT", + * "is_key": true, + * "is_allow_null": true, + * "aggregation_type": "NONE" + * }, { + * "column_name": "k2", + * "column_type": "VARCHAR", + * "string_length": 20, + * "is_key": true, + * "is_allow_null": true, + * "aggregation_type": "NONE" + * }, { + * "column_name": "v", + * "column_type": "BIGINT", + * "is_key": false, + * "is_allow_null": false, + * "aggregation_type": "NONE" + * }], + * "schema_hash": 1294206574, + * "index_type": "DUPLICATE", + * "is_base_index": true + * }, { + * "index_id": 10017, + * "columns": [{ + * "column_name": "k1", + * "column_type": "SMALLINT", + * "is_key": true, + * "is_allow_null": true, + * "aggregation_type": "NONE" + * }, { + * "column_name": "v", + * "column_type": "BIGINT", + * "is_key": false, + * "is_allow_null": false, + * "aggregation_type": "SUM" + * }], + * "schema_hash": 1294206575, + * "index_type": "AGGREGATE", + * "is_base_index": false + * }], + * "partition_info": { + * "partition_type": "RANGE", + * "partition_column_refs": ["k1"], + * "distribution_column_refs": ["k2"], + * "partitions": [{ + * "partition_id": 10020, + * "start_keys": [-100], + * "end_keys": [10], + * "is_max_partition": false, + * "bucket_num": 3 + * }, { + * "partition_id": 10021, + * "start_keys": [10], + * "end_keys": [100], + * "is_max_partition": false, + * "bucket_num": 3 + * }] + * }, + * "file_groups": [{ + * "partitions": [10020], + * "file_paths": ["hdfs://hdfs_host:port/user/palo/test/file"], + * "file_field_names": ["tmp_k1", "k2"], + * "value_separator": ",", + * "line_delimiter": "\n", + * "column_mappings": { + * "k1": { + * "function_name": "strftime", + * "args": ["%Y-%m-%d %H:%M:%S", "tmp_k1"] + * } + * }, + * "where": "k2 > 10", + * "is_negative": false, + * "hive_table_name": "hive_db.table" + * }] + * } + * }, + * "output_path": "hdfs://hdfs_host:port/user/output/10003/label1/1582599203397", + * "output_file_pattern": "label1.%d.%d.%d.%d.%d.parquet", + * "label": "label0", + * "properties": { + * "strict_mode": false, + * "timezone": "Asia/Shanghai" + * } + * } + */ +public class EtlJobConfig implements Serializable { Review comment: Why this class should implement `Serializable`? I think it is OK to convert to and from JSON. ########## File path: fe/src/main/java/org/apache/doris/load/loadv2/etl/EtlJobConfig.java ########## @@ -0,0 +1,487 @@ +// 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.doris.load.loadv2.etl; + +import com.google.common.collect.Lists; +import com.google.common.collect.ImmutableMap; +import com.google.gson.FieldNamingPolicy; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +import java.io.Serializable; +import java.util.Comparator; +import java.util.List; +import java.util.Map; + +/** jobconfig.json file format + * { + * "tables": { + * 10014: { + * "indexes": [{ + * "index_id": 10014, + * "columns": [{ + * "column_name": "k1", + * "column_type": "SMALLINT", + * "is_key": true, + * "is_allow_null": true, + * "aggregation_type": "NONE" + * }, { + * "column_name": "k2", + * "column_type": "VARCHAR", + * "string_length": 20, + * "is_key": true, + * "is_allow_null": true, + * "aggregation_type": "NONE" + * }, { + * "column_name": "v", + * "column_type": "BIGINT", + * "is_key": false, + * "is_allow_null": false, + * "aggregation_type": "NONE" + * }], + * "schema_hash": 1294206574, + * "index_type": "DUPLICATE", + * "is_base_index": true + * }, { + * "index_id": 10017, + * "columns": [{ + * "column_name": "k1", + * "column_type": "SMALLINT", + * "is_key": true, + * "is_allow_null": true, + * "aggregation_type": "NONE" + * }, { + * "column_name": "v", + * "column_type": "BIGINT", + * "is_key": false, + * "is_allow_null": false, + * "aggregation_type": "SUM" + * }], + * "schema_hash": 1294206575, + * "index_type": "AGGREGATE", + * "is_base_index": false + * }], + * "partition_info": { + * "partition_type": "RANGE", + * "partition_column_refs": ["k1"], + * "distribution_column_refs": ["k2"], + * "partitions": [{ + * "partition_id": 10020, + * "start_keys": [-100], + * "end_keys": [10], + * "is_max_partition": false, + * "bucket_num": 3 + * }, { + * "partition_id": 10021, + * "start_keys": [10], + * "end_keys": [100], + * "is_max_partition": false, + * "bucket_num": 3 + * }] + * }, + * "file_groups": [{ + * "partitions": [10020], + * "file_paths": ["hdfs://hdfs_host:port/user/palo/test/file"], + * "file_field_names": ["tmp_k1", "k2"], + * "value_separator": ",", + * "line_delimiter": "\n", + * "column_mappings": { + * "k1": { + * "function_name": "strftime", + * "args": ["%Y-%m-%d %H:%M:%S", "tmp_k1"] + * } + * }, + * "where": "k2 > 10", + * "is_negative": false, + * "hive_table_name": "hive_db.table" + * }] + * } + * }, + * "output_path": "hdfs://hdfs_host:port/user/output/10003/label1/1582599203397", + * "output_file_pattern": "label1.%d.%d.%d.%d.%d.parquet", + * "label": "label0", + * "properties": { + * "strict_mode": false, + * "timezone": "Asia/Shanghai" + * } + * } + */ +public class EtlJobConfig implements Serializable { + // global dict + public static final String GLOBAL_DICT_TABLE_NAME = "doris_global_dict_table_%d"; + public static final String DISTINCT_KEY_TABLE_NAME = "doris_distinct_key_table_%d_%s"; + public static final String DORIS_INTERMEDIATE_HIVE_TABLE_NAME = "doris_intermediate_hive_table_%d_%s"; + + // hdfsEtlPath/jobs/dbId/loadLabel/PendingTaskSignature + private static final String ETL_OUTPUT_PATH_FORMAT = "%s/jobs/%d/%s/%d"; + private static final String ETL_OUTPUT_FILE_NAME_DESC = "label.tableId.partitionId.indexId.bucket.schemaHash.parquet"; + // tableId.partitionId.indexId.bucket.schemaHash + public static final String ETL_OUTPUT_FILE_NAME_NO_LABEL_SUFFIX_FORMAT = "%d.%d.%d.%d.%d"; + public static final String ETL_OUTPUT_FILE_FORMAT = "parquet"; + + // dpp result + public static final String DPP_RESULT_NAME = "dpp_result.json"; + + public Map<Long, EtlTable> tables; + public String outputPath; + public String outputFilePattern; + public String label; + public EtlJobProperty properties; Review comment: If the variable name is changed, the serialized JSON will change. Is there some method to seprate the variable name and serialized field name? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
