Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/main/java/io/cdap/plugin/gcp/common/GCSEmptyInputFormat.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright © 2024 Cask Data, Inc.
*
* Licensed 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 io.cdap.plugin.gcp.common;

import io.cdap.plugin.format.input.AbstractEmptyInputFormat;


/**
* An InputFormat that returns no data.
* @param <K> the type of key
* @param <V> the type of value
*/
public class GCSEmptyInputFormat<K, V> extends AbstractEmptyInputFormat<K, V> {
// no-op
}
11 changes: 6 additions & 5 deletions src/main/java/io/cdap/plugin/gcp/gcs/source/GCSSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import io.cdap.plugin.format.plugin.FileSourceProperties;
import io.cdap.plugin.gcp.common.GCPConnectorConfig;
import io.cdap.plugin.gcp.common.GCPUtils;
import io.cdap.plugin.gcp.common.GCSEmptyInputFormat;
import io.cdap.plugin.gcp.crypto.EncryptedFileSystem;
import io.cdap.plugin.gcp.gcs.GCSPath;
import io.cdap.plugin.gcp.gcs.connector.GCSConnector;
Expand Down Expand Up @@ -77,6 +78,11 @@ public void configurePipeline(PipelineConfigurer pipelineConfigurer) {
super.configurePipeline(pipelineConfigurer);
}

@Override
protected String getEmptyInputFormatClassName() {
return GCSEmptyInputFormat.class.getName();
}

@Override
public void prepareRun(BatchSourceContext context) throws Exception {
// Get location of the source for lineage
Expand Down Expand Up @@ -268,11 +274,6 @@ public Long getMinSplitSize() {
return minSplitSize;
}

@Override
public boolean shouldAllowEmptyInput() {
return false;
}

public boolean isCopyHeader() {
return shouldCopyHeader();
}
Expand Down