

# PySpark 拡張子型
<a name="aws-glue-api-crawler-pyspark-extensions-types"></a>

AWS Glue PySpark 拡張子で使用される型。

## DataType
<a name="aws-glue-api-crawler-pyspark-extensions-types-awsglue-datatype"></a>

他の AWS Glue 型の基本クラス。

**`__init__(properties={})`**
+ `properties` – データ型のプロパティ (オプション)。

 

**`typeName(cls)`**

AWS Glue 型クラスの種類 (つまり、"型" が末尾から削除されたクラス名) を返します。
+ `cls` – AWS Glue から派生した `DataType` クラスインスタンス。

 

`jsonValue( )`

データ型とクラスのプロパティが含まれる JSON オブジェクトを返します。

```
  {
    "dataType": typeName,
    "properties": properties
  }
```

## AtomicType およびシンプルデリバティブ
<a name="aws-glue-api-crawler-pyspark-extensions-types-awsglue-atomictype"></a>

[DataType](#aws-glue-api-crawler-pyspark-extensions-types-awsglue-datatype) クラスから継承して拡張し、すべての AWS Glue アトミックデータ型の基本クラスとして機能します。

**`fromJsonValue(cls, json_value)`**

JSON オブジェクトからの値を使用してクラスインスタンスを初期化します。
+ `cls` – 初期化する AWS Glue 型のクラスインスタンス。
+ `json_value` – キーと値のペアのロード元の JSON オブジェクト。

 

次の型は、[AtomicType](#aws-glue-api-crawler-pyspark-extensions-types-awsglue-atomictype) クラスのシンプルデリバティブです。
+ `BinaryType` – バイナリデータ。
+ `BooleanType` – ブール値。
+ `ByteType` – バイト値。
+ `DateType` – 日時値。
+ `DoubleType` – 倍精度浮動小数点値。
+ `IntegerType` – 整数値。
+ `LongType` – 長整数値。
+ `NullType` – null 値。
+ `ShortType` – 短整数値。
+ `StringType` – テキスト文字列。
+ `TimestampType` – タイムスタンプ値 (通常は 1970 年 1 月 1 日からの秒数)。
+ `UnknownType` – 未確認型の値。

## DecimalType(AtomicType)
<a name="aws-glue-api-crawler-pyspark-extensions-types-awsglue-decimaltype"></a>

10 進数 (バイナリ 2 進数ではなく、10 進数で表記される数) を表わすため、[AtomicType](#aws-glue-api-crawler-pyspark-extensions-types-awsglue-atomictype) クラスから継承して拡張します。

**`__init__(precision=10, scale=2, properties={})`**
+ `precision` – 10 進数の桁数 (オプション、デフォルトは 10)。
+ `scale` – 小数点以下の桁数 (オプション、デフォルトは 2)。
+ `properties` – 10 進数のプロパティ (オプション)。

## EnumType(AtomicType)
<a name="aws-glue-api-crawler-pyspark-extensions-types-awsglue-enumtype"></a>

有効なオプションの列挙を表すために、[AtomicType](#aws-glue-api-crawler-pyspark-extensions-types-awsglue-atomictype) クラスから継承して拡張します。

**`__init__(options)`**
+ `options` – 列挙されているオプションのリスト。

##  コレクション型
<a name="aws-glue-api-crawler-pyspark-extensions-types-awsglue-collections"></a>
+ [ArrayType(DataType)](#aws-glue-api-crawler-pyspark-extensions-types-awsglue-arraytype)
+ [ChoiceType(DataType)](#aws-glue-api-crawler-pyspark-extensions-types-awsglue-choicetype)
+ [MapType(DataType)](#aws-glue-api-crawler-pyspark-extensions-types-awsglue-maptype)
+ [フィールド (オブジェクト)](#aws-glue-api-crawler-pyspark-extensions-types-awsglue-field)
+ [StructType(DataType)](#aws-glue-api-crawler-pyspark-extensions-types-awsglue-structtype)
+ [EntityType(DataType)](#aws-glue-api-crawler-pyspark-extensions-types-awsglue-entitytype)

## ArrayType(DataType)
<a name="aws-glue-api-crawler-pyspark-extensions-types-awsglue-arraytype"></a>

**`__init__(elementType=UnknownType(), properties={})`**
+ `elementType` – 配列の要素の型 (オプション、デフォルトは UnknownType)。
+ `properties` – 配列のプロパティ (オプション)。

## ChoiceType(DataType)
<a name="aws-glue-api-crawler-pyspark-extensions-types-awsglue-choicetype"></a>

**`__init__(choices=[], properties={})`**
+ `choices` – 選択肢のリスト (オプション)。
+ `properties` – これらのオプションのプロパティ (オプション)。

 

**`add(new_choice)`**

可能な選択肢のリストに、新しい選択肢を追加します。
+ `new_choice` – 可能な選択肢のリストに追加する選択肢。

 

**`merge(new_choices)`**

新しい選択肢のリストを既存の選択肢のリストとマージします。
+ `new_choices` – 既存の選択肢とマージする新しい選択肢のリスト。

## MapType(DataType)
<a name="aws-glue-api-crawler-pyspark-extensions-types-awsglue-maptype"></a>

**`__init__(valueType=UnknownType, properties={})`**
+ `valueType` – マップの値の型 (オプション、デフォルトは UnknownType)。
+ `properties` – マップのプロパティ (オプション)。

## フィールド (オブジェクト)
<a name="aws-glue-api-crawler-pyspark-extensions-types-awsglue-field"></a>

[DataType](#aws-glue-api-crawler-pyspark-extensions-types-awsglue-datatype) から派生したオブジェクトからフィールドオブジェクトを作成します。

**`__init__(name, dataType, properties={})`**
+ `name` – フィールドに割り当てる名前。
+ `dataType` – フィールド作成元のオブジェクト。
+ `properties` – フィールドのプロパティ (オプション)。

## StructType(DataType)
<a name="aws-glue-api-crawler-pyspark-extensions-types-awsglue-structtype"></a>

データ構造を定義します (`struct`)。

**`__init__(fields=[], properties={})`**
+ `fields` – フィールドのリスト (`Field` 型) 構造に含めます (オプション)。
+ `properties` – 構造のプロパティ (オプション)。

 

**`add(field)`**
+ `field` – 構造に追加するオブジェクトの `Field` 型。

 

**`hasField(field)`**

この構造に同じ名前のフィールドがある場合は `True` を、そうでない場合は `False` を返します。
+ `field` – フィールド名、または名前が使用される `Field` 型のオブジェクト。

 

**`getField(field)`**
+ `field` – 名前が使用される `Field` 型のフィールド名またはオブジェクト。構造に同じ名前のフィールドがある場合は、返されます。

## EntityType(DataType)
<a name="aws-glue-api-crawler-pyspark-extensions-types-awsglue-entitytype"></a>

`__init__(entity, base_type, properties)`

このクラスは、まだ実装されていません。

##  その他の型
<a name="aws-glue-api-crawler-pyspark-extensions-types-awsglue-other-types"></a>
+ [DataSource (オブジェクト)](#aws-glue-api-crawler-pyspark-extensions-types-awsglue-data-source)
+ [DataSink (オブジェクト)](#aws-glue-api-crawler-pyspark-extensions-types-awsglue-data-sink)

## DataSource (オブジェクト)
<a name="aws-glue-api-crawler-pyspark-extensions-types-awsglue-data-source"></a>

**`__init__(j_source, sql_ctx, name)`**
+ `j_source` – データソース。
+ `sql_ctx` – SQL コンテキスト。
+ `name` – データソース名。

 

**`setFormat(format, **options)`**
+ `format` – データソースを設定する形式。
+ `options` – データソースに設定するオプションのコレクション。形式オプションの詳細については、「[AWS Glue for Spark での入出力のデータ形式に関するオプション](aws-glue-programming-etl-format.md)」を参照してください。

 

`getFrame()`

データソースに `DynamicFrame` を返します。

## DataSink (オブジェクト)
<a name="aws-glue-api-crawler-pyspark-extensions-types-awsglue-data-sink"></a>

**`__init__(j_sink, sql_ctx)`**
+ `j_sink` – 作成するシンク。
+ `sql_ctx` – データシンクの SQL コンテキスト。

 

**`setFormat(format, **options)`**
+ `format` – データシンクを設定する形式。
+ `options` – データシンクに設定するオプションのコレクション。形式オプションの詳細については、「[AWS Glue for Spark での入出力のデータ形式に関するオプション](aws-glue-programming-etl-format.md)」を参照してください。

 

**`setAccumulableSize(size)`**
+ `size` – 設定する累積サイズ (バイト単位)。

 

**`writeFrame(dynamic_frame, info="")`**
+ `dynamic_frame` - 書き込む `DynamicFrame`。
+ `info` – `DynamicFrame` に関する情報 (オプション)。

 

**`write(dynamic_frame_or_dfc, info="")`**

`DynamicFrame` または `DynamicFrameCollection` を書き込みます。
+ `dynamic_frame_or_dfc` – 書き込む `DynamicFrame` オブジェクトまたは `DynamicFrameCollection` オブジェクトのいずれか。
+ `info` – 書き込む `DynamicFrame` または `DynamicFrames` に関する情報 (オプション)。