AntoinetteF
AntoinetteF

Reputation: 21

Equivalent to LEFT() function in Google cloud data fusion data pipeline wrangler?

I need to port recipes from dataprep recipe into data fusion pipeline wrangler.

derive type: single value: LEFT(column3, 3) as: 'column3'

When I enter custom transform it gives me an error: io.cdap.wrangler.expression.EL.compile@1:6 unsolvable function/method 'LEFT'

Upvotes: 1

Views: 991

Answers (1)

John Dow
John Dow

Reputation: 806

The equivalent to LEFT() in Cloud Data Fusion and CDAP is the following Directives called "cut-character".

Here is the syntax:

cut-character <source> <destination> <type> <range|indexes>

Here is a sample snippet that takes the first three characters from the SKU column values and transposes it to a new column named NewSKu:

cut-character SKU NewSku 1-3

This also can be achieved through the UI, by selecting Extract fields - using positions

enter image description here

Reference docs: https://docs.cask.co/cdap/current/en/user-guide/data-preparation/directives/cut-character.html

Upvotes: 4

Related Questions