Dataset Viewer
Auto-converted to Parquet Duplicate
graph
stringlengths
17
39
group
stringlengths
4
34
node
stringlengths
4
41
component
stringlengths
4
22
attr
stringclasses
13 values
spec
stringlengths
63
1.76k
ports
listlengths
0
5
dictionary
listlengths
0
3
parameters
listlengths
0
4
code
stringlengths
26
3.31k
01_Reformat_address.grf
bf01
IS_ACTIVE
EXT_FILTER
filterExpression
Return true when input port 0 field isActive equals true, otherwise false.
[ "$in.0: Customer (delimited): id long, fullName string, streetAddress string, city string, postalCode string, state string, country string, email string, phone string, accountCreated date \"yyyy-MM-dd\", isActive boolean", "$out.0: Customer (delimited): id long, fullName string, streetAddress string, city string,...
[]
[]
//#CTL2 $in.0.isActive == true
01_Reformat_address.grf
bf01
FORMAT_ADDRESS
REFORMAT
transform
For each input record on port 0 write output port 0: id = id; name = fullName; addressLine1 = streetAddress; addressLine2 = city, then a comma and space, then state, then a space, then postalCode; addressLine3 = country. Always emit the record to all outputs.
[ "$in.0: Customer (delimited): id long, fullName string, streetAddress string, city string, postalCode string, state string, country string, email string, phone string, accountCreated date \"yyyy-MM-dd\", isActive boolean", "$out.0: CustomerAddress (delimited): id long, name string, addressLine1 string, addressLin...
[]
[]
//#CTL2 function integer transform() { $out.0.id = $in.0.id; $out.0.name = $in.0.fullName; $out.0.addressLine1 = $in.0.streetAddress; $out.0.addressLine2 = $in.0.city+", "+$in.0.state+" "+$in.0.postalCode; $out.0.addressLine3 = $in.0.country; return ALL; }
04_Load_customers.grf
bf04
REFORMAT
REFORMAT
transform
Copy every field from input port 0 to output port 0 by name (wildcard copy) and emit the record.
[ "$in.0: Customer (delimited): id long, fullName string, streetAddress string, city string, postalCode string, state string, country string, email string, phone string, accountCreated date \"yyyy-MM-dd\", isActive boolean", "$out.0: Customer (delimited): id long, fullName string, streetAddress string, city string,...
[]
[]
//#CTL2 function integer transform() { $out.0.* = $in.0.*; return ALL; }
06_Load_orders.grf
bf06
PULL_ADDRESSES_TOGETHER
DENORMALIZER
denormalize
Input is sorted by orderId; keep one working record of the order-address summary type (id, shipping_address_id, billing_address_id). For each incoming row on input port 0: set id to orderId; if type is shipping, store addressId as shipping_address_id; if type is billing, store addressId as billing_address_id; for any o...
[ "$in.0: AddressOrderId (delimited): addressId long, orderId long, type string", "$out.0: OrderAddresses (delimited): id long, shipping_address_id long, billing_address_id long" ]
[]
[]
//#CTL2 OrderAddresses orderAddresses; function integer append() { orderAddresses.id = $in.0.orderId; switch ($in.0.type) { case "shipping": orderAddresses.shipping_address_id = $in.0.addressId; break; case "billing": orderAddresses.billing_address_id = $in.0.addressId; break; default: raiseE...
06_Load_orders.grf
bf06
ADD_ADDRESSES
EXT_MERGE_JOIN
transform
Left outer join output on port 0: id, customer_id (from customerId), order_datetime (from orderDatetime) come from the order on input port 0; shipping_address_id and billing_address_id come from the address summary on input port 1 (null when no match). Always emit the record.
[ "$in.0: Order (delimited): id long, customerId long, orderDatetime date \"yyyy-MM-dd HH:mm:ss\"", "$in.1: OrderAddresses (delimited): id long, shipping_address_id long, billing_address_id long", "$out.0: OrderExt (delimited): id long, customer_id long, order_datetime date \"yyyy-MM-dd HH:mm:ss\", shipping_addre...
[]
[]
//#CTL2 function integer transform() { $out.0.id = $in.0.id; $out.0.customer_id = $in.0.customerId; $out.0.order_datetime = $in.0.orderDatetime; $out.0.shipping_address_id = $in.1.shipping_address_id; $out.0.billing_address_id = $in.1.billing_address_id; return ALL; }
08a_Count_unique_visitors.grf
bf08
UID_AND_TIMESTAMP
REFORMAT
transform
For each record on input port 0, write to output 0: UID = SHA-256 hash of the string concatenation of clientIp and userAgent; timestamp = the log timestamp formatted as yyyyMM. Always emit the record.
[ "$in.0: LogLine (delimited): clientIp string, timestamp date \"yyyy-MM-dd HH:mm:ss\", url string, httpResponse integer, userAgent string", "$out.0: Visit (delimited): UID byte, timestamp string" ]
[]
[]
//#CTL2 function integer transform() { $out.0.UID = sha256($in.0.clientIp + $in.0.userAgent); $out.0.timestamp = date2str($in.0.timestamp, "yyyyMM"); return ALL; }
08b_Count_unique_visitors_clustered.grf
bf08
PARALLEL_PARTITION
CLUSTER_PARTITION
partitionSource
Read the graph parameter WORKER_COUNT as an integer. Return the month number (getMonth) of the input timestamp on input port 0 modulo WORKER_COUNT as the output port number.
[ "$in.0: LogLine (delimited): clientIp string, timestamp date \"yyyy-MM-dd HH:mm:ss\", url string, httpResponse integer, userAgent string", "$out.0: (record defined by the component)" ]
[]
[ "WORKER_COUNT = 4" ]
//#CTL2 integer WORKER_COUNT = str2integer("${WORKER_COUNT}"); function integer getOutputPort() { return getMonth($in.0.timestamp) % WORKER_COUNT; }
08b_Count_unique_visitors_clustered.grf
bf08
UID_AND_TIMESTAMP
REFORMAT
transform
For each record on input port 0, write to output 0: UID = SHA-256 hash of the string concatenation of clientIp and userAgent; timestamp = the log timestamp formatted as yyyyMM. Always emit the record.
[ "$in.0: (record defined by the component)", "$out.0: Visit (delimited): UID byte, timestamp string" ]
[]
[]
//#CTL2 function integer transform() { $out.0.UID = sha256($in.0.clientIp + $in.0.userAgent); $out.0.timestamp = date2str($in.0.timestamp, "yyyyMM"); return ALL; }
09_Data_normalization.grf
bf09
PHONE_NUMBERS
NORMALIZER
normalize
Keep a working list of strings, emptied at start and after each input record. Count step: split the phone field of input port 0 on commas into the list and return the list length as the number of output records. Transform step for index i: output 0 customerId = input id; order = i; phone = the i-th item trimmed of whit...
[ "$in.0: Customer (delimited): id long, fullName string, streetAddress string, city string, postalCode string, state string, country string, email string, phone string, accountCreated date \"yyyy-MM-dd\", isActive boolean", "$out.0: PhoneNumber (delimited): customerId long, order integer, phone string" ]
[]
[]
//#CTL2 string[] phoneNumbers; clean(); function integer count() { phoneNumbers = split($in.0.phone, ","); return length(phoneNumbers); } function integer transform(integer i) { $out.0.customerId = $in.0.id; $out.0.order = i; $out.0.phone = trim(phoneNumbers[i]); return OK; } function void clean() { clear(ph...
10_Data_denormalization.grf
bf10
DENORMALIZER
DENORMALIZER
denormalize
Input is grouped by customerId. Keep global state: the current customer id, a count per payment type and an amount per payment type for CASH, CARD and WIRE, all reset to zero (id -1) at start and after every output. Per input row on port 0: remember customerId, add 1 to the count of its paymentType and add paidAmount t...
[ "$in.0: (record defined by the component)", "$out.0: PreferredPayment (delimited): customerId long, preferredPaymentType string, totalPaymentCount long, cashCount long, cashAmount decimal(12,2), cardCount long, cardAmount decimal(12,2), wireCount long, wireAmount decimal(12,2)" ]
[]
[]
//#CTL2 string[] PAYMENT_TYPES = ["CASH", "CARD", "WIRE"]; long currentCustomerId; map[string, integer] paymentCounts; map[string, decimal] paymentAmounts; clean(); // In append function we process each record for given customer in turn and update global variables holding amounts // and counts for each payment method...
12b_List_sandboxes_SOAP.grf
bf12
GET_JOB_INPUT
GET_JOB_INPUT
mapping
Generate exactly one record on output 0: userName = the value of graph parameter USER_NAME, password = the value of graph parameter PASSWORD, and return ALL.
[ "$out.0: Credentials (delimited): userName string, password string" ]
[]
[ "USER_NAME = clover", "PASSWORD = clover" ]
//#CTL2 function integer transform() { $out.0.userName = "${USER_NAME}"; $out.0.password = "${PASSWORD}"; return ALL; }
12b_List_sandboxes_SOAP.grf
bf12
VALID_TOKEN
EXT_FILTER
filterExpression
Return true when sessionToken on input port 0 is not null; true records go to accepted output 0, others to rejected output 1.
[ "$in.0: SessionToken (delimited): sessionToken string", "$out.0: SessionToken (delimited): sessionToken string", "$out.1: SessionToken (delimited): sessionToken string" ]
[]
[]
//#CTL2 $in.0.sessionToken != null
14a_Cluster_partitioning_simple.grf
bf14
ENRICH_PAYMENT_RECORD
EXT_HASH_JOIN
transform
Join output 0 (matched): id, order_id, payment_type, paid_amount, payment_date from the payment (input port 0); shipping_address_id, billing_address_id, order_datetime from the order (input port 1); customer_id is first set from the payment and then overwritten by the order's customer_id; order_customer_id = order's cu...
[ "$in.0: (record defined by the component)", "$in.1: Orders (delimited): id long, customer_id long, order_datetime date \"yyyy-MM-dd HH:mm:ss.SSS\", shipping_address_id long, billing_address_id long", "$out.0: EnrichedPayments (delimited): id long, order_id long, customer_id long, payment_type string, paid_amoun...
[]
[]
//#CTL2 function integer transform() { $out.0.id = $in.0.id; $out.0.order_id = $in.0.order_id; $out.0.customer_id = $in.0.customer_id; $out.0.payment_type = $in.0.payment_type; $out.0.paid_amount = $in.0.paid_amount; $out.0.payment_date = $in.0.payment_date; $out.0.shipping_address_id = $in.1.shipping_address_i...
14a_Cluster_partitioning_simple.grf
bf14
VALIDATE_PAYMENT
VALIDATOR
errorMapping
Invalid output (port 1): copy all fields of input port 0 (the payment record), then set validationMessage from input port 1 validationMessage and ruleName from input port 1 ruleName (the name of the failed rule).
[ "$in.0: EnrichedPayments (delimited): id long, order_id long, customer_id long, payment_type string, paid_amount decimal(12,2), payment_date date \"yyyy-MM-dd HH:mm:ss.SSS\", shipping_address_id long, billing_address_id long, order_customer_id long, order_datetime date \"yyyy-MM-dd HH:mm:ss.SSS\"", "$out.0: Enric...
[]
[]
//#CTL2 function integer transform() { $out.1.* = $in.0.*; $out.1.validationMessage = $in.1.validationMessage; $out.1.ruleName = $in.1.ruleName; return ALL; }
14a_Cluster_partitioning_simple.grf
bf14
OVERDUE_PAYMENT
EXT_FILTER
filterExpression
Accept the record (port 0) when input ruleName equals the string CheckOverduePayment; otherwise it goes to the rejected port 1.
[ "$in.0: (record defined by the component)", "$out.0: (record defined by the component)", "$out.1: (record defined by the component)" ]
[]
[]
//#CTL2 $in.0.ruleName == "CheckOverduePayment"
14b_Cluster_partitioning_advanced.grf
bf14
PARALLEL_PARTITION
CLUSTER_PARTITION
partitionSource
Return the output partition number for each payment: upper-case input port 0 payment_type; if it equals CASH return 0, for any other value return 1.
[ "$in.0: Payments (delimited): id long, order_id long, customer_id long, payment_type string, paid_amount decimal(12,2), payment_date date \"yyyy-MM-dd HH:mm:ss.SSS\"", "$out.0: (record defined by the component)" ]
[]
[]
//#CTL2 function integer getOutputPort() { switch (upperCase($in.0.payment_type)) { case "CASH" : return 0; default: return 1; } }
15_Read_Write_MongoDB.grf
bf15
FAIL
FAIL
mapping
Set output 0 errorMessage to input 0 errMessage, or input 0 errOut when errMessage is null.
[ "$in.0: (record defined by the component)" ]
[]
[]
//#CTL2 function integer transform() { $out.0.errorMessage = nvl($in.0.errMessage, $in.0.errOut); return ALL; }
15_Read_Write_MongoDB.grf
bf15
MAP_DATE
REFORMAT
transform
Copy all fields from input 0 to output 0, then set accountCreated to the input accountCreated formatted as the string yyyy-MM-dd'T'HH:mm:ss'Z'.
[ "$in.0: Customer (delimited): id long, fullName string, streetAddress string, city string, postalCode string, state string, country string, email string, phone string, accountCreated date \"yyyy-MM-dd\", isActive boolean", "$out.0: CustomerMongo (delimited): id long, fullName string, streetAddress string, city st...
[]
[]
//#CTL2 function integer transform() { $out.0.* = $in.0.*; $out.0.accountCreated = date2str($in.0.accountCreated, "yyyy-MM-dd'T'HH:mm:ss'Z'"); return ALL; }
15_Read_Write_MongoDB.grf
bf15
DATE_RANGE
GET_JOB_INPUT
mapping
Output 0: rangeMin = date 2016-01-01, rangeMax = date 2017-01-01.
[ "$out.0: DateRange (delimited): rangeMin date \"yyyy-MM-dd HH:mm:ss\", rangeMax date \"yyyy-MM-dd HH:mm:ss\"" ]
[]
[]
//#CTL2 function integer transform() { $out.0.rangeMin = 2016-01-01; $out.0.rangeMax = 2017-01-01; return ALL; }
15_Read_Write_MongoDB.grf
bf15
QUERY_CUSTOMERS_BY_DATE
MONGODB_READER
inputMapping
Build a JSON query object on field accountCreated with a greater-or-equal bound of rangeMin and a less-than bound of rangeMax, each as a Mongo date expressed as the epoch milliseconds of the input 0 date (date2long); write it as JSON text into output 0 field query.
[ "$in.0: DateRange (delimited): rangeMin date \"yyyy-MM-dd HH:mm:ss\", rangeMax date \"yyyy-MM-dd HH:mm:ss\"", "$out.0: Customer (delimited): id long, fullName string, streetAddress string, city string, postalCode string, state string, country string, email string, phone string, accountCreated date \"yyyy-MM-dd\",...
[]
[]
//#CTL2 function integer transform() { variant queryJson = { "accountCreated" -> { "$gte" -> { "$date" -> date2long($in.0.rangeMin) }, "$lt" -> { "$date" -> date2long($in.0.rangeMax) } } }; $out.0.query = writeJson(queryJson); return ALL; }
15_Read_Write_MongoDB.grf
bf15
QUERY_CUSTOMERS_BY_DATE
MONGODB_READER
outputMapping
Map the Mongo document (input port 1 jsonObject) to output 0: id = customerId converted to long; fullName, streetAddress, city, postalCode, state, country, email, phone copied as text; accountCreated = the digits-only part of the stored accountCreated converted to long and then to a date; isActive = true when the store...
[ "$in.0: DateRange (delimited): rangeMin date \"yyyy-MM-dd HH:mm:ss\", rangeMax date \"yyyy-MM-dd HH:mm:ss\"", "$out.0: Customer (delimited): id long, fullName string, streetAddress string, city string, postalCode string, state string, country string, email string, phone string, accountCreated date \"yyyy-MM-dd\",...
[]
[]
//#CTL2 function integer transform() { $out.0.id = str2long($in.1.jsonObject["customerId"]); $out.0.fullName = $in.1.jsonObject["fullName"]; $out.0.streetAddress = $in.1.jsonObject["streetAddress"]; $out.0.city = $in.1.jsonObject["city"]; $out.0.postalCode = $in.1.jsonObject["postalCode"]; $out.0.state = $in.1.j...
15_Read_Write_MongoDB.grf
bf15
QUERY_CUSTOMERS_BY_NAME
MONGODB_READER
outputMapping
Map the Mongo document (input port 1 jsonObject) to output 0: id = customerId converted to long; fullName, streetAddress, city, postalCode, state, country, email, phone copied as text; accountCreated = the digits-only part of the stored accountCreated converted to long and then to a date; isActive = true when the store...
[ "$out.0: Customer (delimited): id long, fullName string, streetAddress string, city string, postalCode string, state string, country string, email string, phone string, accountCreated date \"yyyy-MM-dd\", isActive boolean" ]
[]
[]
//#CTL2 function integer transform() { $out.0.id = str2long($in.1.jsonObject["customerId"]); $out.0.fullName = $in.1.jsonObject["fullName"]; $out.0.streetAddress = $in.1.jsonObject["streetAddress"]; $out.0.city = $in.1.jsonObject["city"]; $out.0.postalCode = $in.1.jsonObject["postalCode"]; $out.0.state = $in.1.j...
16_Data_validation_Customers.grf
bf16
SPLIT_PHONES
REFORMAT
transform
Copy all fields from input port 0 to output port 0 by name, then split the phone field. Trim phone; if it is empty return without setting the phone fields. Otherwise split it on a comma; if at least one part exists set phone1 to the trimmed first part; if at least two parts exist set phone2 to the trimmed second part; ...
[ "$in.0: CustomersInput (delimited): id string, fullName string, streetAddress string, city string, postalCode string, state string, country string, email string, phone string, accountCreated string, isActive string", "$out.0: CustomersInputWithPhone (delimited): id string, fullName string, streetAddress string, c...
[]
[]
//#CTL2 function integer transform() { $out.0.* = $in.0.*; splitPhones(); return ALL; } function void splitPhones() { string phoneStr = trim($in.0.phone); if (isEmpty(phoneStr)) { return; } string[] phones = split(phoneStr, ","); if (length(phones) >= 1) { $out.0.phone1 = trim(phones[0]); } if (leng...
16_Data_validation_Customers.grf
bf16
VALIDATOR
VALIDATOR
errorMapping
For invalid records, copy all fields of validator error input 1 to output 1 by name. Return ALL.
[ "$in.0: CustomersInputWithPhone (delimited): id string, fullName string, streetAddress string, city string, postalCode string, state string, country string, email string, phone1 string, phone2 string, phoneAll string, accountCreated string, isActive string", "$out.0: Customer (delimited): id long, fullName string...
[]
[]
//#CTL2 function integer transform() { $out.1.* = $in.1.*; return ALL; }
16_Data_validation_Customers.grf
bf16
REFORMAT
REFORMAT
transform
Copy all fields from input port 0 to output port 0 by name. Set fieldName to the text form of the input validatedFieldNames list and fieldValue to the text form of the input validatedValues map. Return ALL.
[ "$in.0: (record defined by the component)", "$out.0: ValidationResult (delimited): recordNo long, validationMessage string, ruleName string, ruleType string, fieldName string, fieldValue string" ]
[]
[]
//#CTL2 function integer transform() { $out.0.* = $in.0.*; $out.0.fieldName = toString($in.0.validatedFieldNames); $out.0.fieldValue = toString($in.0.validatedValues); return ALL; }
16e01_Validate_customers.grf
bf16
SPLIT_PHONE
REFORMAT
transform
Copy all fields from input port 0 to output port 0 by name. If phone is not null, split it with the regular expression matching a comma or semicolon, and set phone1, phone2 and phone3 to the first, second and third parts, using a helper that returns null when the list is null, empty or the index is out of range. Return...
[ "$in.0: CustomersInput (delimited): id string, fullName string, streetAddress string, city string, postalCode string, state string, country string, email string, phone string, accountCreated string, isActive string", "$out.0: CustomersExt (delimited): id string, fullName string, streetAddress string, city string,...
[]
[]
//#CTL2 function integer transform() { $out.0.* = $in.0.*; if ($in.0.phone != null) { string[] phones = split($in.0.phone, "[,;]"); $out.0.phone1 = safeListGet(phones, 0); $out.0.phone2 = safeListGet(phones, 1); $out.0.phone3 = safeListGet(phones, 2); } return ALL; } function string safeListGet(string[...
16e01_Validate_customers.grf
bf16
VALIDATOR
VALIDATOR
errorMapping
For invalid records: copy all fields of validator error input 1 to output 1 by name, then set from the original customer on input 0: id converted from string to integer, fullName, streetAddress, city, postalCode, state, country, email unchanged, accountCreated parsed as a date with pattern yyyy-MM-dd, isActive true onl...
[ "$in.0: CustomersExt (delimited): id string, fullName string, streetAddress string, city string, postalCode string, state string, country string, email string, phone1 string, phone2 string, phone3 string, accountCreated string, isActive string", "$out.0: (record defined by the component)", "$out.1: ValidationRe...
[]
[]
//#CTL2 function integer transform() { $out.1.* = $in.1.*; $out.1.id = str2integer($in.0.id); $out.1.fullName = $in.0.fullName; $out.1.streetAddress = $in.0.streetAddress; $out.1.city = $in.0.city; $out.1.postalCode = $in.0.postalCode; $out.1.state = $in.0.state; $out.1.country = $in.0.country; $out.1.email =...
17_Profile_payments_data.grf
bf17
PROFILER_PROBE
PROFILER_PROBE
outputMapping
Statistics output (port 1): set inputRecordCount from input port 0 inputRecordCount, and copy all fields from input port 1 (the computed metric results) by name.
[ "$in.0: (record defined by the component)", "$out.0: (record defined by the component)", "$out.1: RunResults (delimited): inputRecordCount long, paymentId__null_cnt long, orderId__null_cnt long, customerId__null_cnt long, paymentType__null_cnt long, paymentType__freq_histogram map[long], paidAmount__min decimal...
[]
[]
//#CTL2 function integer transform() { $out.1.inputRecordCount = $in.0.inputRecordCount; $out.1.* = $in.1.*; return ALL; }
18_HL7_processing.grf
bf18
EXTRACT_PATIENT_DETAILS
REFORMAT
transform
From the hl7Message variant on input port 0, navigate HL7, BATCH first element, ORU_R01 first element, RESPONSE first element, PATIENT, PID. Cast to string: patientId = PID.2 field PID.2.1; lastName = PID.5 field PID.5.1; firstName = PID.5 field PID.5.2; addrCity = first PID.11 element field PID.11.3, addrState = PID.1...
[ "$in.0: (record defined by the component)", "$out.0: Patient (delimited): patientId string, firstName string, lastName string, addrCity string, addrState string, addrZip string" ]
[]
[]
//#CTL2 function integer transform() { $out.0.patientId = cast($in.0.hl7Message["HL7"]["BATCH"][0]["ORU_R01"][0]["RESPONSE"][0]["PATIENT"]["PID"]["PID.2"]["PID.2.1"], string); $out.0.lastName = cast($in.0.hl7Message["HL7"]["BATCH"][0]["ORU_R01"][0]["RESPONSE"][0]["PATIENT"]["PID"]["PID.5"]["PID.5.1"], string); $out...
20a_Read_EDI_orders_EDIFACT.grf
bf20
JOIN_ORDERS_AND_ADDRESSES
EXT_MERGE_JOIN
transform
Join output: messageReferenceNumber = UNH01_Message_reference_number, lineItemCode = LIN0301_Item_number, qty = QTY0102_Quantity, senderCode = UNB0201_Sender_identification_code, recipientCode = UNB0301_Recipient_identification_code from the order on input port 0; addressLine = NAD0301_Name_and_address_line, city = NAD...
[ "$in.0: Order (delimited): ediMessage long, UNH01_Message_reference_number string, QTY0102_Quantity decimal, LIN0301_Item_number string, UNB0201_Sender_identification_code string, UNB0301_Recipient_identification_code string", "$in.1: Address (delimited): NAD0301_Name_and_address_line string, NAD06_City_name stri...
[]
[]
//#CTL2 function integer transform() { $out.0.messageReferenceNumber = $in.0.UNH01_Message_reference_number; $out.0.lineItemCode = $in.0.LIN0301_Item_number; $out.0.qty = $in.0.QTY0102_Quantity; $out.0.addressLine = $in.1.NAD0301_Name_and_address_line; $out.0.city = $in.1.NAD06_City_name; $out.0.region = $in.1.N...
21_Java_types.grf
bf21
DATA_GENERATOR
DATA_GENERATOR
generate
Produce exactly one record on output 0 and return ALL. Set booleanField true; byteField to sha256 of the string aa; cbyteField to sha256 of the string bb; dateField to today; smallDecimalField to the decimal 1.24; largeDecimalField to the decimal 1234567890123456789012.123456789; integerField 5; longField 10; numberFie...
[ "$out.0: AllTypes (delimited): booleanField boolean, byteField byte, cbyteField cbyte, dateField date, smallDecimalField decimal(10,3), largeDecimalField decimal(32,10), integerField integer, longField long, numberField number, stringField string, variantField variant" ]
[]
[]
//#CTL2 function integer generate() { $out.0.booleanField = true; $out.0.byteField = sha256("aa"); $out.0.cbyteField = sha256("bb"); $out.0.dateField = today(); $out.0.smallDecimalField = 1.24d; $out.0.largeDecimalField = 1234567890123456789012.123456789d; $out.0.integerField = 5; $out.0.longField = 10; $out....
23_AzureBlobWrite.grf
bf23
RESTRUCTURE
REFORMAT
transform
Copy customerId from input port 0 to output 0. Build the output variant field order as a map with three keys: orderId set to the id value of the orders entry within the input order variant, items set to the items value of that orders entry, and addresses set to the addresses value of that entry. Return ALL.
[ "$in.0: Order (delimited): customerId long, order variant", "$out.0: (record defined by the component)" ]
[]
[]
//#CTL2 function integer transform() { $out.0.customerId = $in.0.customerId; $out.0.order = { "orderId" -> $in.0.order["orders"]["id"], "items" -> $in.0.order["orders"]["items"], "addresses" -> $in.0.order["orders"]["addresses"] }; // $out.0.order["order"] = remove($in.0.order, "orders"); // remove($out.0.or...
24_ParquetReadWrite.grf
bf24
GENERATE_RECORDS
DATA_GENERATOR
generate
On output 0 set paymentId and orderId to random longs between 1 and 999999999999; customerId random long between 1 and 999999; paymentType CASH when a random number is below 0.1 otherwise CARD; paidAmount random number times 99999; paymentDate random date between two years before today and today. Return ALL.
[ "$out.0: Payments (delimited): paymentId long, orderId long, customerId long, paymentType string, paidAmount decimal, paymentDate date" ]
[]
[]
//#CTL2 function integer generate() { $out.0.paymentId = randomLong(1,999999999999l); $out.0.orderId = randomLong(1,999999999999l); $out.0.customerId = randomLong(1,999999); $out.0.paymentType = random() < 0.1 ? "CASH" : "CARD"; $out.0.paidAmount = random() * 99999; $out.0.paymentDate = randomDate(today().dateAd...
generators__GenerateCustomers.grf
bfgenerators
DECODE_LIST
REFORMAT
transform
Copy stateName from input port 0 to output 0. Set output areaCodes (a list of strings) by splitting input areaCodes on the separator comma followed by a space. Always return all outputs.
[ "$in.0: AreaCode (delimited): stateName string, areaCodes string", "$out.0: AreaCodeList (delimited): stateName string, stateCode string, areaCodes list[string]" ]
[]
[]
//#CTL2 function integer transform() { $out.0.stateName = $in.0.stateName; $out.0.areaCodes = split($in.0.areaCodes, ", "); return ALL; }
generators__GenerateCustomers.grf
bfgenerators
ADD_STATE_CODE
LOOKUP_JOIN
transform
Top-level: declare an empty string list and assign it to dictionary entry allStateCodes, then clear it, so it starts empty each run. Transform: copy all fields from input port 0 to output 0; set stateCode from the field code of the looked-up record on input port 1 (state code lookup by stateName); append that code to d...
[ "$in.0: AreaCodeList (delimited): stateName string, stateCode string, areaCodes list[string]", "$out.0: AreaCodeList (delimited): stateName string, stateCode string, areaCodes list[string]" ]
[ "allStateCodes list = None" ]
[]
//#CTL2 string[] tmp; dictionary.allStateCodes = tmp; clear(dictionary.allStateCodes); function integer transform() { $out.0.* = $in.0.*; $out.0.stateCode = $in.1.code; push(dictionary.allStateCodes, $in.1.code); return ALL; } function void postExecute() { printLog(info, "All states: " + join(",", dictionary.a...
generators__GenerateCustomers.grf
bfgenerators
ADD_BASIC_DETAILS
REFORMAT
transform
Global OLDEST_ACCOUNT is the date from graph parameter OLDEST_ACCOUNT_DATE; a counter id starts at 0. For each input record on port 0 set output id to the counter then increment; randomOrder = random long; firstName, middleInitial, lastName, fullName copied from input; accountCreated = random date between OLDEST_ACCOUN...
[ "$in.0: (record defined by the component)", "$out.0: CustomerExt (delimited): id long, randomOrder long, firstName string, middleInitial string, lastName string, fullName string, streetAddress string, city string, postalCode string, state string, country string, email string, phone string, accountCreated date \"y...
[]
[ "PERCENT_INACTIVE_ACCOUNTS = 25", "OLDEST_ACCOUNT_DATE = 2010-01-01" ]
//#CTL2 date OLDEST_ACCOUNT = ${OLDEST_ACCOUNT_DATE}; integer id = 0; function integer transform() { $out.0.id = id++; $out.0.randomOrder = randomLong(); $out.0.firstName = $in.0.firstName; $out.0.middleInitial = $in.0.middleInitial; $out.0.lastName = $in.0.lastName; $out.0.fullName = $in.0.fullName; $out.0.acc...
generators__GenerateCustomers.grf
bfgenerators
ADD_ADDRESS
COMBINE
transform
Copy all fields of input port 0 to output 0, then set streetAddress, postalCode, city, state and country from input port 1 (same-named fields).
[ "$in.0: CustomerExt (delimited): id long, randomOrder long, firstName string, middleInitial string, lastName string, fullName string, streetAddress string, city string, postalCode string, state string, country string, email string, phone string, accountCreated date \"yyyy-MM-dd HH:mm:ss\", isActive boolean", "$in...
[]
[]
//#CTL2 function integer transform() { $out.0.* = $in.0.*; $out.0.streetAddress = $in.1.streetAddress; $out.0.postalCode = $in.1.postalCode; $out.0.city = $in.1.city; $out.0.state = $in.1.state; $out.0.country = $in.1.country; return ALL; }
generators__GenerateCustomers.grf
bfgenerators
DUPLICATE
NORMALIZER
normalize
Global counter id starts at graph parameter CUSTOMER_COUNT (duplicate ids start after normal ids). count(): with probability DUPLICATE_RECORDS_PERCENT/100 (random below that) return a random integer from 2 to 4, otherwise return 1. transform(i): copy all input fields to output; if i is 0 return OK leaving the record as...
[ "$in.0: CustomerExt (delimited): id long, randomOrder long, firstName string, middleInitial string, lastName string, fullName string, streetAddress string, city string, postalCode string, state string, country string, email string, phone string, accountCreated date \"yyyy-MM-dd HH:mm:ss\", isActive boolean", "$ou...
[]
[ "CUSTOMER_COUNT = 20000", "DUPLICATE_RECORDS_PERCENT = 3" ]
//#CTL2 integer id = ${CUSTOMER_COUNT}; // Duplicate ids start after normal ids. function integer count() { if (random() < ${DUPLICATE_RECORDS_PERCENT} / 100.0) { // Generate duplicate records for small fraction of customers. return randomInteger(2, 4); } else { // Single record only - the original. return 1...
generators__GenerateCustomers.grf
bfgenerators
GENERATE_EMAIL
REFORMAT
transform
Copy all fields from input 0 to output 0 and set email from a helper that generates an address for each record. Helper: DOMAINS = example.com, example.org, example.co.uk, example.gov; JOINER_CHARS = '.', '-', '', '_'. If random() is at least RANDOM_EMAIL_PERCENT/100: pick prefixType random 0-2 and a random joiner; type...
[ "$in.0: CustomerExt (delimited): id long, randomOrder long, firstName string, middleInitial string, lastName string, fullName string, streetAddress string, city string, postalCode string, state string, country string, email string, phone string, accountCreated date \"yyyy-MM-dd HH:mm:ss\", isActive boolean", "$ou...
[]
[ "RANDOM_EMAIL_PERCENT = 1", "EMAIL_NUMERIC_SUFFIX_PERCENT = 5" ]
//#CTL2 function integer transform() { $out.0.* = $in.0.*; // Each record get its own email address. This means duplicates have different emails. $out.0.email = generateEmailAddress(); return ALL; } string[] DOMAINS = ["example.com", "example.org", "example.co.uk", "example.gov"]; string[] JOINER_CHARS = [".", ...
generators__GenerateCustomers.grf
bfgenerators
GENERATE_PHONE
REFORMAT
transform
Imports ${TRANS_DIR}/Common.ctl (provides getRandomListItem). Copy all fields from input 0 to output 0. Draw x = random(): below 0.7 gives 1 phone number, below 0.9 gives 2, below 0.995 gives 3, otherwise return immediately leaving phone unset. Generate that many numbers and set phone to them joined with a comma. A num...
[ "$in.0: CustomerExt (delimited): id long, randomOrder long, firstName string, middleInitial string, lastName string, fullName string, streetAddress string, city string, postalCode string, state string, country string, email string, phone string, accountCreated date \"yyyy-MM-dd HH:mm:ss\", isActive boolean", "$ou...
[ "allStateCodes list = None" ]
[]
//#CTL2 import "${TRANS_DIR}/Common.ctl"; function integer transform() { $out.0.* = $in.0.*; // Number is mandatory here. Most people will have just one, but there are few who have 2 or 3. // Very small fraction of users will have no number - i.e. their data is incomplete. integer phoneNumberCount; number x = ra...
generators__GenerateCustomers.grf
bfgenerators
REFORMAT
REFORMAT
transform
Copy all fields from input 0 to output 0 unchanged; return all.
[ "$in.0: CustomerExt (delimited): id long, randomOrder long, firstName string, middleInitial string, lastName string, fullName string, streetAddress string, city string, postalCode string, state string, country string, email string, phone string, accountCreated date \"yyyy-MM-dd HH:mm:ss\", isActive boolean", "$ou...
[]
[]
//#CTL2 function integer transform() { $out.0.* = $in.0.*; return ALL; }
generators__GenerateOrders.grf
bfgenerators
GET_CODE_MIN_MAX
REFORMAT
transform
Copy all fields from input 0 to output 0 but set productName to its trimmed value. If dictionary productCodeMax is below input productCode, set it to productCode; if dictionary productCodeMin is above productCode, set it to productCode. Return all.
[ "$in.0: Product (delimited): productName string, productCode long, unitPrice decimal, supplierName string, profitMargin decimal", "$out.0: Product (delimited): productName string, productCode long, unitPrice decimal, supplierName string, profitMargin decimal" ]
[ "productCodeMin long = 999999999", "productCodeMax long = 0", "orderCount long = 0" ]
[]
//#CTL2 function integer transform() { $out.0.* = $in.0.*; $out.0.productName = trim($in.0.productName); // This is simpler than doing Aggregate and then using SetJobOutput to write the values to dictionary. if (dictionary.productCodeMax < $in.0.productCode) { dictionary.productCodeMax = $in.0.productCode; } ...
generators__GenerateOrders.grf
bfgenerators
GENERATE_ORDERS
NORMALIZER
normalize
Imports ${TRANS_DIR}/Common.ctl. Global long orderId starts at 0. count(): return getRandomIntGaussian(MIN_ORDERS_PER_CUSTOMER, MAX_ORDERS_PER_CUSTOMER) from graph parameters. transform(i): output 0 id = orderId then increment; customerId = input id; orderDatetime = random date between ORDER_MIN_DATE and ORDER_MAX_DATE...
[ "$in.0: (record defined by the component)", "$out.0: Order (delimited): id long, customerId long, orderDatetime date \"yyyy-MM-dd HH:mm:ss\"" ]
[ "productCodeMin long = 999999999", "productCodeMax long = 0", "orderCount long = 0" ]
[ "MIN_ORDERS_PER_CUSTOMER = 1", "MAX_ORDERS_PER_CUSTOMER = 8", "ORDER_MIN_DATE = 2017-01-01", "ORDER_MAX_DATE = 2017-03-31" ]
//#CTL2 import "${TRANS_DIR}/Common.ctl"; long orderId = 0; function integer count() { return getRandomIntGaussian(${MIN_ORDERS_PER_CUSTOMER}, ${MAX_ORDERS_PER_CUSTOMER}); } function integer transform(integer i) { $out.0.id = orderId++; $out.0.customerId = $in.0.id; //$out.0.orderDatetime = randomDate($in.0.acco...
generators__GenerateOrders.grf
bfgenerators
CONTACT_NAMES
SUBGRAPH
inputMapping
Set output 0 field CUSTOMER_COUNT (the subgraph parameter) to dictionary orderCount multiplied by 2, converted to string. Return all.
[ "$out.0: (record defined by the component)" ]
[ "productCodeMin long = 999999999", "productCodeMax long = 0", "orderCount long = 0" ]
[]
//#CTL2 function integer transform() { $out.0.CUSTOMER_COUNT = num2str(dictionary.orderCount * 2); return ALL; }
generators__GenerateOrders.grf
bfgenerators
ORDER_ADDRESSES
SUBGRAPH
inputMapping
Set output 0 field ADDRESS_COUNT to dictionary orderCount multiplied by 2, converted to string. Return all.
[ "$out.0: (record defined by the component)" ]
[ "productCodeMin long = 999999999", "productCodeMax long = 0", "orderCount long = 0" ]
[]
//#CTL2 function integer transform() { $out.0.ADDRESS_COUNT = num2str(dictionary.orderCount * 2); return ALL; }
generators__GenerateOrders.grf
bfgenerators
BUILD_ORDER_ADDRESS
COMBINE
transform
Global long counter i starts at 0. Output id = i then increment; street, zip, city, state, country from input port 0 (streetAddress, postalCode, city, state, country); name = fullName from input port 1.
[ "$in.0: (record defined by the component)", "$in.1: (record defined by the component)", "$out.0: AddressWithId (delimited): id long, type string, name string, street string, zip string, city string, state string, country string" ]
[]
[]
//#CTL2 long i = 0; function integer transform() { $out.0.id = i++; $out.0.street = $in.0.streetAddress; $out.0.zip = $in.0.postalCode; $out.0.city = $in.0.city; $out.0.state = $in.0.state; $out.0.country = $in.0.country; $out.0.name = $in.1.fullName; return ALL; }
generators__GenerateOrders.grf
bfgenerators
GENERATE_ADDRESSES1
NORMALIZER
normalize
ADDRESS_TYPES = shipping, billing. count(): draw random(); below 0.3 return 1 (shipping only), otherwise 2. transform(i): pick a random long address id between 0 and 2 times dictionary orderCount minus 1; look up that record in lookup table AddressByIdLkp (address with id layout); copy all its fields to output 0; set t...
[ "$in.0: Order (delimited): id long, customerId long, orderDatetime date \"yyyy-MM-dd HH:mm:ss\"", "$out.0: AddressWithId (delimited): id long, type string, name string, street string, zip string, city string, state string, country string" ]
[ "productCodeMin long = 999999999", "productCodeMax long = 0", "orderCount long = 0" ]
[]
//#CTL2 string[] ADDRESS_TYPES = ["shipping", "billing"]; function integer count() { // Decide how many addresses we want to have for the order. There are two options: // 1: shipping address only -> billing is the same as customer's address // 2: billing and shipping -> both billing and shipping addresses will ap...
generators__GenerateOrders.grf
bfgenerators
GENERATE_LINE_ITEMS
NORMALIZER
normalize
Imports ${TRANS_DIR}/Common.ctl. count(): getRandomIntGaussian(MIN_ITEMS_PER_ORDER, MAX_ITEMS_PER_ORDER). transform(i): choose a random product by repeatedly drawing a random long between dictionary productCodeMin and productCodeMax and looking it up in ProductByProductCodeLkp until a product is found (catalogue has ga...
[ "$in.0: Order (delimited): id long, customerId long, orderDatetime date \"yyyy-MM-dd HH:mm:ss\"", "$out.0: LineItem (delimited): orderId long, orderDatetime date \"yyyy-MM-dd HH:mm:ss\", productCode long, productName string, unitPrice decimal(10,2), units decimal(10,2), totalPrice decimal(10,2)" ]
[ "productCodeMin long = 999999999", "productCodeMax long = 0", "orderCount long = 0" ]
[ "MIN_ITEMS_PER_ORDER = 1", "MAX_ITEMS_PER_ORDER = 5" ]
//#CTL2 import "${TRANS_DIR}/Common.ctl"; function integer count() { return getRandomIntGaussian(${MIN_ITEMS_PER_ORDER}, ${MAX_ITEMS_PER_ORDER}); } function integer transform(integer i) { Product prod = getRandomProduct(); $out.0.orderId = $in.0.id; $out.0.orderDatetime = $in.0.orderDatetime; $out.0.productCode...
generators__GenerateOrders.grf
bfgenerators
TO_FIXLEN
REFORMAT
transform
Global long id starts at 0. Output 0: copy all fields of input 0 and set productName with diacritics removed and then non-ASCII characters removed. Output 1: copy all fields of input 0 (original productName) and set id to counter then increment. Return all.
[ "$in.0: LineItem (delimited): orderId long, orderDatetime date \"yyyy-MM-dd HH:mm:ss\", productCode long, productName string, unitPrice decimal(10,2), units decimal(10,2), totalPrice decimal(10,2)", "$out.0: LineItemFixLen (fixed): orderId long \"0000000000\", orderDatetime date \"yyyy-MM-dd HH:mm:ss\", productCo...
[]
[]
//#CTL2 long id = 0; function integer transform() { $out.0.* = $in.0.*; $out.0.productName = removeNonAscii(removeDiacritic($in.0.productName)); $out.1.* = $in.0.*; $out.1.id = id++; return ALL; }
generators__GeneratePayments.grf
bfgenerators
CALCULATE_PRICE
REFORMAT
transform
Copy all fields of input 0 to output 0 and set itemPrice = unitPrice times qty. Return all.
[ "$in.0: OrderLineItem (delimited): orderId long, customerId long, date date \"yyyy-MM-dd HH:mm:ss\", unitPrice decimal, qty decimal, itemPrice decimal", "$out.0: (record defined by the component)" ]
[]
[]
//#CTL2 function integer transform() { $out.0.* = $in.0.*; $out.0.itemPrice = $in.0.unitPrice * $in.0.qty; return ALL; }
generators__GeneratePayments.grf
bfgenerators
CREATE_INVALID_PAYMENTS1
REFORMAT
transform
If random() is above 0.05 skip the record. Otherwise set output 0 orderDate, totalAmount and customerId from the input (same-named); leave other fields empty. Return all.
[ "$in.0: OrderTotals (delimited): orderId long, customerId long, orderDate date \"yyyy-MM-dd HH:mm:ss\", totalAmount decimal", "$out.0: OrderPaymentExt (delimited): paymentId string, orderId string, customerId long, paymentType string, paidAmount decimal, paymentDate string, paymentDateValid date \"yyyy-MM-dd HH:m...
[]
[]
//#CTL2 function integer transform() { // We create invalid payments - payments with missing data - with some small probability if (random() > 0.05) { return SKIP; } $out.0.orderDate = $in.0.orderDate; $out.0.totalAmount = $in.0.totalAmount; $out.0.customerId = $in.0.customerId; return ALL; }
generators__GeneratePayments.grf
bfgenerators
CREATE_REGULAR_PAYMENTS
REFORMAT
transform
Output 0: orderId = input orderId converted to string; orderDate, totalAmount, customerId copied from input. Return all.
[ "$in.0: OrderTotals (delimited): orderId long, customerId long, orderDate date \"yyyy-MM-dd HH:mm:ss\", totalAmount decimal", "$out.0: OrderPaymentExt (delimited): paymentId string, orderId string, customerId long, paymentType string, paidAmount decimal, paymentDate string, paymentDateValid date \"yyyy-MM-dd HH:m...
[]
[]
//#CTL2 function integer transform() { $out.0.orderId = num2str($in.0.orderId); $out.0.orderDate = $in.0.orderDate; $out.0.totalAmount = $in.0.totalAmount; $out.0.customerId = $in.0.customerId; return ALL; }
generators__GeneratePayments.grf
bfgenerators
RANDOMIZE_PAYMENTS
REFORMAT
transform
Constants CARD_TYPE_THRESHOLD 0.5 and CASH_TYPE_THRESHOLD 0.9; global long lastPaymentId starts at a random long 0 to 10000. Copy all fields from input 0 to output 0. Add random integer 1-50 to lastPaymentId and set paymentId to it as string. Draw type = random(). Below 0.5: paymentType CARD, paymentDateValid = orderDa...
[ "$in.0: OrderPaymentExt (delimited): paymentId string, orderId string, customerId long, paymentType string, paidAmount decimal, paymentDate string, paymentDateValid date \"yyyy-MM-dd HH:mm:ss\", paidExactly boolean, yearMonthKey string, orderDate date, totalAmount decimal", "$out.0: (record defined by the compone...
[]
[]
//#CTL2 // Generate random data in the payment - type, time stamp etc. number CARD_TYPE_THRESHOLD = 0.5; number CASH_TYPE_THRESHOLD = 0.9; // Start somewhere long lastPaymentId = randomLong(0, 10000); function integer transform() { $out.0.* = $in.0.*; // Payments jump a bit, so that not all numbers are generated....
generators__GeneratePayments.grf
bfgenerators
INTRODUCE_ERRORS
REFORMAT
transform
LETTERS = a-z and A-Z; MAX_CHANGES = 3. Copy all fields of input 0 to output 0. If paymentType is WIRE (upper case) and random() below 0.1, paidAmount = 0.1 times totalAmount plus random() times totalAmount; else paidAmount = totalAmount. With probability 0.05 set paymentDate to the input paymentDate with the first cut...
[ "$in.0: (record defined by the component)", "$out.0: (record defined by the component)" ]
[]
[]
//#CTL2 string LETTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; integer MAX_CHANGES = 3; function integer transform() { $out.0.* = $in.0.*; // For small number of orders the amount paid does not match. We only do this for WIRE transfers since we assume that // when paying with CASH the teller will...
intro__CreditCardFraudDetection.grf
bfintro__CreditCardFraudDetection
FORMAT_FIELDS
REFORMAT
transform
Keep an integer counter starting at 1 across records. Output 0: currency and rate copied from input 0, id = counter value, then increment the counter. Return 0.
[ "$in.0: rates (delimited): currency string, rate decimal(10,5)", "$out.0: rates_with_id (delimited): currency string, rate decimal(10,5), id integer" ]
[]
[]
//#CTL2 integer counter = 1; function integer transform() { $out.0.currency = $in.0.currency; $out.0.rate = $in.0.rate; $out.0.id = counter++; return 0; }
intro__CreditCardFraudDetection.grf
bfintro__CreditCardFraudDetection
MATCH_TRANSACTIONS_WITH_CUSTOMER
EXT_MERGE_JOIN
transform
Join output: transaction_id = TransactionId, amount = Amount, currency = CurrencyId from the transaction (port 0); customer_id = Id, customer_last_name = LastName, customer_first_name = FirstName from the customer (port 1, may be empty for left outer join). Return 0.
[ "$in.0: Transactions (fixed): TransactionId integer, CustomerId integer, Amount decimal, CurrencyId integer", "$in.1: Customers (delimited): Id integer, LastName string, FirstName string", "$out.0: transaction_joined (delimited): customer_id integer, customer_last_name string, customer_first_name string, transa...
[]
[]
//#CTL2 function integer transform() { $out.0.transaction_id = $in.0.TransactionId; $out.0.customer_id = $in.1.Id; $out.0.amount = $in.0.Amount; $out.0.currency = $in.0.CurrencyId; $out.0.customer_last_name = $in.1.LastName; $out.0.customer_first_name = $in.1.FirstName; return 0; }
intro__CreditCardFraudDetection.grf
bfintro__CreditCardFraudDetection
CONVERT_CURRENCY
EXT_HASH_JOIN
transform
Join output: copy customer_id, customer_last_name, customer_first_name, transaction_id from input port 0 (transaction). amount = amount from port 0 divided by rate from port 1 (rates) when a rate exists, otherwise the unchanged port 0 amount (null-safe fallback). currency = currency code from port 1 if present, otherwi...
[ "$in.0: transaction_joined (delimited): customer_id integer, customer_last_name string, customer_first_name string, transaction_id integer, amount decimal(12,2), currency integer", "$in.1: rates_with_id (delimited): currency string, rate decimal(10,5), id integer", "$out.0: transaction_with_currency (delimited)...
[]
[]
//#CTL2 function integer transform() { $out.0.customer_id = $in.0.customer_id; $out.0.customer_last_name = $in.0.customer_last_name; $out.0.customer_first_name = $in.0.customer_first_name; $out.0.transaction_id = $in.0.transaction_id; $out.0.amount = $in.0.amount / $in.1.rate : $in.0.amount; $out.0.currency = n...
intro__CreditCardFraudDetection.grf
bfintro__CreditCardFraudDetection
SPLIT_RECORD_BY_LOGIC
PARTITION
partitionSource
Return output port 0 when customer_id is null, port 1 when currency is a number (isNumber, meaning no currency code was found), otherwise port 2.
[ "$in.0: transaction_with_currency (delimited): customer_id integer, customer_last_name string, customer_first_name string, transaction_id integer, amount decimal(12,2), currency string", "$out.0: transaction_with_currency (delimited): customer_id integer, customer_last_name string, customer_first_name string, tra...
[]
[]
//#CTL2 function integer getOutputPort() { if (isnull($customer_id)) return 0; if (isNumber($currency)) return 1; return 2; }
intro__CreditCardFraudDetection.grf
bfintro__CreditCardFraudDetection
FORMAT_FIELDS_FOR_OUTPUT
REFORMAT
transform
Copy all fields of input port 0 to output port 0 by field name. Return 0.
[ "$in.0: transaction_with_currency (delimited): customer_id integer, customer_last_name string, customer_first_name string, transaction_id integer, amount decimal(12,2), currency string", "$out.0: (record defined by the component)" ]
[]
[]
//#CTL2 function integer transform() { $out.0.* = $in.0.*; return 0; }
intro__CreditCardFraudDetection.grf
bfintro__CreditCardFraudDetection
AMOUNT_400K
EXT_FILTER
filterExpression
Return true when amount of input port 0 is greater than 400000.
[ "$in.0: transaction_with_currency (delimited): customer_id integer, customer_last_name string, customer_first_name string, transaction_id integer, amount decimal(12,2), currency string", "$out.0: transaction_with_currency (delimited): customer_id integer, customer_last_name string, customer_first_name string, tra...
[]
[]
//#CTL2 $0.amount > 400000
intro__FiltersLookups.grf
bfintro__FiltersLookups
EXT_FILTER0
EXT_FILTER
filterExpression
Return true when ShippedDate of input port 0 is not null and RequiredDate is earlier than ShippedDate.
[ "$in.0: orders (delimited): OrderID integer \"#\", CustomerID string, EmployeeID integer, OrderDate date \"dd.MM.yyyy\", RequiredDate date \"dd.MM.yyyy\", ShippedDate date \"dd.MM.yyyy\", ShipVia integer \"#\", Freight integer, ShipName string, ShipAddress string, ShipCity string, ShipRegion string, ShipPostalCode ...
[]
[]
//#CTL2 $0.ShippedDate != null && $0.RequiredDate < $0.ShippedDate
intro__FiltersLookups.grf
bfintro__FiltersLookups
REFORMAT0
REFORMAT
transform
Declare a customers-typed variable matched_record and fill it by looking up in the lookup table customers_look with key OrderID from input port 0 (get). Output 0: orderid = OrderID, required_date = RequiredDate, shipped_date = ShippedDate from input 0; customer_firstname = firstname, customer_lastname = lastname, custo...
[ "$in.0: orders (delimited): OrderID integer \"#\", CustomerID string, EmployeeID integer, OrderDate date \"dd.MM.yyyy\", RequiredDate date \"dd.MM.yyyy\", ShippedDate date \"dd.MM.yyyy\", ShipVia integer \"#\", Freight integer, ShipName string, ShipAddress string, ShipCity string, ShipRegion string, ShipPostalCode ...
[]
[]
//#CTL2 customers matched_record; function integer transform() { matched_record = lookup(customers_look).get($in.0.OrderID); $out.0.orderid = $in.0.OrderID; $out.0.required_date = $in.0.RequiredDate; $out.0.shipped_date = $in.0.ShippedDate; $out.0.customer_firstname = matched_record.firstname; $out.0.cust...
intro__JoiningAggregating.grf
bfintro__JoiningAggregating
INTERSECT_DATA
DATA_INTERSECTION
transform
Output 0 (matched customers and orders, used when a key is in both inputs): customerid, firstname, lastname, country, email, phone, income taken from input port 0 (customer); orderid, orderdate, totalamount, productid taken from input port 1 (order). Return ALL.
[ "$in.0: (record defined by the component)", "$in.1: orders_amounts (delimited): orderid integer, orderdate date \"yyyy-MM-dd\", customerid integer, netamount decimal(14,2), tax decimal(14,2), totalamount decimal(14,2), productid integer", "$out.0: (record defined by the component)", "$out.1: customer_order (d...
[]
[]
//#CTL2 function integer transform() { $out.0.customerid = $in.0.customerid; $out.0.firstname = $in.0.firstname; $out.0.lastname = $in.0.lastname; $out.0.country = $in.0.country; $out.0.email = $in.0.email; $out.0.phone = $in.0.phone; $out.0.income = $in.0.income; $out.0.orderid = $in.1.orderid; $out.0.orderd...
intro__JoiningAggregating.grf
bfintro__JoiningAggregating
PARTITION0
PARTITION
partitionSource
Return output port 0 when the region field of the incoming record is 1, otherwise return output port 1.
[ "$in.0: (record defined by the component)", "$out.0: (record defined by the component)", "$out.1: (record defined by the component)" ]
[]
[]
//#CTL2 function integer getOutputPort() { if ( $in.0.region == 1 ){ return 0; } else { return 1; } }
intro__JoiningAggregating.grf
bfintro__JoiningAggregating
EXT_HASH_JOIN0
EXT_HASH_JOIN
transform
Join output: prod_id, title, actor, price, special, common_prod_id from the product (input port 0); categoryname from the category (input port 1). Return ALL.
[ "$in.0: products (delimited): prod_id integer, category integer, title string, actor string, price decimal(14,2), special integer, common_prod_id integer", "$in.1: categories (delimited): category integer, categoryname string", "$out.0: products_category (delimited): prod_id integer, categoryname string, title ...
[]
[]
//#CTL2 function integer transform() { $out.0.prod_id = $in.0.prod_id; $out.0.title = $in.0.title; $out.0.actor = $in.0.actor; $out.0.price = $in.0.price; $out.0.special = $in.0.special; $out.0.common_prod_id = $in.0.common_prod_id; $out.0.categoryname = $in.1.categoryname; return ALL; }
intro__JoiningAggregating.grf
bfintro__JoiningAggregating
ENHANCE_BY_PRODUC_STATS
EXT_HASH_JOIN
transform
Left outer join output: prod_id, categoryname, title, actor, price, special, common_prod_id from the product (input port 0); soldcopies from input port 1 (statistics) replaced by 0 when there is no matching statistic. Return ALL.
[ "$in.0: products_category (delimited): prod_id integer, categoryname string, title string, actor string, price decimal(14,2), special integer, common_prod_id integer, soldcopies integer", "$in.1: products_category (delimited): prod_id integer, categoryname string, title string, actor string, price decimal(14,2), ...
[]
[]
//#CTL2 function integer transform() { $out.0.prod_id = $in.0.prod_id; $out.0.categoryname = $in.0.categoryname; $out.0.title = $in.0.title; $out.0.actor = $in.0.actor; $out.0.price = $in.0.price; $out.0.special = $in.0.special; $out.0.common_prod_id = $in.0.common_prod_id; $out.0.soldcopies = nvl($in.1.soldco...
intro__MetadataWriting.grf
bfintro__MetadataWriting
EXTRACT_FILE_NAME
REFORMAT
transform
Define a helper that takes a full path: find the last slash; if there is none return the path unchanged; otherwise take the substring after the last slash to the end and replace every dot with an underscore (regex replace of backslash-escaped dot by underscore). Output 0: source_name = helper applied to input source_na...
[ "$in.0: metadataDescription (delimited): source_name string, fieldName string, fieldType string, fieldLabel string, fieldDelimiter string", "$out.0: (record defined by the component)" ]
[]
[]
//#CTL2 function string getFileName(string fullName) { integer slash = lastIndexOf(fullName, "/"); if (slash < 0) { return fullName; } return replace(substring(fullName, slash + 1, length(fullName) - slash - 1),"\\.","_"); } function integer transform() { $out.0.source_name = getFileName($in.0.source_name); $...
intro__MetadataWriting.grf
bfintro__MetadataWriting
METADATA_WRITER
SUBGRAPH
__INPUT_MAPPING
Output 0: name = fieldName, type = fieldType, label = fieldLabel, delimiter = fieldDelimiter, recordName = source_name, all from input port 0. Return ALL.
[ "$in.0: (record defined by the component)" ]
[]
[]
//#CTL2 function integer transform() { $out.0.name = $in.0.fieldName; $out.0.type = $in.0.fieldType; $out.0.label = $in.0.fieldLabel; $out.0.delimiter = $in.0.fieldDelimiter; $out.0.recordName = $in.0.source_name; return ALL; }
intro__MoviesAndActors.grf
bfintro__MoviesAndActors
EXT_HASH_JOIN0
EXT_HASH_JOIN
transform
Join output: actor_id from input port 0 (actor); movie_id, release_year, title, description, category from input port 1 (movie). Return ALL.
[ "$in.0: actor (delimited): actor_id integer, first_name string, last_name string, movie_id integer", "$in.1: movie (delimited): movie_id integer, title string, description string, release_year integer, language string, length integer, rating string, category string", "$out.0: movie_short (delimited): movie_id i...
[]
[]
//#CTL2 function integer transform() { $out.0.actor_id = $in.0.actor_id; $out.0.movie_id = $in.1.movie_id; $out.0.release_year = $in.1.release_year; $out.0.title = $in.1.title; $out.0.description = $in.1.description; $out.0.category = $in.1.category; return ALL; }
intro__MoviesAndActors.grf
bfintro__MoviesAndActors
EXT_HASH_JOIN
EXT_HASH_JOIN
transform
Left outer join output: movie_id, title, description, release_year, category from input port 0; actor = first_name from input port 1, a single space, then last_name from input port 1. Return ALL.
[ "$in.0: movie_short (delimited): movie_id integer, title string, description string, release_year integer, category string, actor_id integer", "$in.1: actor (delimited): actor_id integer, first_name string, last_name string, movie_id integer", "$out.0: movie_short_names (delimited): movie_id integer, title stri...
[]
[]
//#CTL2 function integer transform() { $out.0.movie_id = $in.0.movie_id; $out.0.title = $in.0.title; $out.0.description = $in.0.description; $out.0.release_year = $in.0.release_year; $out.0.category = $in.0.category; $out.0.actor = $in.1.first_name + " " + $in.1.last_name; return ALL; }
intro__OrdersLookup.grf
bfintro__OrdersLookup
EXTRACT_LATE_ORDERS
EXT_FILTER
filterExpression
Accept the record when ShippedDate is not null and RequiredDate is earlier than ShippedDate; otherwise reject.
[ "$in.0: orders (delimited): OrderID integer \"#\", CustomerID string, EmployeeID integer, OrderDate date \"dd.MM.yyyy\", RequiredDate date \"dd.MM.yyyy\", ShippedDate date \"dd.MM.yyyy\", ShipVia integer \"#\", Freight integer, ShipName string, ShipAddress string, ShipCity string, ShipRegion string, ShipPostalCode ...
[]
[]
//#CTL2 $in.0.ShippedDate != null && $0.RequiredDate < $0.ShippedDate
intro__OrdersLookup.grf
bfintro__OrdersLookup
GET_CUSTOMER_DETAILS
REFORMAT
transform
Keep a record variable of the customer type. For each order, look up the customers_look lookup table with the OrderID value of input port 0 as key and store the matched record. Output 0: orderid = OrderID, required_date = RequiredDate, shipped_date = ShippedDate; customer_firstname = firstname, customer_lastname = last...
[ "$in.0: orders (delimited): OrderID integer \"#\", CustomerID string, EmployeeID integer, OrderDate date \"dd.MM.yyyy\", RequiredDate date \"dd.MM.yyyy\", ShippedDate date \"dd.MM.yyyy\", ShipVia integer \"#\", Freight integer, ShipName string, ShipAddress string, ShipCity string, ShipRegion string, ShipPostalCode ...
[]
[]
//#CTL2 customers matched_record; function integer transform() { matched_record = lookup(customers_look).get($OrderID); $out.0.orderid = $in.0.OrderID; $out.0.required_date = $in.0.RequiredDate; $out.0.shipped_date = $in.0.ShippedDate; $out.0.customer_firstname = matched_record.firstname; $out.0.customer_...
intro__ParsingTextData.grf
bfintro__ParsingTextData
COMPLEX_DATA_READER0
COMPLEX_DATA_READER
transformCode
State machine with three states: 0 person, 1 spouse, 2 children. Initial state 0; final state returns STOP. Counters counter0, counter1, counter2 count records of each kind; counter0 is the person counter. Next state after person is spouse (1), after spouse is children (2), after children back to person (0). In state 0...
[ "$out.0: master (delimited): id integer, last_name string, first_name string", "$out.1: person (delimited): id integer, relationship string, name string", "$out.2: person (delimited): id integer, relationship string, name string" ]
[]
[]
//#CTL2:COMPILE long counter0 = 0; long counter1 = 0; long counter2 = 0; function integer initialState() { return 0; } function integer finalState(integer lastState) { return STOP; } function integer nextState_0() { counter0++; return 1; } function integer nextOutput_0_0() { $out.0.id = long2integer(counter0); ...
intro__ParsingTextData.grf
bfintro__ParsingTextData
NORMALIZER0
NORMALIZER
normalize
Keep module variables: a list of child strings and an id. count: store id from input 0; if name is not null split name on comma into the list; return the list length. transform(idx): output 0 id = stored id, name = list element at idx; return OK. clean: clear the list.
[ "$in.0: person (delimited): id integer, relationship string, name string", "$out.0: person (delimited): id integer, relationship string, name string" ]
[]
[]
//#CTL2 // This transformation defines the way in which a single input record is normalized // into multiple output records. string[] children; integer id; // This function is called for all input records. // It parses each single input record and returns the number of records // that should be created from such input ...
intro__ParsingTextData.grf
bfintro__ParsingTextData
COMPLEX_DATA_READER1
COMPLEX_DATA_READER
transformCode
Same record handling as the ordered reader but the state is chosen by the selector and every next-state returns ALL (no fixed order). Counters count each kind; counter0 counts persons. Person records (state 0) go to output 0 with id = counter0 as integer, last_name and first_name from input 0. Spouse records (state 1) ...
[ "$out.0: master (delimited): id integer, last_name string, first_name string", "$out.1: person (delimited): id integer, relationship string, name string", "$out.2: person (delimited): id integer, relationship string, name string" ]
[]
[]
//#CTL2:COMPILE long counter0 = 0; long counter1 = 0; long counter2 = 0; function integer initialState() { return 0; } function integer finalState(integer lastState) { return STOP; } function integer nextState_0() { counter0++; return ALL; } function integer nextOutput_0_0() { $out.0.id = long2integer(counter0)...
intro__ParsingTextData.grf
bfintro__ParsingTextData
NORMALIZER1
NORMALIZER
normalize
Keep module variables: a list of child strings and an id. count: store id from input 0; if name is not null split name on comma into the list; return the list length. transform(idx): output 0 id = stored id, name = list element at idx; return OK. clean: clear the list.
[ "$in.0: person (delimited): id integer, relationship string, name string", "$out.0: person (delimited): id integer, relationship string, name string" ]
[]
[]
//#CTL2 // This transformation defines the way in which a single input record is normalized // into multiple output records. string[] children; integer id; // This function is called for all input records. // It parses each single input record and returns the number of records // that should be created from such input ...
intro__ReadingComplexData.grf
bfintro__ReadingComplexData
COMPLEX_DATA_READER0
COMPLEX_DATA_READER
transformCode
State machine with states 0 Station, 1 Batch, 2 Shipment, 3 Charge, 4 to-station and 5 to-batch transitions, initial state 0, final state stops. Keep counters counter0 to counter5 (long, global), one incremented in the next-state function of each state. State 0 (station): increment counter0 and reset counter1 to 0; if ...
[ "$out.0: out_batch (delimited): stationCode string, batchId string, shipmentCount integer, totalValue decimal, currencyCode string, aggregateValue decimal", "$out.1: out_shipment (delimited): stationCode string, batchId string, AWB string, origin string, destination string, customer string, baseValue decimal, cur...
[]
[]
//#CTL2:COMPILE long counter0 = 0; long counter1 = 0; long counter2 = 0; long counter3 = 0; long counter4 = 0; long counter5 = 0; function integer initialState() { return 0; } function integer finalState(integer lastState) { return STOP; } function integer nextState_0() { counter0++; counter1 = 0; if ($in.0.bat...
intro__ReadingComplexData.grf
bfintro__ReadingComplexData
EXT_HASH_JOIN0
EXT_HASH_JOIN
transform
Left outer join: input 0 is the batch record, input 1 the shipment totals, input 2 the charge totals. Output 0 copies stationCode, batchId, shipmentCount, totalValue and currencyCode from input 0. aggregateValue is the shipment total (input 1 aggregateValue) plus the charge total (input 2 aggregateValue), each treated ...
[ "$in.0: out_batch (delimited): stationCode string, batchId string, shipmentCount integer, totalValue decimal, currencyCode string, aggregateValue decimal", "$in.1: x_shipments (delimited): stationCode string, batchId string, aggregateValue decimal", "$in.2: x_charges (delimited): stationCode string, batchId str...
[]
[]
//#CTL2 function integer transform() { $out.0.stationCode = $in.0.stationCode; $out.0.batchId = $in.0.batchId; $out.0.shipmentCount = $in.0.shipmentCount; $out.0.totalValue = $in.0.totalValue; $out.0.currencyCode = $in.0.currencyCode; $out.0.aggregateValue = ($in.1.aggregateValue != null ? $in.1.aggregateValue :...
intro__ReadingComplexData.grf
bfintro__ReadingComplexData
EXT_FILTER0
EXT_FILTER
filterExpression
Accept the record when totalValue equals aggregateValue (input 0); rejected records are not used.
[ "$in.0: out_batch (delimited): stationCode string, batchId string, shipmentCount integer, totalValue decimal, currencyCode string, aggregateValue decimal", "$out.0: out_batch (delimited): stationCode string, batchId string, shipmentCount integer, totalValue decimal, currencyCode string, aggregateValue decimal" ]
[]
[]
//#CTL2 $0.totalValue == $0.aggregateValue
intro__SalesforceMigration.grf
bfintro__SalesforceMigration
SALESFORCE_BULK_WRITE_ACCOUNTS
SALESFORCE_BULK_WRITER
inputMapping
Output 0 (Salesforce Account): Name = name from input 0; BillingCountry = country from input 0; Website = the constant string CloverDX. Return ALL.
[ "$in.0: import_accounts (delimited): id integer, name string, country string", "$out.0: (record defined by the component)", "$out.1: (record defined by the component)" ]
[]
[]
//#CTL2 function integer transform() { $out.0.Name = $in.0.name; $out.0.BillingCountry = $in.0.country; $out.0.Website = "CloverDX"; return ALL; }
intro__SalesforceMigration.grf
bfintro__SalesforceMigration
ENRICH_ATTACHMENTS_WITH_ACCOUNT_OBJECT_ID
EXT_HASH_JOIN
transform
Left outer join of attachments (input 0) with written accounts (input 1). Output 0: id = id from input 0; file_name = the graph parameter DATAIN_DIR followed by /salesforce/ followed by file_name from input 0; attachment_name from input 0; account_name = name from input 1; account_sf_id = ObjectId from input 1. Return ...
[ "$in.0: attachments_csv (delimited): id integer, file_name string, attachment_name string, account_id integer", "$in.1: (record defined by the component)", "$out.0: attachment (delimited): id integer, file_name string, attachment_name string, account_name string, account_sf_id string" ]
[]
[]
//#CTL2 function integer transform() { $out.0.id = $in.0.id; $out.0.file_name = "${DATAIN_DIR}/salesforce/" + $in.0.file_name; $out.0.attachment_name = $in.0.attachment_name; $out.0.account_name = $in.1.name; $out.0.account_sf_id = $in.1.ObjectId; return ALL; }
intro__SalesforceMigration.grf
bfintro__SalesforceMigration
ENRICH_CONTACTS_WITH_ACCOUNT_OBJECT_ID
EXT_HASH_JOIN
transform
Left outer join of contacts (input 0) with written accounts (input 1). Output 0: copy all fields of input 0 by name, then account_sf_id = ObjectId from input 1 and account_name = name from input 1. Return ALL.
[ "$in.0: import_contacts (delimited): id integer, name string, email string, phone string, account_id integer", "$in.1: (record defined by the component)", "$out.0: contacts_to_insert (delimited): id integer, name string, email string, phone string, account_sf_id string, account_name string" ]
[]
[]
//#CTL2 function integer transform() { $out.0.* = $in.0.*; $out.0.account_sf_id = $in.1.ObjectId; $out.0.account_name = $in.1.name; return ALL; }
intro__SalesforceMigration.grf
bfintro__SalesforceMigration
SALESFORCE_BULK_WRITE_CONTACTS
SALESFORCE_BULK_WRITER
inputMapping
Output 0 (Salesforce Contact): LastName = name, Email = email, Phone = phone, AccountId = account_sf_id, all from input 0; Department = the constant string CloverDX. Return ALL.
[ "$in.0: contacts_to_insert (delimited): id integer, name string, email string, phone string, account_sf_id string, account_name string", "$out.0: (record defined by the component)", "$out.1: (record defined by the component)" ]
[]
[]
//#CTL2 function integer transform() { $out.0.LastName = $in.0.name; $out.0.Email = $in.0.email; $out.0.Phone = $in.0.phone; $out.0.AccountId = $in.0.account_sf_id; $out.0.Department = "CloverDX"; return ALL; }
intro__SalesforceMigration.grf
bfintro__SalesforceMigration
SALESFORCE_WRITE_ATTACHMENTS
SALESFORCE_WRITER
inputMapping
Output 0 (Salesforce Attachment): Body_FileURL = file_name, Name = attachment_name, ParentId = account_sf_id, all from input 0. Return ALL.
[ "$in.0: attachment (delimited): id integer, file_name string, attachment_name string, account_name string, account_sf_id string", "$out.0: (record defined by the component)", "$out.1: (record defined by the component)" ]
[]
[]
//#CTL2 function integer transform() { $out.0.Body_FileURL = $in.0.file_name; $out.0.Name = $in.0.attachment_name; $out.0.ParentId = $in.0.account_sf_id; return ALL; }
intro__SalesforceMigration.grf
bfintro__SalesforceMigration
SALESFORCE_READ_ATTACHMENTS
SALESFORCE_READER
outputMapping
Output 0: Name = Name and Body = Body from input 0 (the queried Salesforce attachment). Return ALL.
[ "$out.0: attachments_download (delimited): Name string, Body byte" ]
[]
[]
//#CTL2 function integer transform() { $out.0.Name = $in.0.Name; $out.0.Body = $in.0.Body; return ALL; }
intro__SalesforceRead.grf
bfintro__SalesforceRead
SALESFORCE_BULK_READ_OPPORTUNITIES
SALESFORCE_BULK_READER
outputMapping
Output 0: Name, Amount and AccountId copied from the same-named fields of input 0. Return ALL.
[ "$out.0: Opportunity (delimited): Name string, Amount decimal(18,2), AccountId string" ]
[]
[]
//#CTL2 function integer transform() { $out.0.Name = $in.0.Name; $out.0.Amount = $in.0.Amount; $out.0.AccountId = $in.0.AccountId; return ALL; }
intro__SalesforceRead.grf
bfintro__SalesforceRead
ENRICH_OPPORTUNITIES_WITH_ACCOUNTS
EXT_HASH_JOIN
transform
Inner join of opportunities (input 0) with accounts (input 1) on opportunity AccountId = account Id. Output 0: AccountID = Id from input 1; AccountName = Name from input 1; OpportunityName = Name from input 0; Amount = Amount from input 0. Return ALL.
[ "$in.0: Opportunity (delimited): Name string, Amount decimal(18,2), AccountId string", "$in.1: Account (delimited): Name string, Id string", "$out.0: AccountWithOpportunity (delimited): AccountID string, AccountName string, OpportunityName string, Amount decimal(18,2)" ]
[]
[]
//#CTL2 function integer transform() { $out.0.AccountID = $in.1.Id; $out.0.AccountName = $in.1.Name; $out.0.OpportunityName = $in.0.Name; $out.0.Amount = $in.0.Amount; return ALL; }
intro__SalesforceRead.grf
bfintro__SalesforceRead
SALESFORCE_COMPLEX_SOQL_VIA_SOAP
SALESFORCE_READER
outputMapping
Output 0: Name = Account__Name from input 0 (the account name of the grouped result) and WonAmount = sum__Amount from input 0. Return ALL.
[ "$out.0: AccountStats (delimited): Name string, WonAmount decimal(12,2)" ]
[]
[]
//#CTL2 function integer transform() { $out.0.Name = $in.0.Account__Name; $out.0.WonAmount = $in.0.sum__Amount; return ALL; }
intro__SubgraphsSimplifyingGraph.grf
bfintro__SubgraphsSimplifyingGraph
MATCH_TRANSACTIONS_WITH_CUSTOMER
EXT_MERGE_JOIN
transform
Join output: transaction_id = TransactionId, amount = Amount and currency = CurrencyId from the transaction (input port 0); customer_id = Id, customer_last_name = LastName and customer_first_name = FirstName from the customer (input port 1, may be empty for transactions without customer). Always return 0.
[ "$in.0: Transactions (fixed): TransactionId integer, CustomerId integer, Amount decimal, CurrencyId integer", "$in.1: Customers (delimited): Id integer, LastName string, FirstName string", "$out.0: transaction_joined (delimited): customer_id integer, customer_last_name string, customer_first_name string, transa...
[]
[]
//#CTL2 function integer transform() { $out.0.transaction_id = $in.0.TransactionId; $out.0.customer_id = $in.1.Id; $out.0.amount = $in.0.Amount; $out.0.currency = $in.0.CurrencyId; $out.0.customer_last_name = $in.1.LastName; $out.0.customer_first_name = $in.1.FirstName; return 0; }
intro__Twitter.grf
bfintro__Twitter
REFORMAT
REFORMAT
transform
Output port 0: text = tweet_text from input port 0. Every record is passed on (return ALL).
[ "$in.0: (record defined by the component)", "$out.0: Texts (delimited): text string" ]
[]
[]
//#CTL2 function integer transform() { $out.0.text = $in.0.tweet_text; return ALL; }
intro__WebServicesHTTP.grf
bfintro__WebServicesHTTP
HTTP_CONNECTOR0
HTTP_CONNECTOR
inputMapping
Set the request content (requestContent) of the HTTP request to the XMLString field of input port 0. Pass every record (return ALL).
[ "$in.0: XMLData (delimited): XMLString string", "$out.0: XMLData (delimited): XMLString string" ]
[]
[]
//#CTL2 function integer transform() { $out.0.requestContent = $in.0.XMLString; return ALL; }
intro__WebServicesHTTP.grf
bfintro__WebServicesHTTP
HTTP_CONNECTOR0
HTTP_CONNECTOR
standardOutputMapping
Set output field XMLString on port 0 to the content of the HTTP response (input port 1 content). Pass every record (return ALL).
[ "$in.0: XMLData (delimited): XMLString string", "$out.0: XMLData (delimited): XMLString string" ]
[]
[]
//#CTL2 function integer transform() { $out.0.XMLString = $in.1.content; return ALL; }
intro__WebServicesWSClient.grf
bfintro__WebServicesWSClient
GRAPHS_ONLY
EXT_FILTER
filterExpression
Return true when the name field of input port 0 ends with the text .grf, otherwise false.
[ "$in.0: recordName1 (delimited): path string, type string, name string, size string, sandbox_code string, sandbox_name string", "$out.0: recordName1 (delimited): path string, type string, name string, size string, sandbox_code string, sandbox_name string" ]
[]
[]
//#CTL2 endsWith($in.0.name,".grf")
intro__XMLProcessing.grf
bfintro__XMLProcessing
EXT_HASH_JOIN0
EXT_HASH_JOIN
transform
Join output: actor_id from the actor (input port 0); movie_id, title, description, release_year and category from the movie (input port 1). Return ALL.
[ "$in.0: actor (delimited): actor_id integer, first_name string, last_name string, movie_id integer", "$in.1: movie (delimited): movie_id integer, title string, description string, release_year integer, language string, length integer, rating string, category string", "$out.0: movie_short (delimited): movie_id i...
[]
[]
//#CTL2 function integer transform() { $out.0.actor_id = $in.0.actor_id; $out.0.movie_id = $in.1.movie_id; $out.0.title = $in.1.title; $out.0.description = $in.1.description; $out.0.release_year = $in.1.release_year; $out.0.category = $in.1.category; return ALL; }
intro___Introduction.grf
bfintro___Introduction
REFORMAT1
REFORMAT
transform
Output port 0: name = firstname, then a single space, then lastname from input port 0; city, email and phone copied from input port 0. Return 0.
[ "$in.0: addressbook_csv (delimited): firstname string, lastname string, address string, city string, zip string, email string, phone string, fax string", "$out.0: addressbook_short (delimited): name string, city string, email string, phone string" ]
[]
[]
//#CTL2 function integer transform() { $out.0.name = $in.0.firstname+' '+$in.0.lastname; $out.0.city = $in.0.city; $out.0.email = $in.0.email; $out.0.phone = $in.0.phone; return 0; }
misc__DummyJob.grf
bfmisc
SET_JOB_OUTPUT
SET_JOB_OUTPUT
mapping
In transform: read DELAY parameter as integer, 0 if conversion fails; if zero pick random integer between 2000 and 20000; sleep that many milliseconds. Set failMsg null. Switch on EXECUTION_STATUS: SUCCEED nothing; FAIL message 'This job failed because you said so.'; RANDOM: failure probability is FAILURE_PROBABILITY p...
[]
[]
[ "EXECUTION_STATUS = RANDOM", "DELAY = 10000", "FAILURE_PROBABILITY = 50" ]
//#CTL2 function integer transform() { integer delay = str2integer("${DELAY}") : 0; // If the conversion failed, use 0. if (delay == 0) { // Zero delay means "pick random delay". delay = randomInteger(2000, 20000); } sleep(delay); // Determine whether the job should fail or not. string failMsg = null; //...

CloverDX ETL graph generation: training data

Supervised fine-tuning (SFT) and preference (DPO) data that teaches a language model to build CloverDX ETL graphs from a user's request. A graph is the XML job definition (.grf) of CloverDX, a data integration / ETL platform. The data also covers explaining graphs, repairing graphs that fail validation, and (optionally) writing the CTL2 transformation code that many components contain.

It was built for LoRA fine-tuning of Qwen-class models, but it is plain chat-format JSONL and works with any trainer.

What a graph-building example looks like

The user describes the job in plain language; the assistant first writes a plan that shows how the data flows, then the graph:

## Plan
Outputs:  ...
Flow:     1. READER: read file -> SORT: sort by id -> JOIN: merge join on id = id (CTL) -> WRITER: write file
          2. LOOKUP_SRC: ... -> JOIN:1
Records:  - JOIN: Order + Customer -> OrderExt: +customer_name string, -customerId
Notes:    - JOIN: a merge join needs inputs sorted on the key ...
Phases / CTL

## Graph
<Graph name="..."> <Global>...</Global> <Phase number="0"> <Node .../> <Edge fromNode="A:0" toNode="B:0" .../> ...
  • The graph is in a compact, lossless XML form (no GUI layout, edge ids or default values; it converts back to a normal .grf).
  • The plan is derived from the graph and its flow is machine-checked to match the graph's edges, so plan and graph never disagree.
  • Notes in the plan come from rules such as: merge joins and sorted aggregates need sorted input, a hash join's lookup side, left-join nulls, "sort + keep first N = top N", writers to one file belong in separate phases.

Configurations

Each config has a train and a validation split. Splits are made by graph: a graph never appears in both.

config rows (train / validation) content
bf_sft 293 / 40 chat examples, CTL code in the graphs
bf_dpo 54 / 11 preference pairs
bf_delegated_sft 242 / 36 SFT with CTL replaced by specs
bf_delegated_dpo 62 / 10 preference pairs, specs instead of CTL
bf_delegated_ctl_requests 96 / 7 requests for a separate CTL model
misc_sft 77 / 18 as bf_sft, other corpus
misc_dpo 20 / 6
misc_delegated_sft 63 / 14
misc_delegated_dpo 30 / 7
misc_delegated_ctl_requests 30 / 6

Two source corpora:

  • bf_*: 64 graphs from the CloverDX example sandboxes BasicFeatures and IntroExamples. The user requests describe the job in business terms only: no component names, so the model must map a plain request to building blocks.
  • misc_*: 12 graphs from a mixed sandbox (designer examples plus agent-written probe graphs). Requests are hand-written and may name components.

Data fields

SFT (*_sft): messages (list of {role, content}: system, user, assistant), type, graph, group, and variant (gen) or kind (repair).

type is one of:

  • gen: request (+ project metadata files and reusable subgraphs) → plan + graph. Two requests per graph, one detailed and one terse.
  • ctl: task summary, node and port records → CTL2 code (only in non-delegated configs).
  • explain: graph → short summary.
  • repair: broken graph + real validator errors → diagnosis + fixed graph. kind is one of component_type, key_field, edge_meta_ref, edge_meta_missing, ctl_field, meta_rename, ctl_missing.

DPO (*_dpo): prompt (system + user messages), chosen (correct plan + graph), rejected (plan + a graph with one injected mistake that the validator rejects), type, graph, group, kind.

CTL requests (*_ctl_requests): graph, group, node, component, attr, spec (natural-language description), ports (resolved record layouts), dictionary, parameters, code (gold CTL2). Use as training data or as an eval set for a CTL-writing model.

Delegated-CTL variant

For a graph model that never writes CTL code: every CTL-valued property is replaced by <ctl attr="NAME">spec</ctl>, a natural-language spec naming fields, ports, dictionary entries and parameters. A separate CTL model writes the code from the spec and the record layouts on the node's edges. When the graph is right but the generated code is wrong, the target is a ## Regenerate CTL section instead of a new graph. CTL embedded in a validator's rules XML and in dynamic graph-parameter defaults is kept as written.

How the data was made

  1. Real example graphs were converted to the compact XML form; round trips are lossless for all graphs used.
  2. User requests, summaries and CTL specs were written by LLM subagents that read each original graph (the bf_* requests under a "no component names" rule enforced by a lint), plus hand-written requests for misc_*.
  3. Repair and DPO data come from single-line mutations of the real graphs (wrong component type, misspelled field or key, undefined or missing edge metadata, renamed metadata field, missing CTL). Each mutation was run through the CloverDX Server validator; only mutations it rejects are used, with its real error text. Errors the unmodified graph already shows (missing database, placeholder connection) were subtracted; mutations that still validate were dropped.

Intended use

Fine-tuning and evaluating models that generate, explain or repair CloverDX graphs; research on plan-then-generate structured output; preference tuning against a validator signal. A useful check on model output is that the generated graph's edges equal the edges stated in its own plan, and that it passes the CloverDX validator.

Limitations

  • Small: 76 distinct graphs. Examples within a graph are correlated (two requests, explain, repairs), hence split by graph.
  • Requests and specs are LLM-written from the graphs and were only spot-checked; some details about reusable subgraph internals are inferred from the parent graph.
  • Plan notes cover only the component types in these graphs.
  • Validation checks structure only; no graph was executed. Some source graphs call external services or need databases and cannot run without them.
  • Component-defined records (e.g. a REST connector's path-parameter record) appear as "(record defined by the component)".
  • The source graphs are CloverDX example projects; check CloverDX's terms if you redistribute derived models.
  • English only.

Citation / contact

Dataset by dpavlis. No paper; cite the dataset URL.

Downloads last month
29