All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.glue.model.S3CsvSource Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Glue module holds the client classes that are used for communicating with AWS Glue Service

There is a newer version: 2.29.39
Show newest version
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file 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 software.amazon.awssdk.services.glue.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Specifies a command-separated value (CSV) data store stored in Amazon S3. *

*/ @Generated("software.amazon.awssdk:codegen") public final class S3CsvSource implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name") .getter(getter(S3CsvSource::name)).setter(setter(Builder::name)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build(); private static final SdkField> PATHS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Paths") .getter(getter(S3CsvSource::paths)) .setter(setter(Builder::paths)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Paths").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField COMPRESSION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("CompressionType").getter(getter(S3CsvSource::compressionTypeAsString)) .setter(setter(Builder::compressionType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CompressionType").build()).build(); private static final SdkField> EXCLUSIONS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Exclusions") .getter(getter(S3CsvSource::exclusions)) .setter(setter(Builder::exclusions)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Exclusions").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField GROUP_SIZE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("GroupSize").getter(getter(S3CsvSource::groupSize)).setter(setter(Builder::groupSize)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GroupSize").build()).build(); private static final SdkField GROUP_FILES_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("GroupFiles").getter(getter(S3CsvSource::groupFiles)).setter(setter(Builder::groupFiles)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GroupFiles").build()).build(); private static final SdkField RECURSE_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("Recurse").getter(getter(S3CsvSource::recurse)).setter(setter(Builder::recurse)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Recurse").build()).build(); private static final SdkField MAX_BAND_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("MaxBand").getter(getter(S3CsvSource::maxBand)).setter(setter(Builder::maxBand)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxBand").build()).build(); private static final SdkField MAX_FILES_IN_BAND_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("MaxFilesInBand").getter(getter(S3CsvSource::maxFilesInBand)).setter(setter(Builder::maxFilesInBand)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxFilesInBand").build()).build(); private static final SdkField ADDITIONAL_OPTIONS_FIELD = SdkField . builder(MarshallingType.SDK_POJO).memberName("AdditionalOptions") .getter(getter(S3CsvSource::additionalOptions)).setter(setter(Builder::additionalOptions)) .constructor(S3DirectSourceAdditionalOptions::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AdditionalOptions").build()).build(); private static final SdkField SEPARATOR_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Separator").getter(getter(S3CsvSource::separatorAsString)).setter(setter(Builder::separator)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Separator").build()).build(); private static final SdkField ESCAPER_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Escaper") .getter(getter(S3CsvSource::escaper)).setter(setter(Builder::escaper)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Escaper").build()).build(); private static final SdkField QUOTE_CHAR_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("QuoteChar").getter(getter(S3CsvSource::quoteCharAsString)).setter(setter(Builder::quoteChar)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QuoteChar").build()).build(); private static final SdkField MULTILINE_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("Multiline").getter(getter(S3CsvSource::multiline)).setter(setter(Builder::multiline)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Multiline").build()).build(); private static final SdkField WITH_HEADER_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("WithHeader").getter(getter(S3CsvSource::withHeader)).setter(setter(Builder::withHeader)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WithHeader").build()).build(); private static final SdkField WRITE_HEADER_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("WriteHeader").getter(getter(S3CsvSource::writeHeader)).setter(setter(Builder::writeHeader)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WriteHeader").build()).build(); private static final SdkField SKIP_FIRST_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("SkipFirst").getter(getter(S3CsvSource::skipFirst)).setter(setter(Builder::skipFirst)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SkipFirst").build()).build(); private static final SdkField OPTIMIZE_PERFORMANCE_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("OptimizePerformance").getter(getter(S3CsvSource::optimizePerformance)) .setter(setter(Builder::optimizePerformance)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OptimizePerformance").build()) .build(); private static final SdkField> OUTPUT_SCHEMAS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("OutputSchemas") .getter(getter(S3CsvSource::outputSchemas)) .setter(setter(Builder::outputSchemas)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OutputSchemas").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(GlueSchema::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, PATHS_FIELD, COMPRESSION_TYPE_FIELD, EXCLUSIONS_FIELD, GROUP_SIZE_FIELD, GROUP_FILES_FIELD, RECURSE_FIELD, MAX_BAND_FIELD, MAX_FILES_IN_BAND_FIELD, ADDITIONAL_OPTIONS_FIELD, SEPARATOR_FIELD, ESCAPER_FIELD, QUOTE_CHAR_FIELD, MULTILINE_FIELD, WITH_HEADER_FIELD, WRITE_HEADER_FIELD, SKIP_FIRST_FIELD, OPTIMIZE_PERFORMANCE_FIELD, OUTPUT_SCHEMAS_FIELD)); private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); private static final long serialVersionUID = 1L; private final String name; private final List paths; private final String compressionType; private final List exclusions; private final String groupSize; private final String groupFiles; private final Boolean recurse; private final Integer maxBand; private final Integer maxFilesInBand; private final S3DirectSourceAdditionalOptions additionalOptions; private final String separator; private final String escaper; private final String quoteChar; private final Boolean multiline; private final Boolean withHeader; private final Boolean writeHeader; private final Boolean skipFirst; private final Boolean optimizePerformance; private final List outputSchemas; private S3CsvSource(BuilderImpl builder) { this.name = builder.name; this.paths = builder.paths; this.compressionType = builder.compressionType; this.exclusions = builder.exclusions; this.groupSize = builder.groupSize; this.groupFiles = builder.groupFiles; this.recurse = builder.recurse; this.maxBand = builder.maxBand; this.maxFilesInBand = builder.maxFilesInBand; this.additionalOptions = builder.additionalOptions; this.separator = builder.separator; this.escaper = builder.escaper; this.quoteChar = builder.quoteChar; this.multiline = builder.multiline; this.withHeader = builder.withHeader; this.writeHeader = builder.writeHeader; this.skipFirst = builder.skipFirst; this.optimizePerformance = builder.optimizePerformance; this.outputSchemas = builder.outputSchemas; } /** *

* The name of the data store. *

* * @return The name of the data store. */ public final String name() { return name; } /** * For responses, this returns true if the service returned a value for the Paths property. This DOES NOT check that * the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is useful * because the SDK will never return a null collection or map, but you may need to differentiate between the service * returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true * if a value for the property was specified in the request builder, and false if a value was not specified. */ public final boolean hasPaths() { return paths != null && !(paths instanceof SdkAutoConstructList); } /** *

* A list of the Amazon S3 paths to read from. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasPaths} method. *

* * @return A list of the Amazon S3 paths to read from. */ public final List paths() { return paths; } /** *

* Specifies how the data is compressed. This is generally not necessary if the data has a standard file extension. * Possible values are "gzip" and "bzip"). *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #compressionType} * will return {@link CompressionType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #compressionTypeAsString}. *

* * @return Specifies how the data is compressed. This is generally not necessary if the data has a standard file * extension. Possible values are "gzip" and "bzip"). * @see CompressionType */ public final CompressionType compressionType() { return CompressionType.fromValue(compressionType); } /** *

* Specifies how the data is compressed. This is generally not necessary if the data has a standard file extension. * Possible values are "gzip" and "bzip"). *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #compressionType} * will return {@link CompressionType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #compressionTypeAsString}. *

* * @return Specifies how the data is compressed. This is generally not necessary if the data has a standard file * extension. Possible values are "gzip" and "bzip"). * @see CompressionType */ public final String compressionTypeAsString() { return compressionType; } /** * For responses, this returns true if the service returned a value for the Exclusions property. This DOES NOT check * that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is * useful because the SDK will never return a null collection or map, but you may need to differentiate between the * service returning nothing (or null) and the service returning an empty collection or map. For requests, this * returns true if a value for the property was specified in the request builder, and false if a value was not * specified. */ public final boolean hasExclusions() { return exclusions != null && !(exclusions instanceof SdkAutoConstructList); } /** *

* A string containing a JSON list of Unix-style glob patterns to exclude. For example, "[\"**.pdf\"]" excludes all * PDF files. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasExclusions} method. *

* * @return A string containing a JSON list of Unix-style glob patterns to exclude. For example, "[\"**.pdf\"]" * excludes all PDF files. */ public final List exclusions() { return exclusions; } /** *

* The target group size in bytes. The default is computed based on the input data size and the size of your * cluster. When there are fewer than 50,000 input files, "groupFiles" must be set to * "inPartition" for this to take effect. *

* * @return The target group size in bytes. The default is computed based on the input data size and the size of your * cluster. When there are fewer than 50,000 input files, "groupFiles" must be set to * "inPartition" for this to take effect. */ public final String groupSize() { return groupSize; } /** *

* Grouping files is turned on by default when the input contains more than 50,000 files. To turn on grouping with * fewer than 50,000 files, set this parameter to "inPartition". To disable grouping when there are more than 50,000 * files, set this parameter to "none". *

* * @return Grouping files is turned on by default when the input contains more than 50,000 files. To turn on * grouping with fewer than 50,000 files, set this parameter to "inPartition". To disable grouping when * there are more than 50,000 files, set this parameter to "none". */ public final String groupFiles() { return groupFiles; } /** *

* If set to true, recursively reads files in all subdirectories under the specified paths. *

* * @return If set to true, recursively reads files in all subdirectories under the specified paths. */ public final Boolean recurse() { return recurse; } /** *

* This option controls the duration in milliseconds after which the s3 listing is likely to be consistent. Files * with modification timestamps falling within the last maxBand milliseconds are tracked specially when using * JobBookmarks to account for Amazon S3 eventual consistency. Most users don't need to set this option. The default * is 900000 milliseconds, or 15 minutes. *

* * @return This option controls the duration in milliseconds after which the s3 listing is likely to be consistent. * Files with modification timestamps falling within the last maxBand milliseconds are tracked specially * when using JobBookmarks to account for Amazon S3 eventual consistency. Most users don't need to set this * option. The default is 900000 milliseconds, or 15 minutes. */ public final Integer maxBand() { return maxBand; } /** *

* This option specifies the maximum number of files to save from the last maxBand seconds. If this number is * exceeded, extra files are skipped and only processed in the next job run. *

* * @return This option specifies the maximum number of files to save from the last maxBand seconds. If this number * is exceeded, extra files are skipped and only processed in the next job run. */ public final Integer maxFilesInBand() { return maxFilesInBand; } /** *

* Specifies additional connection options. *

* * @return Specifies additional connection options. */ public final S3DirectSourceAdditionalOptions additionalOptions() { return additionalOptions; } /** *

* Specifies the delimiter character. The default is a comma: ",", but any other character can be specified. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #separator} will * return {@link Separator#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #separatorAsString}. *

* * @return Specifies the delimiter character. The default is a comma: ",", but any other character can be specified. * @see Separator */ public final Separator separator() { return Separator.fromValue(separator); } /** *

* Specifies the delimiter character. The default is a comma: ",", but any other character can be specified. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #separator} will * return {@link Separator#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #separatorAsString}. *

* * @return Specifies the delimiter character. The default is a comma: ",", but any other character can be specified. * @see Separator */ public final String separatorAsString() { return separator; } /** *

* Specifies a character to use for escaping. This option is used only when reading CSV files. The default value is * none. If enabled, the character which immediately follows is used as-is, except for a small set of * well-known escapes (\n, \r, \t, and \0). *

* * @return Specifies a character to use for escaping. This option is used only when reading CSV files. The default * value is none. If enabled, the character which immediately follows is used as-is, except for * a small set of well-known escapes (\n, \r, \t, and \0 * ). */ public final String escaper() { return escaper; } /** *

* Specifies the character to use for quoting. The default is a double quote: '"'. Set this to * -1 to turn off quoting entirely. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #quoteChar} will * return {@link QuoteChar#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #quoteCharAsString}. *

* * @return Specifies the character to use for quoting. The default is a double quote: '"'. Set this to * -1 to turn off quoting entirely. * @see QuoteChar */ public final QuoteChar quoteChar() { return QuoteChar.fromValue(quoteChar); } /** *

* Specifies the character to use for quoting. The default is a double quote: '"'. Set this to * -1 to turn off quoting entirely. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #quoteChar} will * return {@link QuoteChar#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #quoteCharAsString}. *

* * @return Specifies the character to use for quoting. The default is a double quote: '"'. Set this to * -1 to turn off quoting entirely. * @see QuoteChar */ public final String quoteCharAsString() { return quoteChar; } /** *

* A Boolean value that specifies whether a single record can span multiple lines. This can occur when a field * contains a quoted new-line character. You must set this option to True if any record spans multiple lines. The * default value is False, which allows for more aggressive file-splitting during parsing. *

* * @return A Boolean value that specifies whether a single record can span multiple lines. This can occur when a * field contains a quoted new-line character. You must set this option to True if any record spans multiple * lines. The default value is False, which allows for more aggressive file-splitting during * parsing. */ public final Boolean multiline() { return multiline; } /** *

* A Boolean value that specifies whether to treat the first line as a header. The default value is * False. *

* * @return A Boolean value that specifies whether to treat the first line as a header. The default value is * False. */ public final Boolean withHeader() { return withHeader; } /** *

* A Boolean value that specifies whether to write the header to output. The default value is True. *

* * @return A Boolean value that specifies whether to write the header to output. The default value is * True. */ public final Boolean writeHeader() { return writeHeader; } /** *

* A Boolean value that specifies whether to skip the first data line. The default value is False. *

* * @return A Boolean value that specifies whether to skip the first data line. The default value is * False. */ public final Boolean skipFirst() { return skipFirst; } /** *

* A Boolean value that specifies whether to use the advanced SIMD CSV reader along with Apache Arrow based columnar * memory formats. Only available in Glue version 3.0. *

* * @return A Boolean value that specifies whether to use the advanced SIMD CSV reader along with Apache Arrow based * columnar memory formats. Only available in Glue version 3.0. */ public final Boolean optimizePerformance() { return optimizePerformance; } /** * For responses, this returns true if the service returned a value for the OutputSchemas property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasOutputSchemas() { return outputSchemas != null && !(outputSchemas instanceof SdkAutoConstructList); } /** *

* Specifies the data schema for the S3 CSV source. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasOutputSchemas} method. *

* * @return Specifies the data schema for the S3 CSV source. */ public final List outputSchemas() { return outputSchemas; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(name()); hashCode = 31 * hashCode + Objects.hashCode(hasPaths() ? paths() : null); hashCode = 31 * hashCode + Objects.hashCode(compressionTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(hasExclusions() ? exclusions() : null); hashCode = 31 * hashCode + Objects.hashCode(groupSize()); hashCode = 31 * hashCode + Objects.hashCode(groupFiles()); hashCode = 31 * hashCode + Objects.hashCode(recurse()); hashCode = 31 * hashCode + Objects.hashCode(maxBand()); hashCode = 31 * hashCode + Objects.hashCode(maxFilesInBand()); hashCode = 31 * hashCode + Objects.hashCode(additionalOptions()); hashCode = 31 * hashCode + Objects.hashCode(separatorAsString()); hashCode = 31 * hashCode + Objects.hashCode(escaper()); hashCode = 31 * hashCode + Objects.hashCode(quoteCharAsString()); hashCode = 31 * hashCode + Objects.hashCode(multiline()); hashCode = 31 * hashCode + Objects.hashCode(withHeader()); hashCode = 31 * hashCode + Objects.hashCode(writeHeader()); hashCode = 31 * hashCode + Objects.hashCode(skipFirst()); hashCode = 31 * hashCode + Objects.hashCode(optimizePerformance()); hashCode = 31 * hashCode + Objects.hashCode(hasOutputSchemas() ? outputSchemas() : null); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof S3CsvSource)) { return false; } S3CsvSource other = (S3CsvSource) obj; return Objects.equals(name(), other.name()) && hasPaths() == other.hasPaths() && Objects.equals(paths(), other.paths()) && Objects.equals(compressionTypeAsString(), other.compressionTypeAsString()) && hasExclusions() == other.hasExclusions() && Objects.equals(exclusions(), other.exclusions()) && Objects.equals(groupSize(), other.groupSize()) && Objects.equals(groupFiles(), other.groupFiles()) && Objects.equals(recurse(), other.recurse()) && Objects.equals(maxBand(), other.maxBand()) && Objects.equals(maxFilesInBand(), other.maxFilesInBand()) && Objects.equals(additionalOptions(), other.additionalOptions()) && Objects.equals(separatorAsString(), other.separatorAsString()) && Objects.equals(escaper(), other.escaper()) && Objects.equals(quoteCharAsString(), other.quoteCharAsString()) && Objects.equals(multiline(), other.multiline()) && Objects.equals(withHeader(), other.withHeader()) && Objects.equals(writeHeader(), other.writeHeader()) && Objects.equals(skipFirst(), other.skipFirst()) && Objects.equals(optimizePerformance(), other.optimizePerformance()) && hasOutputSchemas() == other.hasOutputSchemas() && Objects.equals(outputSchemas(), other.outputSchemas()); } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public final String toString() { return ToString.builder("S3CsvSource").add("Name", name()).add("Paths", hasPaths() ? paths() : null) .add("CompressionType", compressionTypeAsString()).add("Exclusions", hasExclusions() ? exclusions() : null) .add("GroupSize", groupSize()).add("GroupFiles", groupFiles()).add("Recurse", recurse()) .add("MaxBand", maxBand()).add("MaxFilesInBand", maxFilesInBand()).add("AdditionalOptions", additionalOptions()) .add("Separator", separatorAsString()).add("Escaper", escaper()).add("QuoteChar", quoteCharAsString()) .add("Multiline", multiline()).add("WithHeader", withHeader()).add("WriteHeader", writeHeader()) .add("SkipFirst", skipFirst()).add("OptimizePerformance", optimizePerformance()) .add("OutputSchemas", hasOutputSchemas() ? outputSchemas() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Name": return Optional.ofNullable(clazz.cast(name())); case "Paths": return Optional.ofNullable(clazz.cast(paths())); case "CompressionType": return Optional.ofNullable(clazz.cast(compressionTypeAsString())); case "Exclusions": return Optional.ofNullable(clazz.cast(exclusions())); case "GroupSize": return Optional.ofNullable(clazz.cast(groupSize())); case "GroupFiles": return Optional.ofNullable(clazz.cast(groupFiles())); case "Recurse": return Optional.ofNullable(clazz.cast(recurse())); case "MaxBand": return Optional.ofNullable(clazz.cast(maxBand())); case "MaxFilesInBand": return Optional.ofNullable(clazz.cast(maxFilesInBand())); case "AdditionalOptions": return Optional.ofNullable(clazz.cast(additionalOptions())); case "Separator": return Optional.ofNullable(clazz.cast(separatorAsString())); case "Escaper": return Optional.ofNullable(clazz.cast(escaper())); case "QuoteChar": return Optional.ofNullable(clazz.cast(quoteCharAsString())); case "Multiline": return Optional.ofNullable(clazz.cast(multiline())); case "WithHeader": return Optional.ofNullable(clazz.cast(withHeader())); case "WriteHeader": return Optional.ofNullable(clazz.cast(writeHeader())); case "SkipFirst": return Optional.ofNullable(clazz.cast(skipFirst())); case "OptimizePerformance": return Optional.ofNullable(clazz.cast(optimizePerformance())); case "OutputSchemas": return Optional.ofNullable(clazz.cast(outputSchemas())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Map> memberNameToFieldInitializer() { Map> map = new HashMap<>(); map.put("Name", NAME_FIELD); map.put("Paths", PATHS_FIELD); map.put("CompressionType", COMPRESSION_TYPE_FIELD); map.put("Exclusions", EXCLUSIONS_FIELD); map.put("GroupSize", GROUP_SIZE_FIELD); map.put("GroupFiles", GROUP_FILES_FIELD); map.put("Recurse", RECURSE_FIELD); map.put("MaxBand", MAX_BAND_FIELD); map.put("MaxFilesInBand", MAX_FILES_IN_BAND_FIELD); map.put("AdditionalOptions", ADDITIONAL_OPTIONS_FIELD); map.put("Separator", SEPARATOR_FIELD); map.put("Escaper", ESCAPER_FIELD); map.put("QuoteChar", QUOTE_CHAR_FIELD); map.put("Multiline", MULTILINE_FIELD); map.put("WithHeader", WITH_HEADER_FIELD); map.put("WriteHeader", WRITE_HEADER_FIELD); map.put("SkipFirst", SKIP_FIRST_FIELD); map.put("OptimizePerformance", OPTIMIZE_PERFORMANCE_FIELD); map.put("OutputSchemas", OUTPUT_SCHEMAS_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((S3CsvSource) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The name of the data store. *

* * @param name * The name of the data store. * @return Returns a reference to this object so that method calls can be chained together. */ Builder name(String name); /** *

* A list of the Amazon S3 paths to read from. *

* * @param paths * A list of the Amazon S3 paths to read from. * @return Returns a reference to this object so that method calls can be chained together. */ Builder paths(Collection paths); /** *

* A list of the Amazon S3 paths to read from. *

* * @param paths * A list of the Amazon S3 paths to read from. * @return Returns a reference to this object so that method calls can be chained together. */ Builder paths(String... paths); /** *

* Specifies how the data is compressed. This is generally not necessary if the data has a standard file * extension. Possible values are "gzip" and "bzip"). *

* * @param compressionType * Specifies how the data is compressed. This is generally not necessary if the data has a standard file * extension. Possible values are "gzip" and "bzip"). * @see CompressionType * @return Returns a reference to this object so that method calls can be chained together. * @see CompressionType */ Builder compressionType(String compressionType); /** *

* Specifies how the data is compressed. This is generally not necessary if the data has a standard file * extension. Possible values are "gzip" and "bzip"). *

* * @param compressionType * Specifies how the data is compressed. This is generally not necessary if the data has a standard file * extension. Possible values are "gzip" and "bzip"). * @see CompressionType * @return Returns a reference to this object so that method calls can be chained together. * @see CompressionType */ Builder compressionType(CompressionType compressionType); /** *

* A string containing a JSON list of Unix-style glob patterns to exclude. For example, "[\"**.pdf\"]" excludes * all PDF files. *

* * @param exclusions * A string containing a JSON list of Unix-style glob patterns to exclude. For example, "[\"**.pdf\"]" * excludes all PDF files. * @return Returns a reference to this object so that method calls can be chained together. */ Builder exclusions(Collection exclusions); /** *

* A string containing a JSON list of Unix-style glob patterns to exclude. For example, "[\"**.pdf\"]" excludes * all PDF files. *

* * @param exclusions * A string containing a JSON list of Unix-style glob patterns to exclude. For example, "[\"**.pdf\"]" * excludes all PDF files. * @return Returns a reference to this object so that method calls can be chained together. */ Builder exclusions(String... exclusions); /** *

* The target group size in bytes. The default is computed based on the input data size and the size of your * cluster. When there are fewer than 50,000 input files, "groupFiles" must be set to * "inPartition" for this to take effect. *

* * @param groupSize * The target group size in bytes. The default is computed based on the input data size and the size of * your cluster. When there are fewer than 50,000 input files, "groupFiles" must be set to * "inPartition" for this to take effect. * @return Returns a reference to this object so that method calls can be chained together. */ Builder groupSize(String groupSize); /** *

* Grouping files is turned on by default when the input contains more than 50,000 files. To turn on grouping * with fewer than 50,000 files, set this parameter to "inPartition". To disable grouping when there are more * than 50,000 files, set this parameter to "none". *

* * @param groupFiles * Grouping files is turned on by default when the input contains more than 50,000 files. To turn on * grouping with fewer than 50,000 files, set this parameter to "inPartition". To disable grouping when * there are more than 50,000 files, set this parameter to "none". * @return Returns a reference to this object so that method calls can be chained together. */ Builder groupFiles(String groupFiles); /** *

* If set to true, recursively reads files in all subdirectories under the specified paths. *

* * @param recurse * If set to true, recursively reads files in all subdirectories under the specified paths. * @return Returns a reference to this object so that method calls can be chained together. */ Builder recurse(Boolean recurse); /** *

* This option controls the duration in milliseconds after which the s3 listing is likely to be consistent. * Files with modification timestamps falling within the last maxBand milliseconds are tracked specially when * using JobBookmarks to account for Amazon S3 eventual consistency. Most users don't need to set this option. * The default is 900000 milliseconds, or 15 minutes. *

* * @param maxBand * This option controls the duration in milliseconds after which the s3 listing is likely to be * consistent. Files with modification timestamps falling within the last maxBand milliseconds are * tracked specially when using JobBookmarks to account for Amazon S3 eventual consistency. Most users * don't need to set this option. The default is 900000 milliseconds, or 15 minutes. * @return Returns a reference to this object so that method calls can be chained together. */ Builder maxBand(Integer maxBand); /** *

* This option specifies the maximum number of files to save from the last maxBand seconds. If this number is * exceeded, extra files are skipped and only processed in the next job run. *

* * @param maxFilesInBand * This option specifies the maximum number of files to save from the last maxBand seconds. If this * number is exceeded, extra files are skipped and only processed in the next job run. * @return Returns a reference to this object so that method calls can be chained together. */ Builder maxFilesInBand(Integer maxFilesInBand); /** *

* Specifies additional connection options. *

* * @param additionalOptions * Specifies additional connection options. * @return Returns a reference to this object so that method calls can be chained together. */ Builder additionalOptions(S3DirectSourceAdditionalOptions additionalOptions); /** *

* Specifies additional connection options. *

* This is a convenience method that creates an instance of the {@link S3DirectSourceAdditionalOptions.Builder} * avoiding the need to create one manually via {@link S3DirectSourceAdditionalOptions#builder()}. * *

* When the {@link Consumer} completes, {@link S3DirectSourceAdditionalOptions.Builder#build()} is called * immediately and its result is passed to {@link #additionalOptions(S3DirectSourceAdditionalOptions)}. * * @param additionalOptions * a consumer that will call methods on {@link S3DirectSourceAdditionalOptions.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #additionalOptions(S3DirectSourceAdditionalOptions) */ default Builder additionalOptions(Consumer additionalOptions) { return additionalOptions(S3DirectSourceAdditionalOptions.builder().applyMutation(additionalOptions).build()); } /** *

* Specifies the delimiter character. The default is a comma: ",", but any other character can be specified. *

* * @param separator * Specifies the delimiter character. The default is a comma: ",", but any other character can be * specified. * @see Separator * @return Returns a reference to this object so that method calls can be chained together. * @see Separator */ Builder separator(String separator); /** *

* Specifies the delimiter character. The default is a comma: ",", but any other character can be specified. *

* * @param separator * Specifies the delimiter character. The default is a comma: ",", but any other character can be * specified. * @see Separator * @return Returns a reference to this object so that method calls can be chained together. * @see Separator */ Builder separator(Separator separator); /** *

* Specifies a character to use for escaping. This option is used only when reading CSV files. The default value * is none. If enabled, the character which immediately follows is used as-is, except for a small * set of well-known escapes (\n, \r, \t, and \0). *

* * @param escaper * Specifies a character to use for escaping. This option is used only when reading CSV files. The * default value is none. If enabled, the character which immediately follows is used as-is, * except for a small set of well-known escapes (\n, \r, \t, and * \0). * @return Returns a reference to this object so that method calls can be chained together. */ Builder escaper(String escaper); /** *

* Specifies the character to use for quoting. The default is a double quote: '"'. Set this to * -1 to turn off quoting entirely. *

* * @param quoteChar * Specifies the character to use for quoting. The default is a double quote: '"'. Set this * to -1 to turn off quoting entirely. * @see QuoteChar * @return Returns a reference to this object so that method calls can be chained together. * @see QuoteChar */ Builder quoteChar(String quoteChar); /** *

* Specifies the character to use for quoting. The default is a double quote: '"'. Set this to * -1 to turn off quoting entirely. *

* * @param quoteChar * Specifies the character to use for quoting. The default is a double quote: '"'. Set this * to -1 to turn off quoting entirely. * @see QuoteChar * @return Returns a reference to this object so that method calls can be chained together. * @see QuoteChar */ Builder quoteChar(QuoteChar quoteChar); /** *

* A Boolean value that specifies whether a single record can span multiple lines. This can occur when a field * contains a quoted new-line character. You must set this option to True if any record spans multiple lines. * The default value is False, which allows for more aggressive file-splitting during parsing. *

* * @param multiline * A Boolean value that specifies whether a single record can span multiple lines. This can occur when a * field contains a quoted new-line character. You must set this option to True if any record spans * multiple lines. The default value is False, which allows for more aggressive * file-splitting during parsing. * @return Returns a reference to this object so that method calls can be chained together. */ Builder multiline(Boolean multiline); /** *

* A Boolean value that specifies whether to treat the first line as a header. The default value is * False. *

* * @param withHeader * A Boolean value that specifies whether to treat the first line as a header. The default value is * False. * @return Returns a reference to this object so that method calls can be chained together. */ Builder withHeader(Boolean withHeader); /** *

* A Boolean value that specifies whether to write the header to output. The default value is True. *

* * @param writeHeader * A Boolean value that specifies whether to write the header to output. The default value is * True. * @return Returns a reference to this object so that method calls can be chained together. */ Builder writeHeader(Boolean writeHeader); /** *

* A Boolean value that specifies whether to skip the first data line. The default value is False. *

* * @param skipFirst * A Boolean value that specifies whether to skip the first data line. The default value is * False. * @return Returns a reference to this object so that method calls can be chained together. */ Builder skipFirst(Boolean skipFirst); /** *

* A Boolean value that specifies whether to use the advanced SIMD CSV reader along with Apache Arrow based * columnar memory formats. Only available in Glue version 3.0. *

* * @param optimizePerformance * A Boolean value that specifies whether to use the advanced SIMD CSV reader along with Apache Arrow * based columnar memory formats. Only available in Glue version 3.0. * @return Returns a reference to this object so that method calls can be chained together. */ Builder optimizePerformance(Boolean optimizePerformance); /** *

* Specifies the data schema for the S3 CSV source. *

* * @param outputSchemas * Specifies the data schema for the S3 CSV source. * @return Returns a reference to this object so that method calls can be chained together. */ Builder outputSchemas(Collection outputSchemas); /** *

* Specifies the data schema for the S3 CSV source. *

* * @param outputSchemas * Specifies the data schema for the S3 CSV source. * @return Returns a reference to this object so that method calls can be chained together. */ Builder outputSchemas(GlueSchema... outputSchemas); /** *

* Specifies the data schema for the S3 CSV source. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.glue.model.GlueSchema.Builder} avoiding the need to create one * manually via {@link software.amazon.awssdk.services.glue.model.GlueSchema#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.glue.model.GlueSchema.Builder#build()} is called immediately and its * result is passed to {@link #outputSchemas(List)}. * * @param outputSchemas * a consumer that will call methods on * {@link software.amazon.awssdk.services.glue.model.GlueSchema.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #outputSchemas(java.util.Collection) */ Builder outputSchemas(Consumer... outputSchemas); } static final class BuilderImpl implements Builder { private String name; private List paths = DefaultSdkAutoConstructList.getInstance(); private String compressionType; private List exclusions = DefaultSdkAutoConstructList.getInstance(); private String groupSize; private String groupFiles; private Boolean recurse; private Integer maxBand; private Integer maxFilesInBand; private S3DirectSourceAdditionalOptions additionalOptions; private String separator; private String escaper; private String quoteChar; private Boolean multiline; private Boolean withHeader; private Boolean writeHeader; private Boolean skipFirst; private Boolean optimizePerformance; private List outputSchemas = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(S3CsvSource model) { name(model.name); paths(model.paths); compressionType(model.compressionType); exclusions(model.exclusions); groupSize(model.groupSize); groupFiles(model.groupFiles); recurse(model.recurse); maxBand(model.maxBand); maxFilesInBand(model.maxFilesInBand); additionalOptions(model.additionalOptions); separator(model.separator); escaper(model.escaper); quoteChar(model.quoteChar); multiline(model.multiline); withHeader(model.withHeader); writeHeader(model.writeHeader); skipFirst(model.skipFirst); optimizePerformance(model.optimizePerformance); outputSchemas(model.outputSchemas); } public final String getName() { return name; } public final void setName(String name) { this.name = name; } @Override public final Builder name(String name) { this.name = name; return this; } public final Collection getPaths() { if (paths instanceof SdkAutoConstructList) { return null; } return paths; } public final void setPaths(Collection paths) { this.paths = EnclosedInStringPropertiesCopier.copy(paths); } @Override public final Builder paths(Collection paths) { this.paths = EnclosedInStringPropertiesCopier.copy(paths); return this; } @Override @SafeVarargs public final Builder paths(String... paths) { paths(Arrays.asList(paths)); return this; } public final String getCompressionType() { return compressionType; } public final void setCompressionType(String compressionType) { this.compressionType = compressionType; } @Override public final Builder compressionType(String compressionType) { this.compressionType = compressionType; return this; } @Override public final Builder compressionType(CompressionType compressionType) { this.compressionType(compressionType == null ? null : compressionType.toString()); return this; } public final Collection getExclusions() { if (exclusions instanceof SdkAutoConstructList) { return null; } return exclusions; } public final void setExclusions(Collection exclusions) { this.exclusions = EnclosedInStringPropertiesCopier.copy(exclusions); } @Override public final Builder exclusions(Collection exclusions) { this.exclusions = EnclosedInStringPropertiesCopier.copy(exclusions); return this; } @Override @SafeVarargs public final Builder exclusions(String... exclusions) { exclusions(Arrays.asList(exclusions)); return this; } public final String getGroupSize() { return groupSize; } public final void setGroupSize(String groupSize) { this.groupSize = groupSize; } @Override public final Builder groupSize(String groupSize) { this.groupSize = groupSize; return this; } public final String getGroupFiles() { return groupFiles; } public final void setGroupFiles(String groupFiles) { this.groupFiles = groupFiles; } @Override public final Builder groupFiles(String groupFiles) { this.groupFiles = groupFiles; return this; } public final Boolean getRecurse() { return recurse; } public final void setRecurse(Boolean recurse) { this.recurse = recurse; } @Override public final Builder recurse(Boolean recurse) { this.recurse = recurse; return this; } public final Integer getMaxBand() { return maxBand; } public final void setMaxBand(Integer maxBand) { this.maxBand = maxBand; } @Override public final Builder maxBand(Integer maxBand) { this.maxBand = maxBand; return this; } public final Integer getMaxFilesInBand() { return maxFilesInBand; } public final void setMaxFilesInBand(Integer maxFilesInBand) { this.maxFilesInBand = maxFilesInBand; } @Override public final Builder maxFilesInBand(Integer maxFilesInBand) { this.maxFilesInBand = maxFilesInBand; return this; } public final S3DirectSourceAdditionalOptions.Builder getAdditionalOptions() { return additionalOptions != null ? additionalOptions.toBuilder() : null; } public final void setAdditionalOptions(S3DirectSourceAdditionalOptions.BuilderImpl additionalOptions) { this.additionalOptions = additionalOptions != null ? additionalOptions.build() : null; } @Override public final Builder additionalOptions(S3DirectSourceAdditionalOptions additionalOptions) { this.additionalOptions = additionalOptions; return this; } public final String getSeparator() { return separator; } public final void setSeparator(String separator) { this.separator = separator; } @Override public final Builder separator(String separator) { this.separator = separator; return this; } @Override public final Builder separator(Separator separator) { this.separator(separator == null ? null : separator.toString()); return this; } public final String getEscaper() { return escaper; } public final void setEscaper(String escaper) { this.escaper = escaper; } @Override public final Builder escaper(String escaper) { this.escaper = escaper; return this; } public final String getQuoteChar() { return quoteChar; } public final void setQuoteChar(String quoteChar) { this.quoteChar = quoteChar; } @Override public final Builder quoteChar(String quoteChar) { this.quoteChar = quoteChar; return this; } @Override public final Builder quoteChar(QuoteChar quoteChar) { this.quoteChar(quoteChar == null ? null : quoteChar.toString()); return this; } public final Boolean getMultiline() { return multiline; } public final void setMultiline(Boolean multiline) { this.multiline = multiline; } @Override public final Builder multiline(Boolean multiline) { this.multiline = multiline; return this; } public final Boolean getWithHeader() { return withHeader; } public final void setWithHeader(Boolean withHeader) { this.withHeader = withHeader; } @Override public final Builder withHeader(Boolean withHeader) { this.withHeader = withHeader; return this; } public final Boolean getWriteHeader() { return writeHeader; } public final void setWriteHeader(Boolean writeHeader) { this.writeHeader = writeHeader; } @Override public final Builder writeHeader(Boolean writeHeader) { this.writeHeader = writeHeader; return this; } public final Boolean getSkipFirst() { return skipFirst; } public final void setSkipFirst(Boolean skipFirst) { this.skipFirst = skipFirst; } @Override public final Builder skipFirst(Boolean skipFirst) { this.skipFirst = skipFirst; return this; } public final Boolean getOptimizePerformance() { return optimizePerformance; } public final void setOptimizePerformance(Boolean optimizePerformance) { this.optimizePerformance = optimizePerformance; } @Override public final Builder optimizePerformance(Boolean optimizePerformance) { this.optimizePerformance = optimizePerformance; return this; } public final List getOutputSchemas() { List result = GlueSchemasCopier.copyToBuilder(this.outputSchemas); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setOutputSchemas(Collection outputSchemas) { this.outputSchemas = GlueSchemasCopier.copyFromBuilder(outputSchemas); } @Override public final Builder outputSchemas(Collection outputSchemas) { this.outputSchemas = GlueSchemasCopier.copy(outputSchemas); return this; } @Override @SafeVarargs public final Builder outputSchemas(GlueSchema... outputSchemas) { outputSchemas(Arrays.asList(outputSchemas)); return this; } @Override @SafeVarargs public final Builder outputSchemas(Consumer... outputSchemas) { outputSchemas(Stream.of(outputSchemas).map(c -> GlueSchema.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } @Override public S3CsvSource build() { return new S3CsvSource(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy