org.apache.hudi.table.ExplicitWriteHandleTable Maven / Gradle / Ivy
/*
* 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.hudi.table;
import org.apache.hudi.client.WriteStatus;
import org.apache.hudi.common.engine.HoodieEngineContext;
import org.apache.hudi.common.model.HoodieKey;
import org.apache.hudi.common.model.HoodieRecord;
import org.apache.hudi.io.HoodieWriteHandle;
import org.apache.hudi.table.action.HoodieWriteMetadata;
import java.util.List;
/**
* HoodieTable that need to pass in the
* {@link org.apache.hudi.io.HoodieWriteHandle} explicitly.
*/
public interface ExplicitWriteHandleTable {
/**
* Upsert a batch of new records into Hoodie table at the supplied instantTime.
*
* Specifies the write handle explicitly in order to have fine-grained control with
* the underneath file.
*
* @param context HoodieEngineContext
* @param writeHandle The write handle
* @param instantTime Instant Time for the action
* @param records hoodieRecords to upsert
* @return HoodieWriteMetadata
*/
HoodieWriteMetadata> upsert(
HoodieEngineContext context,
HoodieWriteHandle, ?, ?, ?> writeHandle,
String instantTime,
List> records);
/**
* Insert a batch of new records into Hoodie table at the supplied instantTime.
*
* Specifies the write handle explicitly in order to have fine-grained control with
* the underneath file.
*
* @param context HoodieEngineContext
* @param writeHandle The write handle
* @param instantTime Instant Time for the action
* @param records hoodieRecords to upsert
* @return HoodieWriteMetadata
*/
HoodieWriteMetadata> insert(
HoodieEngineContext context,
HoodieWriteHandle, ?, ?, ?> writeHandle,
String instantTime,
List> records);
/**
* Deletes a list of {@link HoodieKey}s from the Hoodie table, at the supplied instantTime {@link HoodieKey}s will be
* de-duped and non existent keys will be removed before deleting.
*
* Specifies the write handle explicitly in order to have fine-grained control with
* the underneath file.
*
* @param context HoodieEngineContext
* @param writeHandle The write handle
* @param instantTime Instant Time for the action
* @param keys {@link List} of {@link HoodieKey}s to be deleted
* @return HoodieWriteMetadata
*/
HoodieWriteMetadata> delete(
HoodieEngineContext context,
HoodieWriteHandle, ?, ?, ?> writeHandle,
String instantTime,
List keys);
/**
* Upserts the given prepared records into the Hoodie table, at the supplied instantTime.
*
* This implementation requires that the input records are already tagged, and de-duped if needed.
*
*
Specifies the write handle explicitly in order to have fine-grained control with
* the underneath file.
*
* @param context HoodieEngineContext
* @param instantTime Instant Time for the action
* @param preppedRecords HoodieRecords to upsert
* @return HoodieWriteMetadata
*/
HoodieWriteMetadata> upsertPrepped(
HoodieEngineContext context,
HoodieWriteHandle, ?, ?, ?> writeHandle,
String instantTime,
List> preppedRecords);
/**
* Inserts the given prepared records into the Hoodie table, at the supplied instantTime.
*
* This implementation requires that the input records are already tagged, and de-duped if needed.
*
*
Specifies the write handle explicitly in order to have fine-grained control with
* the underneath file.
*
* @param context HoodieEngineContext
* @param instantTime Instant Time for the action
* @param preppedRecords Hoodie records to insert
* @return HoodieWriteMetadata
*/
HoodieWriteMetadata> insertPrepped(
HoodieEngineContext context,
HoodieWriteHandle, ?, ?, ?> writeHandle,
String instantTime,
List> preppedRecords);
/**
* Bulk inserts the given prepared records into the Hoodie table, at the supplied instantTime.
*
* This implementation requires that the input records are already tagged, and de-duped if needed.
*
*
Specifies the write handle explicitly in order to have fine-grained control with
* the underneath file.
*
* @param context HoodieEngineContext
* @param instantTime Instant Time for the action
* @param preppedRecords Hoodie records to bulk_insert
* @return HoodieWriteMetadata
*/
HoodieWriteMetadata> bulkInsertPrepped(
HoodieEngineContext context,
HoodieWriteHandle, ?, ?, ?> writeHandle,
String instantTime,
List> preppedRecords);
/**
* Replaces all the existing records and inserts the specified new records into Hoodie table at the supplied instantTime,
* for the partition paths contained in input records.
*
* @param context HoodieEngineContext
* @param writeHandle The write handle
* @param instantTime Instant time for the replace action
* @param records input records
* @return HoodieWriteMetadata
*/
HoodieWriteMetadata> insertOverwrite(
HoodieEngineContext context,
HoodieWriteHandle, ?, ?, ?> writeHandle,
String instantTime,
List> records);
/**
* Deletes all the existing records of the Hoodie table and inserts the specified new records into Hoodie table at the supplied instantTime,
* for the partition paths contained in input records.
*
* @param context HoodieEngineContext
* @param writeHandle The write handle
* @param instantTime Instant time for the replace action
* @param records input records
* @return HoodieWriteMetadata
*/
HoodieWriteMetadata> insertOverwriteTable(
HoodieEngineContext context,
HoodieWriteHandle, ?, ?, ?> writeHandle,
String instantTime,
List> records);
}