

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# GlueTransform base 類別
<a name="aws-glue-api-crawler-pyspark-transforms-GlueTransform"></a>

所有 `awsglue.transforms` 類別繼承的基底類別。

所有類別皆定義一項 `__call__` 方法。依據預設，它們會覆寫下列的 `GlueTransform` 類別方法，或者透過使用類別名稱呼叫。

## 方法
<a name="aws-glue-api-crawler-pyspark-transforms-GlueTransform-_methods"></a>
+ [apply(cls, \*args, \*\*kwargs)](#aws-glue-api-crawler-pyspark-transforms-GlueTransform-apply)
+ [name(cls)](#aws-glue-api-crawler-pyspark-transforms-GlueTransform-name)
+ [describeArgs(cls)](#aws-glue-api-crawler-pyspark-transforms-GlueTransform-describeArgs)
+ [describeReturn(cls)](#aws-glue-api-crawler-pyspark-transforms-GlueTransform-describeReturn)
+ [describeTransform(cls)](#aws-glue-api-crawler-pyspark-transforms-GlueTransform-describeTransform)
+ [describeErrors(cls)](#aws-glue-api-crawler-pyspark-transforms-GlueTransform-describeErrors)
+ [describe(cls)](#aws-glue-api-crawler-pyspark-transforms-GlueTransform-describe)

## apply(cls, \*args, \*\*kwargs)
<a name="aws-glue-api-crawler-pyspark-transforms-GlueTransform-apply"></a>

藉由呼叫轉換類別並傳回結果以套用轉換。
+ `cls` – `self` 類別物件。

## name(cls)
<a name="aws-glue-api-crawler-pyspark-transforms-GlueTransform-name"></a>

傳回衍生的轉換類別名稱。
+ `cls` – `self` 類別物件。

## describeArgs(cls)
<a name="aws-glue-api-crawler-pyspark-transforms-GlueTransform-describeArgs"></a>
+ `cls` – `self` 類別物件。

傳回字典清單，每個皆對應至一個具名引數，格式如下：

```
[
  {
    "name": "{{(name of argument)}}",
    "type": "{{(type of argument)}}",
    "description": "{{(description of argument)}}",
    "optional": "{{(Boolean, True if the argument is optional)}}",
    "defaultValue": "(Default value string, or None){{(String; the default value, or None)}}"
  },
...
]
```

呼叫未實作的衍生轉換時，引發 `NotImplementedError` 例外。

## describeReturn(cls)
<a name="aws-glue-api-crawler-pyspark-transforms-GlueTransform-describeReturn"></a>
+ `cls` – `self` 類別物件。

傳回字典及有關傳回類型的資訊，格式如下：

```
{
  "type": "{{(return type)}}",
  "description": "{{(description of output)}}"
}
```

呼叫未實作的衍生轉換時，引發 `NotImplementedError` 例外。

## describeTransform(cls)
<a name="aws-glue-api-crawler-pyspark-transforms-GlueTransform-describeTransform"></a>

傳回描述轉換的字串。
+ `cls` – `self` 類別物件。

呼叫未實作的衍生轉換時，引發 `NotImplementedError` 例外。

## describeErrors(cls)
<a name="aws-glue-api-crawler-pyspark-transforms-GlueTransform-describeErrors"></a>
+ `cls` – `self` 類別物件。

傳回字典的清單，每個皆描述此轉換可能擲出的例外狀況，格式如下：

```
[
  {
    "type": "{{(type of error)}}",
    "description": "{{(description of error)}}"
  },
...
]
```

## describe(cls)
<a name="aws-glue-api-crawler-pyspark-transforms-GlueTransform-describe"></a>
+ `cls` – `self` 類別物件。

以下列格式傳回物件：

```
{
  "transform" : {
    "name" : cls.name( ),
    "args" : cls.describeArgs( ),
    "returns" : cls.describeReturn( ),
    "raises" : cls.describeErrors( ),
    "location" : "internal"
  }
}
```