yihua commented on code in PR #11149: URL: https://github.com/apache/hudi/pull/11149#discussion_r1769476979
########## hudi-utilities/src/test/resources/streamer-config/kafka-source-multi.properties: ########## @@ -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. +### +include=base.properties +# Key fields, for kafka example +#hoodie.datasource.write.recordkey.field=_row_key +#hoodie.datasource.write.partitionpath.field=driver +# schema provider configs +hoodie.streamer.schemaprovider.registry.url=http://localhost:8081/subjects/random-value/versions/latest +# Kafka Source +#hoodie.streamer.source.kafka.topic=impressions Review Comment: ```suggestion ``` ########## hudi-utilities/src/test/resources/streamer-config/multi-source-1.properties: ########## @@ -0,0 +1,26 @@ +### +# 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. +### +include=base.properties +# Key generator props +hoodie.datasource.write.recordkey.field=_row_key +hoodie.datasource.write.partitionpath.field=driver +hoodie.streamer.source.kafka.topic=TOPIC_1 +# Schema provider props (change to absolute path based on your installation) Review Comment: ```suggestion # Schema provider props ``` ########## hudi-utilities/src/test/java/org/apache/hudi/utilities/streamer/TestStreamSyncUnitTests.java: ########## @@ -160,6 +165,45 @@ void testGetCheckpointToResume(HoodieStreamer.Config cfg, HoodieCommitMetadata c assertEquals(expectedResumeCheckpoint,resumeCheckpoint); } + @ParameterizedTest + @MethodSource("getMultiTableStreamerCases") + void testCloneConfigsFromMultiTableStreamer(HoodieMultiTableStreamer.Config cfg) throws IOException { + Configuration configuration = new Configuration(); + JavaSparkContext jssc = mock(JavaSparkContext.class); + + when(jssc.hadoopConfiguration()).thenReturn(configuration); + + HoodieMultiTableStreamer multiTableStreamer = new HoodieMultiTableStreamer(cfg, jssc); + List<TableExecutionContext> tableExecutionContextList = multiTableStreamer.getTableExecutionContexts(); + tableExecutionContextList.forEach(it -> { + // make sure that if set global properties then each child streamer can get also + assertTrue(it.getConfig().configs.containsAll(cfg.configs)); + + // make sure that each streamer should have propsFilePath from multiStreamer configs, not default value Review Comment: ```suggestion // make sure that each child streamer obtains the propsFilePath from multiStreamer configs, not the default value ``` ########## hudi-utilities/src/test/java/org/apache/hudi/utilities/streamer/TestStreamSyncUnitTests.java: ########## @@ -160,6 +165,45 @@ void testGetCheckpointToResume(HoodieStreamer.Config cfg, HoodieCommitMetadata c assertEquals(expectedResumeCheckpoint,resumeCheckpoint); } + @ParameterizedTest + @MethodSource("getMultiTableStreamerCases") + void testCloneConfigsFromMultiTableStreamer(HoodieMultiTableStreamer.Config cfg) throws IOException { + Configuration configuration = new Configuration(); + JavaSparkContext jssc = mock(JavaSparkContext.class); + + when(jssc.hadoopConfiguration()).thenReturn(configuration); + + HoodieMultiTableStreamer multiTableStreamer = new HoodieMultiTableStreamer(cfg, jssc); + List<TableExecutionContext> tableExecutionContextList = multiTableStreamer.getTableExecutionContexts(); + tableExecutionContextList.forEach(it -> { + // make sure that if set global properties then each child streamer can get also Review Comment: ```suggestion // make sure that the global properties are also set in each child streamer ``` ########## hudi-utilities/src/test/resources/streamer-config/multi-source-2.properties: ########## @@ -0,0 +1,26 @@ +### +# 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. +### +include=base.properties +# Key generator props +hoodie.datasource.write.recordkey.field=_row_key +hoodie.datasource.write.partitionpath.field=driver +hoodie.streamer.source.kafka.topic=TOPIC_2 +# Schema provider props (change to absolute path based on your installation) Review Comment: ```suggestion # Schema provider props ``` ########## hudi-utilities/src/test/resources/streamer-config/multi-source-2.properties: ########## @@ -0,0 +1,26 @@ +### +# 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. +### +include=base.properties +# Key generator props +hoodie.datasource.write.recordkey.field=_row_key +hoodie.datasource.write.partitionpath.field=driver +hoodie.streamer.source.kafka.topic=TOPIC_2 +# Schema provider props (change to absolute path based on your installation) +hoodie.streamer.schemaprovider.source.schema.file=file:///path/to/hoodie/hoodie-utilities/src/main/resources/streamer-props/source.avsc +hoodie.streamer.schemaprovider.target.schema.file=file:///path/to/hoodie/hoodie-utilities/src/main/resources/streamer-props/target.avsc + Review Comment: ```suggestion ``` ########## hudi-utilities/src/test/resources/streamer-config/kafka-source-multi.properties: ########## @@ -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. +### +include=base.properties +# Key fields, for kafka example +#hoodie.datasource.write.recordkey.field=_row_key +#hoodie.datasource.write.partitionpath.field=driver Review Comment: Remove unused configs ```suggestion ``` ########## hudi-utilities/src/test/resources/streamer-config/multi-source-1.properties: ########## @@ -0,0 +1,26 @@ +### +# 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. +### +include=base.properties +# Key generator props +hoodie.datasource.write.recordkey.field=_row_key +hoodie.datasource.write.partitionpath.field=driver +hoodie.streamer.source.kafka.topic=TOPIC_1 +# Schema provider props (change to absolute path based on your installation) +hoodie.streamer.schemaprovider.source.schema.file=file:///path/to/hoodie/hoodie-utilities/src/main/resources/streamer-props/source.avsc +hoodie.streamer.schemaprovider.target.schema.file=file:///path/to/hoodie/hoodie-utilities/src/main/resources/streamer-props/target.avsc + Review Comment: ```suggestion ``` -- 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]
