ChinmaySKulkarni commented on a change in pull request #3: PHOENIX-5232: PhoenixDataWriter in Phoenix-Spark connector does not commit when mutation batch size is reached URL: https://github.com/apache/phoenix-connectors/pull/3#discussion_r274719603
########## File path: phoenix-spark/src/test/java/org/apache/phoenix/spark/datasource/v2/writer/PhoenixTestingWriterCommitMessage.java ########## @@ -0,0 +1,38 @@ +/* + * 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.phoenix.spark.datasource.v2.writer; + +import org.apache.spark.sql.sources.v2.writer.WriterCommitMessage; + +class PhoenixTestingWriterCommitMessage implements WriterCommitMessage { Review comment: Yes. When `PhoenixTestingDataWriter#commit` is called from a given executor, it returns an instance of `PhoenixTestingWriterCommitMessage` where I store the number of batches committed by that executor. On the driver-side, if all executor jobs succeed, `PhoenixTestingDataSourceWriter` takes the list of WriterCommitMessages got from all executors and calls `commit`. This is where I keep track of the total number of batches committed across all executors. See [WriteToDataSourceV2Exec#doExecute](https://github.com/apache/spark/blob/branch-2.4/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/WriteToDataSourceV2Exec.scala#L69-L76) which is on the driver-side and the `DataSourceWriter` instance commits based on messages got from all executor tasks. ---------------------------------------------------------------- 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] With regards, Apache Git Services
