注: 以下の翻訳の正確性は検証されていません。AIPを利用して英語版の原文から機械的に翻訳されたものです。

配列を位置情報付きで展開

サポート対象:バッチ、ストリーミング

配列を値ごとに1行に展開し、配列内の要素の相対位置と要素自体を含む構造体として出力します。

式のカテゴリー: 配列

宣言された引数

  • 配列: 展開する値の配列。
    Expression<Array<T>>
  • 任意 空の配列 / null 配列を保持: true の場合、空の配列と null は出力で null として保持されます。それ以外の場合は、絞り込みによって除外されます。
    Literal<Boolean>

型変数の制約: T は AnyType を受け付けます

出力タイプ: Struct<Optional[position], Optional[element]>

例

例1:基本ケース

引数の値:

  • 配列: array
  • 空の配列 / null 配列を保持: null

入力テーブル:

array
[ one, two, three ]
[ four, five ]

期待される出力テーブル: | array | | ----- | | {
 element -> one,
 position -> 1,
} | | {
 element -> two,
 position -> 2,
} | | {
 element -> three,
 position -> 3,
} | | {
 element -> four,
 position -> 1,
} | | {
 element -> five,
 position -> 2,
} |


例2:エッジケース

引数の値:

  • 配列: array
  • 空の配列 / null 配列を保持: false

入力テーブル:

array
[ one, two, three ]
[ ]
[ four, five ]
[ ]

期待される出力テーブル: | array | | ----- | | {
 element -> one,
 position -> 1,
} | | {
 element -> two,
 position -> 2,
} | | {
 element -> three,
 position -> 3,
} | | {
 element -> four,
 position -> 1,
} | | {
 element -> five,
 position -> 2,
} |


例3:エッジケース

引数の値:

  • 配列: array
  • 空の配列 / null 配列を保持: true

入力テーブル:

array
[ one, two, three ]
[ ]
[ four, five ]
[ ]

期待される出力テーブル: | array | | ----- | | {
 element -> one,
 position -> 1,
} | | {
 element -> two,
 position -> 2,
} | | {
 element -> three,
 position -> 3,
} | | {
 element -> null,
 position -> null,
} | | {
 element -> four,
 position -> 1,
} | | {
 element -> five,
 position -> 2,
} | | {
 element -> null,
 position -> null,
} |