ETL
Abinitio Scenario's
1. Read each value and find sum.
- Input
12345
1234
123
12
1
- Output
15
10
6
3
1
Code - Input File --> Reformat --> Output File
- Input :
chennai bangalore 300
bangalore chennai 300
chennai bangalore 300
chennai trichy 200
trichy chennai 200
- Output :
chennai trichy 200
bangalore chennai 300
Code - Input File --> Reformat --> Sort --> Dedup Sort --> Output File
Input File dml -
record
string(" ") city_1;
string(" ") city_2;
decimal("\n") distance;
end;
Reformat -
out :: reformat(in)=
begin
let string("\x01")[] city_vec = allocate_with_defaults();
let string("\x01")[] sorted_city_vec = allocate_with_defaults();
city_vec = vector_append(city_vec,in.city_1);
city_vec = vector_append(city_vec, in.city_2);
sorted_city_vec = vector_sort(city_vec);
out.city_1 :: sorted_city_vec[0];
out.city_2 :: sorted_city_vec[1];
out.distance :: in.distance;
end;
Sort - Key : city1 & city2
Dedup Sort - Key : city1 & city2
Output File dml -
record
string(" ") city_1;
string(" ") city_2;
decimal("\n") distance;
end;
5.
- Input
EXPLAIN
- Output
E
EX
EXP
EXPL
EXPLA
EXPLAI
EXPLAIN
Code - Input File --> Normalize --> Output File
Normalize -
Input File dml -
record
string("\n") name;
end;
Normalize -
out :: length(in)=
begin
out :: length_of(in.name);
end;
out :: normalize(in,index)=
begin
out.name :: string_substring(in.name, 1, index+1);
end;
Output File dml -
record
string("\n") name;
end;
6.
- Input
1 A
2 B
3 C
4 D
- Output
col1 1 2 3 4
col2 A B C D
Code - Input File --> Meta Pivot --> Rollup --> Reformat --> Output File
Meta Pivot - It will split the data records across the columns
name_field - col1
value_field - col2
Input File dml -
record
string(" ") col1;
string("\n") col2;
end;
Rollup -
out :: rollup(in)
begin
out.col1 :: in.col1;
out.col2 :: (accumulation(in.col2));
end;
Reformat -
out :: reformat(in)=
begin
out.col1 :: in.col1;
out.col2 :: string_join(in.col2,"");
end;
Reformat Output dml -
record
string(" ") col1;
string("\n")[long] col2;
end;
Output File dml -
record
string(" ") col1;
string("\n") col2;
end;
7.
- Input
1 100
2 200
3 300
4 400
- Output
1 100 1000
2 200 1000
3 300 1000
4 400 1000
Code - Input File --> Rollup -->(in0) Join --> Output File
Input File -->(in1)
Input File dml -
record
decimal(" ") id;
decimal("\n") sal;
end;
Rollup - Key {}
out :: rollup(in)=
begin
out.sum :: sum(in.sal);
end;
Join -
out :: join(in0, in1)=
begin
out.id :: in1.id;
out.sal :: in1.sal;
out.sum :: in0.sum;
end;
Output File dml -
record
decimal(" ") id;
decimal(" ") sal;
decimal("\n") sum;
end;
8.
- Input
1 1000
1 2000
1 3000
1 4000
1 5000
1 6000
1 7000
1 8000
1 9000
1 10000
1 11000
1 12000
- Output
1 6000
1 15000
1 24000
1 33000
Code - Input File --> Rollup with Key Change --> Output File
Input File dml -
record
decimal(" ") emp;
decimal("\n") salary;
end;
Rollup -
type temporary_type = record
decimal(" ") sum;
end;
out :: key_change(in1, in2)=
begin
out :: if((next_in_sequence()%3==1) 1 else 0;
end;
temp :: initialize(in)=
begin
temp.sum :: 0;
end;
temp :: rollup(temp,in)=
begin
temp.sum = temp.sum + in.salary;
end;
out :: finalize(temp,in)=
begin
out.emp :: in.emp;
out.salary :: temp.sum;
end;
Output File dml -
record
decimal(" ") emp;
decimal("\n") salary;
end;
9.
- Input
A
B
C
D
- Output
A
AB
ABC
ABCD
Code - Input File --> Rollup --> Normalize --> Output File
Input File dml -
record
string("\n") str;
end;
Rollup - Key {}
out :: rollup(in)=
begin
out.str :: concatenation(in.str);
end;
Normalize -
out :: length(in)=
begin
out :: length_of(in.str);
end;
out :: normalize(in,index)=
begin
out.str :: string_substring(in.str, 1, index + 1);
end;
Output File dml -
record
string("\n") str;
end;
10.
- Input
111111
222222
123456
657234
546723
000000
- Output
NULL
NULL
123456
657234
546723
NULL
Code - Input File --> Reformat --> Output File
Input File dml -
record
decimal("\n") input;
end;
Reformat -
out :: reformat(in)=
begin
out.output :: if(string_substring(in.input,1,1)==string_substring(in.input,2,1)) "NULL" else in.input;
end;
Output File dml -
record
decimal("\n") output;
end;
11.
- Input
1-4
5
6-10
- Output
1
2
3
4
5
6
7
8
9
10
Code - Input File --> Reformat --> Normalize --> Output File
Input File dml -
record
string("\n") str;
end;
Reformat -
out::reformat(in)=
begin
let decimal(4) val1 = 0;
let decimal(4) val2 = 0;
let decimal(4) diff = 0;
if(string_index(in.str,"-"))
begin
val1 = string_substring(in.str, 1, string_index(in.str,"-")-1);
val2 = string_substring(in.str, string_index(in.str,"-")+1, string_length(in.str));
diff = (val2 - val1) + 1;
end
else diff = 1;
out.str :: if(string_index(in.str,"-")>0) string_lrtrim(val1) else in.str;
out.diff :: diff;
end;
Reformat Output dml -
record
string(" ") str;
decimal("\n") diff;
end;
Normalize -
out::length(in)=
begin
out :: in.diff;
end;
out::normalize(in,index)=
begin
out.str :: if (index==0) (decimal(""))in.str else string_lrtrim((decimal(""))in.str+index);
end;
Output File dml -
record
string("\n") str;
end;
12.
- Input
A
B
C
D
- Output
AB
BC
CD
CD
Code - Input File --> Rollup --> Normalize --> Output File
Input/Output File dml -
record
string("\n") str;
end;
Rollup : key {}
Transform :
out :: rollup(in)=
begin
out.str :: string_split_no_empty(string_replace(string_replace_first(string_replace(concatenation(in.str),"",","),",",""),",","",(length_of(concatenation(in.str)) + (length_of(concatenation(in.str))-1))),",");
end;
Rollup Output dml -
record
string("\n")[int] str;
end;
Normalize :
out :: length(in)=
begin
out :: length_of(in.str)-1;
end;
out :: normalize(in,index)=
begin
out.str :: string_concat(in.str[index],in.str[index+1]);
end;
13.
- Input
1
2
3
4
- Output
1
2
50
3
4
50
Code -
14. Find sum of transaction for card_type
- Input
account amount card_type
123 100 credit
123 100 debit
123 200 credit
123 200 debit
- Output
account credit_amount debit_amount
123 300 300
Code - Input File --> Rollup_1 --> Rollup_2 --> Output File
Input File dml -
record
decimal(" ") account;
decimal(" ") amount;
string("\n") card_type;
end;
Rollup_1 - Key {card_type}
out :: rollup(in)=
begin
out.account :: in.account;
out.credit :: sum(in.amount);
out.debit :: sum(in.amount);
end;
Rollup_2 - Key {account}
out :: rollup(in)=
begin
out.account :: in.account;
out.credit :: in.credit;
out.debit :: in.debit;
end;
Output File dml -
record
decimal(" ") account;
decimal(" ") credit;
decimal("\n") debit;
end;
15.
- Input
name primary_account sec_account
sai 22222 99999
- Output
name account
sai 22222
sai 99999
Code - Input File --> Reformat --> Normalize --> Output File
Input dml -
record
string(" ") name;
decimal(" ") primary_account;
decimal("\n") sec_account;
end;
Reformat -
out::reformat(in)=
begin
let decimal("")[int] vec = allocate_with_defaults();
vec = vector_append(vec, in.primary_account);
vec = vector_append(vec, in.sec_account);
out.name :: in.name;
out.vector_account :: vec;
end;
Reformat Output dml -
record
string(" ") name;
decimal("\n")[int] vector_account;
end;
Normalize -
out::length(in)=
begin
out :: length_of(in.vector_account);
end;
out::normalize(in,index)=
begin
out.name :: in.name;
out.account :: in.vector_account[index];
end;
Output File dml -
record
string(" ") name;
string("\n") account;
end;
16.
- Input
A 2
B 3
C 1
- Output
A 2
A 2
B 3
B 3
B 3
C 1
Code - Input File --> Normalize --> Output File
Input File dml -
record
string(" ") a;
decimal("\n") b;
end;
Normalize -
out :: length(in)=
begin
out :: in.b;
end;
out :: normalize(in,index)=
begin
out.a :: in.a;
out.b :: in.b;
end;
Output File dml -
record
string(" ") a;
decimal("\n") b;
end;
17.
- Input
YNNYYN
NNNYYN
YYYYYN
NNNNNN
- Output
P1
P4
P5
P4
P5
P1
P2
P3
P4
P5
Code - 1. Input File --> Normalize --> Output File
OR
2. Input File --> Reformat --> Normalize --> Output File
Method 1.
Input/Output File dml -
record
string(" \n") str;
end;
Normalize -
let string("") str = "";
let decimal("")[] position = allocate_with_defaulta();
out :: length(in)=
begin
let decimal("") count = 1;
let decimal("") count_Y = 0;
while(count != (string_length(in.str))+1)
begin
str = string_substring(in.str, count, 1);
if(str == "Y")
begin
count_Y = count_Y + 1;
position = vector_append(position, count);
end;
count = count + 1;
end;
out :: count_Y;
end;
out :: normalize(in,index)=
begin
out.str :: string_concat("P", position[index]);
end;
Method 2.
Input/Output File dml -
record
string(" \n") str;
end;
Reformat Out Port dml -
record
long[int] str;
end;
Reformat Transform -
out :: reformat(in)=
begin
out.str :: vector_search_all(re_split_no_empty(in.str,"s?"),"Y");
end;
Normalize Transform -
out :: length(in)=
begin
out :: length_of(in.str);
end;
out :: normalize(in,index)=
begin
out.str :: string_concat("P", (decimal(1))index);
end;
18.
- Input
11
14
15
13
16
12
18
20
- Output
11,12
13,14
15,16
18,20
Code - Input File --> Sort --> Rollup --> Reformat --> Normalize --> Output File
19.
- Input
a,a,b,c,d,a,b,c,d
- Output
a,a,a
b,b
c,c
d,d
Code - Input File --> ?
20.
- Input
1, 90
3, 30
7, 48
- Output
1, 90
2, 90
3, 30
4, 30
5, 30
6, 30
7, 48
Code - Input File --> ?
21.
- Input
1
2
3
4
5
6
7
8
- Output
1234
5678
Code - Input File --> Rollup --> Reformat --> Normalize --> Output File
Input/Output File dml -
record
string(" \n") str;
end;
Rollup : Key {}
Transform :
out :: rollup(in)=
begin
out.str :: concatenation(in.str);
end;
Reformat :
Transform :
out :: reformat(in)=
begin
let string("")[int] temp_vec = allocate_with_defaults();
let string("") b = "";
for (let int i = 0, i < length_of(in.str)-1, i+4)
begin
b = in.str[i : i+4];
temp_vec = vector_append(temp_vec,b);
end;
out.str :: temp_vec;
end;
Reformat Out Port dml :
record
string(" \n")[int] str;
end;
Normalize :
Transform :
out :: length(in)=
begin
out :: length_of(in.str);
end;
out :: normalize(in,index)=
begin
out.str :: in.str[index];
end;
22.
- Input
6128
6128
6128
8640
8640
8640
8640
8640
8640
8640
8640
8640
8640
- Output
61280
61281
61282
86400
86401
86402
86403
86404
86405
86406
86407
86408
86409
Code - Input File --> Scan --> Output File
Input/Output File dml -
record
string(" \n") id;
end;
Scan -
type temporary_type =
record
decimal("") count;
end;
temp :: initialize(in) =
begin
temp.count = -1;
end;
temp :: scan(temp, in) =
begin
temp.count = temp.count + 1;
end;
out :: finalize(temp, in) =
begin
out.id :: string_concat(in.id, temp.count);
end;
23.
- Input
Amruta 100, 200
Abhishek 300
- Output
Amruta 100
Amruta 200
Abhishek 300
Code - Input File --> Normalize --> Output
Input/Output File dml -
record
string(",") name;
string("\n") num;
end;
Normalize -
out :: length(in) =
begin
let str = string_split(in.num,",");
out :: length_of(str);
end;
out :: normalize(in,index) =
begin
let str = string_split(in.num,",");
out.name :: in.name;
out.num :: str[index];
end;
24.
- Input
1 100 NULL
1 NULL 200
2 200 NULL
2 NULL 300
- Output
1 100 200
2 200 300
Code - Input File --> Rollup --> Output
Input/Output File dml -
record
decimal(",") num;
decimal(",") amount1=NULL;
decimal("\n") amount2=NULL;
end;
Rollup - Key - {num}
Rollup Transform -
type temporary_type = record
decimal(",") num;
decimal(",") amount1=NULL;
decimal("\n") amount2=NULL;
end;
temp :: initialize(in)=
begin
temp.num :: 0;
temp.amount1 :: 0;
temp.amount2 :: 0;
end;
record rollup(temp, in)=
begin
out.num :: temp.num;
out.amount1 :: first_defined(in.amount1, temp.amount1);
out.amount2 :: first_defined(in.amount2, temp.amount2);
end;
out :: finalize(temp, in) =
begin
out.num :: in.num;
out.amount1 :: temp.amount1;
out.amount2 :: temp.amount2;
end;
25.
- Input
Jan 100
Feb 100
Mar 100
Jun 100
Jul 100
Nov 100
Dec 100
- Output - All months if a month is missing then salary should be 0
Code - Input File --> Normalize --> Output File
Input/Output File dml -
record
string(",") month;
decimal(",") sal;
end;
Normalize:
let string(",") prev_month = '';
let string(",") curr_month = '';
let int count = 0;
out :: length(in)=
begin
prev_month = curr_month;
curr_month = in.month;
count = count + 1;
if(count == 1) 1 else date_difference_months((date("MMM"))curr_month,(date("MMM"))prev_month);
end;
out :: normalize(in,index)=
begin
out.month :: if(index ==0) (date("MMM"))date_add_months((date("MMM"))in.month,index) else (date("MMM"))date_add_months((date("MMM"))prev_month,index)
out.sal :: if(index == 0) 0 else in.sal;
end;
26.
- Input
A
B
C
D
- Output
ABCD
Code - Input File --> Rollup --> Output File
Input/Output File dml -
record
string("\n") str;
end;
Rollup : key {}
Transform :
out :: rollup(in) =
begin
out.str :: concatenation(in.str);
end;
27.
- Input
Mumbai
Chennai
Pune
Kolkata
Delhi
Bangalore
Pune
- Output
Pune
Kolkata
Delhi
Bangalore
Pune
Code - Input File --> Reformat --> Output File
Input/Output File dml -
record
string("\n") str;
end;
Reformat :
Transform 0 :
out :: reformat(in)=
begin
ou.* :: in.*;
end;
Transform 1 :
out :: reformat(in)=
begin
ou.* :: in.*;
end;
output-index :
let ind = 0;
let temp = 0;
output_index_out :: output_index(in)=
begin
if(ind == 1 or in.str == 'Pune')
begin
temp = 0;
ind = 1;
end;
else
temp = 1;
output_index_out :: temp;
end;
28.
- Input
Name City
Shree Pune
Ram Mumbai
Jai Delhi
Shyam Pune
Modi Mumbai
- Output - We need all pune records in same file and same for other cities
Code - Input File --> write Multiple files
Input/Output File dml -
record
string(",") name;
string("\n") city;
end;
Write Multiple file:
filename :: get_filename(in)=
begin
filename :: string_concat("/home/fbzdfbl", in.city,".txt");
end;
write :: reformat(in)=
begin
write.* in.*;
end;
29.
- Input
Id Item Cost
100 copy 500
100 pen 500
101 copy 500
101 pen 500
101 copy 500
- Output
Id distinct_item_count total_amount_spend
100 2 1000
101 2 1500
Code - Input File --> Rollup --> Output File
Input dml -
record
decimal(",") id;
string(",") item;
decimal("\n") cost;
end;
Output File dml -
record
decimal(",") id;
string(",") item;
decimal(",") count;
decimal("\n") total_amount_spend;
end;
Rollup : Key {id; item}
Transform :
out :: rollup(in)=
begin
out.id :: in.id;
out.item :: in.item;
out.count :: count();
out.total_amount_spend :: sum(in.cost);
end;
30.
- Input
str val
a 1
b 2
c 3
- Output
str val
abc 1
abc 2
abc 3
Code - Input File --> Replicate --> Rollup
--> Join --> Output File
Input/Output File dml -
record
string("") str;
decimal("\n") num;
end;
Rollup : Key {}
Transform :
out :: rollup(in)=
begin
out.str :: concatenation(in.str);
end;
Rollup Out Port dml :
record
string("") str;
decimal("\n") num;
end;
Join : Key {} Inner join
Transform :
out :: join(in0,in1)=
begin
out.str :: in0.str;
out.num :: in1.num;
end;
31.
- Input
str str2 num
Pune Mumbai 1
Pune Delhi 2
Mumbai Pune 3
Delhi Pune 4
- Output
str str2 num num
Pune Mumbai 1 3
Pune Delhi 2 4
Code - Input File --> ?
Input/Output File dml -
32.
- Input - aaaaabbbbcccdde
- Output
aaaaa
bbbb
ccc
dd
e
Code - Input File --> Reformat --> Normalize --> Rollup --> Output File
Input/Output File dml -
record
string("\n") str;
end;
Reformat :
out :: reformat(in)=
begin
out.str :: string_split_no_empty(string_replace(string_replace_first(string_replace(in.str,"",","),",",""),",","",(length_of(in.str) + (length_of(in.str) - 1))),",");
end;
Reformat Output dml -
ecord
string("\n")[int] str;
end;
Normalize :
out :: length(in)=
begin
out :: length_of(in.str);
end;
out :: normalize(in,index)=
begin
out.str :: in.str[index];
end;
Rollup : key {}
Transform :
out : rollup(in)
begin
out.str :: concatenation(in.str);
end;
33.
- Input
str
ab
NULL
NULL
cd
- Output - a,b,c,d
Code - Input File --> Reformat --> Output File
Input/Output File dml -
record
string("\n") str = NULL;
end;
Reformat :
Transform :
let string("") glo_str = "";
let int count = 0;
out :: reformat(in)=
begin
glo_str = glo_str + string_replace_first(string_replace(in.str,"",","),",","");
count = count + 1;
if(count == 1)
force_error("abra ka dabra");
else
string_replace(glo_str, ",","",7);
end;
34.
- Input
Id Amount
1 5
1 10
2 20
2 15
- Output
Id Amount
1 15
1 15
2 35
2 35
Code - Input File --> Rollup --> Output File
Join -->
Input/Output File dml -
record
decimal("') Id;
decimal("\n") Amount;
end;
Rollup : key {Id}
Transform :
out :: rollup(in)=
begin
out.Id :: in.Id;
out.Amount :: sum(in.Amount);
end;
Join : key {Id}
Transform :
out :: join(in0,in1)=
begin
out.Id :: in1.Id;
out.Amount :: in0.Amount;
end;
35.
- Input
A 10
B 20
B 20
C 30
C 30
C 30
D 30
- Output
A 10
B 20
B NULL
C 30
C 30
C 30
D NULL
Code - Input File --> Rollup --> Normalize --> Output File
Input/Output File dml -
record
string("") str;
decimal("\n") num;
end;
Rollup : Key {num}
Transform :
out :: rollup(in)=
begin
out.str :: in.str;
out.count :: count();
out.num :: in.num;
out.str_vec :: accumulation(in.str);
end;
Rollup Output dml -
record
string("") str;
decimal("") count;
decimal("") num;
string("\n")[int] str_vec;
end;
Normalize :
out :: length_of(in)=
begin
out :: count;
end;
out :: normalize(in,index)=
begin
out.str :: in.str_vec[index];
out.num :: if(length_of(in.str_vec) == 1) in.num
else if(index == length_of(in.str_vec) - 1) NULL
else in.num;
end;
36.
- Input
1
1 1
1 1 1
1 1 1 1
- Output
1 0 0 0
1 1 0 0
1 1 1 0
1 1 1 1
Code - Input File --> ?
Input/Output File dml -
37.
- Input
str
Vishal
Isha
Coco
Abhishek
Divya
- Output
str count
Vishal 2
Isha 2
Coco 2
Abhishek 3
Divya 2
Code - Input File --> Reformat --> Output File
Input File dml -
record
string("\n") str;
end;
Output File dml -
record
string("") str;
decimal("\n") count;
end;
Reformat :
Transform :
out :: reformat(in)=
begin
out.str :: in.str;
out.countt :: string_length(string_filter(in.str, 'AEIOUaeiou'));
end;
38.
- Input
1
2
3
4
5
6
7
8
9
- Output
123
456
789
Code - Input File --> Rollup --> Reformat --> Normalize --> Output File
Input/Output File dml -
record
string("\n") str;
end;
Rollup : key {}
Transform :
out :: rollup(in)=
begin
out.str :: concatenation(in.str);
end;
Reformat :
Transform :
out :: reformat(in)=
begin
let string("")[int] temp_vec = allocate_with_defaults();
let string("") b = "";
for(let int i = 0, i < length_of(in.str), i+3)
begin
b = in.str[i : i+3];
temp_vec = vector_append(temp_vec,b);
end;
out.str :: temp_vec;
end;
Reformat Output dml -
record
string("\n")[int] str;
end;
Normalize :
out :: length(in)=
begin
out :: length_of(in.str);
end;
out :: normalize(in,index)=
begin
out.str :: in.str[index];
end;
39.
- Input
"how are you"
- Output
"How Are You"
Code - Input File --> Reformat --> Output File
Input/Output File dml -
record
string("\n") str;
end;
40.
- Input
[12,
15,
09,
100]
- Output
Data1 Data2 Data3 Data4
12 15 09 100
Code - Input File --> ?
Input/Output File dml -
41.
- Input
id name
10 A
10 B
10 C
10 D
10 E
11 C
11 A
11 Z
12 Q
12 P
- Output
id row_order name
10 0 A
10 1 B
10 2 C
10 3 D
10 4 E
11 0 C
11 1 A
11 2 Z
12 0 Q
12 1 P
Code - Input File --> Scan --> Output File
Input File dml -
record
decimal("") num;
string("\n") str;
end;
Output File dml -
record
decimal("") num;
decimal("") row_order;
string("\n") str;
end;
Scan : Key {num}
Transform :
type temporary_type =
record
decimal("") id;
end;
temp :: initialization(in)=
begin
temp.id :: -1;
end;
temp :: scan(temp,in)=
begin
temp.id :: temp.id + 1;
end;
out :: finalize(temp,in)=
begin
out.num :: in.num;
out.row_order :: temp.id;
out.str :: in.str;
end;
42.
- Input
aaaaabbbbcccdde
- Output
aaaaa
bbbb
ccc
dd
e
Code - Input File --> Reformat --> Normalize --> rollup --> Output File
Input File dml -
record
string("\n") str;
end;
Reformat :
Transform :
out :: reformat(in)=
begin
out.str :: string_split_no_empty(string_replace(string_replace_first(string_replace(in.str,"" ","),",",""),",",""),(length_of(in.str) + (length_of(in.str) -1))),",");
end;
Reformat Output dml -
record
string("\n")[int] str;
end;
Normalize :
out :: length(in)=
begin
out :: length_of(in.str);
end;
out :: normalize(in,index)=
begin
out.str :: in.str[index];
end;
Rollup : key {str}
Transform :
out :: rollup(in)=
begin
out.str :: concatenation(in.str);
end;
43.
- Input
aaaaabbbbcccdde
- Output
a
a
a
a
a
b
b
b
b
c
c
c
d
d
e
Code - Input File --> Reformat --> Output File
Input File dml -
record
string("\n") str;
end;
Reformat :
Transform :
out :: reformat(in)=
begin
out.str :: string_split_no_empty(string_replace(string_replace_first(string_replace(in.str,"" ","),",",""),",",""),(length_of(in.str) + (length_of(in.str) -1))),",");
end;
Reformat Output dml -
record
string("\n")[int] str;
end;
44.
- Input
1
2
3
- Output
1
2
2
3
3
3
Code - Input File --> Normalize --> Output File
Input/Output File dml -
record
decimal("\n") num;
end;
Normalize :
out :: length(in)=
begin
out :: in.num;
end;
out :: normalize(in,index)=
begin
out.num :: in.num;
end;
45. Abinitio Scenario's
1. Read each value and find sum.
- Input
12345
1234
123
12
1
- Output
15
10
6
3
1
Code - Input File --> Reformat --> Output File
- Input :
chennai bangalore 300
bangalore chennai 300
chennai bangalore 300
chennai trichy 200
trichy chennai 200
- Output :
chennai trichy 200
bangalore chennai 300
Code - Input File --> Reformat --> Sort --> Dedup Sort --> Output File
Input File dml -
record
string(" ") city_1;
string(" ") city_2;
decimal("\n") distance;
end;
Reformat -
out :: reformat(in)=
begin
let string("\x01")[] city_vec = allocate_with_defaults();
let string("\x01")[] sorted_city_vec = allocate_with_defaults();
city_vec = vector_append(city_vec,in.city_1);
city_vec = vector_append(city_vec, in.city_2);
sorted_city_vec = vector_sort(city_vec);
out.city_1 :: sorted_city_vec[0];
out.city_2 :: sorted_city_vec[1];
out.distance :: in.distance;
end;
Sort - Key : city1 & city2
Dedup Sort - Key : city1 & city2
Output File dml -
record
string(" ") city_1;
string(" ") city_2;
decimal("\n") distance;
end;
5.
- Input
EXPLAIN
- Output
E
EX
EXP
EXPL
EXPLA
EXPLAI
EXPLAIN
Code - Input File --> Normalize --> Output File
Normalize -
Input File dml -
record
string("\n") name;
end;
Normalize -
out :: length(in)=
begin
out :: length_of(in.name);
end;
out :: normalize(in,index)=
begin
out.name :: string_substring(in.name, 1, index+1);
end;
Output File dml -
record
string("\n") name;
end;
6.
- Input
1 A
2 B
3 C
4 D
- Output
col1 1 2 3 4
col2 A B C D
Code - Input File --> Meta Pivot --> Rollup --> Reformat --> Output File
Meta Pivot - It will split the data records across the columns
name_field - col1
value_field - col2
Input File dml -
record
string(" ") col1;
string("\n") col2;
end;
Rollup -
out :: rollup(in)
begin
out.col1 :: in.col1;
out.col2 :: (accumulation(in.col2));
end;
Reformat -
out :: reformat(in)=
begin
out.col1 :: in.col1;
out.col2 :: string_join(in.col2,"");
end;
Reformat Output dml -
record
string(" ") col1;
string("\n")[long] col2;
end;
Output File dml -
record
string(" ") col1;
string("\n") col2;
end;
7.
- Input
1 100
2 200
3 300
4 400
- Output
1 100 1000
2 200 1000
3 300 1000
4 400 1000
Code - Input File --> Rollup -->(in0) Join --> Output File
Input File -->(in1)
Input File dml -
record
decimal(" ") id;
decimal("\n") sal;
end;
Rollup - Key {}
out :: rollup(in)=
begin
out.sum :: sum(in.sal);
end;
Join -
out :: join(in0, in1)=
begin
out.id :: in1.id;
out.sal :: in1.sal;
out.sum :: in0.sum;
end;
Output File dml -
record
decimal(" ") id;
decimal(" ") sal;
decimal("\n") sum;
end;
8.
- Input
1 1000
1 2000
1 3000
1 4000
1 5000
1 6000
1 7000
1 8000
1 9000
1 10000
1 11000
1 12000
- Output
1 6000
1 15000
1 24000
1 33000
Code - Input File --> Rollup with Key Change --> Output File
Input File dml -
record
decimal(" ") emp;
decimal("\n") salary;
end;
Rollup -
type temporary_type = record
decimal(" ") sum;
end;
out :: key_change(in1, in2)=
begin
out :: if((next_in_sequence()%3==1) 1 else 0;
end;
temp :: initialize(in)=
begin
temp.sum :: 0;
end;
temp :: rollup(temp,in)=
begin
temp.sum = temp.sum + in.salary;
end;
out :: finalize(temp,in)=
begin
out.emp :: in.emp;
out.salary :: temp.sum;
end;
Output File dml -
record
decimal(" ") emp;
decimal("\n") salary;
end;
9.
- Input
A
B
C
D
- Output
A
AB
ABC
ABCD
Code - Input File --> Rollup --> Normalize --> Output File
Input File dml -
record
string("\n") str;
end;
Rollup - Key {}
out :: rollup(in)=
begin
out.str :: concatenation(in.str);
end;
Normalize -
out :: length(in)=
begin
out :: length_of(in.str);
end;
out :: normalize(in,index)=
begin
out.str :: string_substring(in.str, 1, index + 1);
end;
Output File dml -
record
string("\n") str;
end;
10.
- Input
111111
222222
123456
657234
546723
000000
- Output
NULL
NULL
123456
657234
546723
NULL
Code - Input File --> Reformat --> Output File
Input File dml -
record
decimal("\n") input;
end;
Reformat -
out :: reformat(in)=
begin
out.output :: if(string_substring(in.input,1,1)==string_substring(in.input,2,1)) "NULL" else in.input;
end;
Output File dml -
record
decimal("\n") output;
end;
11.
- Input
1-4
5
6-10
- Output
1
2
3
4
5
6
7
8
9
10
Code - Input File --> Reformat --> Normalize --> Output File
Input File dml -
record
string("\n") str;
end;
Reformat -
out::reformat(in)=
begin
let decimal(4) val1 = 0;
let decimal(4) val2 = 0;
let decimal(4) diff = 0;
if(string_index(in.str,"-"))
begin
val1 = string_substring(in.str, 1, string_index(in.str,"-")-1);
val2 = string_substring(in.str, string_index(in.str,"-")+1, string_length(in.str));
diff = (val2 - val1) + 1;
end
else diff = 1;
out.str :: if(string_index(in.str,"-")>0) string_lrtrim(val1) else in.str;
out.diff :: diff;
end;
Reformat Output dml -
record
string(" ") str;
decimal("\n") diff;
end;
Normalize -
out::length(in)=
begin
out :: in.diff;
end;
out::normalize(in,index)=
begin
out.str :: if (index==0) (decimal(""))in.str else string_lrtrim((decimal(""))in.str+index);
end;
Output File dml -
record
string("\n") str;
end;
12.
- Input
A
B
C
D
- Output
AB
BC
CD
CD
Code - Input File --> Rollup --> Normalize --> Output File
Input/Output File dml -
record
string("\n") str;
end;
Rollup : key {}
Transform :
out :: rollup(in)=
begin
out.str :: string_split_no_empty(string_replace(string_replace_first(string_replace(concatenation(in.str),"",","),",",""),",","",(length_of(concatenation(in.str)) + (length_of(concatenation(in.str))-1))),",");
end;
Rollup Output dml -
record
string("\n")[int] str;
end;
Normalize :
out :: length(in)=
begin
out :: length_of(in.str)-1;
end;
out :: normalize(in,index)=
begin
out.str :: string_concat(in.str[index],in.str[index+1]);
end;
13.
- Input
1
2
3
4
- Output
1
2
50
3
4
50
Code -
14. Find sum of transaction for card_type
- Input
account amount card_type
123 100 credit
123 100 debit
123 200 credit
123 200 debit
- Output
account credit_amount debit_amount
123 300 300
Code - Input File --> Rollup_1 --> Rollup_2 --> Output File
Input File dml -
record
decimal(" ") account;
decimal(" ") amount;
string("\n") card_type;
end;
Rollup_1 - Key {card_type}
out :: rollup(in)=
begin
out.account :: in.account;
out.credit :: sum(in.amount);
out.debit :: sum(in.amount);
end;
Rollup_2 - Key {account}
out :: rollup(in)=
begin
out.account :: in.account;
out.credit :: in.credit;
out.debit :: in.debit;
end;
Output File dml -
record
decimal(" ") account;
decimal(" ") credit;
decimal("\n") debit;
end;
15.
- Input
name primary_account sec_account
sai 22222 99999
- Output
name account
sai 22222
sai 99999
Code - Input File --> Reformat --> Normalize --> Output File
Input dml -
record
string(" ") name;
decimal(" ") primary_account;
decimal("\n") sec_account;
end;
Reformat -
out::reformat(in)=
begin
let decimal("")[int] vec = allocate_with_defaults();
vec = vector_append(vec, in.primary_account);
vec = vector_append(vec, in.sec_account);
out.name :: in.name;
out.vector_account :: vec;
end;
Reformat Output dml -
record
string(" ") name;
decimal("\n")[int] vector_account;
end;
Normalize -
out::length(in)=
begin
out :: length_of(in.vector_account);
end;
out::normalize(in,index)=
begin
out.name :: in.name;
out.account :: in.vector_account[index];
end;
Output File dml -
record
string(" ") name;
string("\n") account;
end;
16.
- Input
A 2
B 3
C 1
- Output
A 2
A 2
B 3
B 3
B 3
C 1
Code - Input File --> Normalize --> Output File
Input File dml -
record
string(" ") a;
decimal("\n") b;
end;
Normalize -
out :: length(in)=
begin
out :: in.b;
end;
out :: normalize(in,index)=
begin
out.a :: in.a;
out.b :: in.b;
end;
Output File dml -
record
string(" ") a;
decimal("\n") b;
end;
17.
- Input
YNNYYN
NNNYYN
YYYYYN
NNNNNN
- Output
P1
P4
P5
P4
P5
P1
P2
P3
P4
P5
Code - 1. Input File --> Normalize --> Output File
OR
2. Input File --> Reformat --> Normalize --> Output File
Method 1.
Input/Output File dml -
record
string(" \n") str;
end;
Normalize -
let string("") str = "";
let decimal("")[] position = allocate_with_defaulta();
out :: length(in)=
begin
let decimal("") count = 1;
let decimal("") count_Y = 0;
while(count != (string_length(in.str))+1)
begin
str = string_substring(in.str, count, 1);
if(str == "Y")
begin
count_Y = count_Y + 1;
position = vector_append(position, count);
end;
count = count + 1;
end;
out :: count_Y;
end;
out :: normalize(in,index)=
begin
out.str :: string_concat("P", position[index]);
end;
Method 2.
Input/Output File dml -
record
string(" \n") str;
end;
Reformat Out Port dml -
record
long[int] str;
end;
Reformat Transform -
out :: reformat(in)=
begin
out.str :: vector_search_all(re_split_no_empty(in.str,"s?"),"Y");
end;
Normalize Transform -
out :: length(in)=
begin
out :: length_of(in.str);
end;
out :: normalize(in,index)=
begin
out.str :: string_concat("P", (decimal(1))index);
end;
18.
- Input
11
14
15
13
16
12
18
20
- Output
11,12
13,14
15,16
18,20
Code - Input File --> Sort --> Rollup --> Reformat --> Normalize --> Output File
19.
- Input
a,a,b,c,d,a,b,c,d
- Output
a,a,a
b,b
c,c
d,d
Code - Input File --> ?
20.
- Input
1, 90
3, 30
7, 48
- Output
1, 90
2, 90
3, 30
4, 30
5, 30
6, 30
7, 48
Code - Input File --> ?
21.
- Input
1
2
3
4
5
6
7
8
- Output
1234
5678
Code - Input File --> Rollup --> Reformat --> Normalize --> Output File
Input/Output File dml -
record
string(" \n") str;
end;
Rollup : Key {}
Transform :
out :: rollup(in)=
begin
out.str :: concatenation(in.str);
end;
Reformat :
Transform :
out :: reformat(in)=
begin
let string("")[int] temp_vec = allocate_with_defaults();
let string("") b = "";
for (let int i = 0, i < length_of(in.str)-1, i+4)
begin
b = in.str[i : i+4];
temp_vec = vector_append(temp_vec,b);
end;
out.str :: temp_vec;
end;
Reformat Out Port dml :
record
string(" \n")[int] str;
end;
Normalize :
Transform :
out :: length(in)=
begin
out :: length_of(in.str);
end;
out :: normalize(in,index)=
begin
out.str :: in.str[index];
end;
22.
- Input
6128
6128
6128
8640
8640
8640
8640
8640
8640
8640
8640
8640
8640
- Output
61280
61281
61282
86400
86401
86402
86403
86404
86405
86406
86407
86408
86409
Code - Input File --> Scan --> Output File
Input/Output File dml -
record
string(" \n") id;
end;
Scan -
type temporary_type =
record
decimal("") count;
end;
temp :: initialize(in) =
begin
temp.count = -1;
end;
temp :: scan(temp, in) =
begin
temp.count = temp.count + 1;
end;
out :: finalize(temp, in) =
begin
out.id :: string_concat(in.id, temp.count);
end;
23.
- Input
Amruta 100, 200
Abhishek 300
- Output
Amruta 100
Amruta 200
Abhishek 300
Code - Input File --> Normalize --> Output
Input/Output File dml -
record
string(",") name;
string("\n") num;
end;
Normalize -
out :: length(in) =
begin
let str = string_split(in.num,",");
out :: length_of(str);
end;
out :: normalize(in,index) =
begin
let str = string_split(in.num,",");
out.name :: in.name;
out.num :: str[index];
end;
24.
- Input
1 100 NULL
1 NULL 200
2 200 NULL
2 NULL 300
- Output
1 100 200
2 200 300
Code - Input File --> Rollup --> Output
Input/Output File dml -
record
decimal(",") num;
decimal(",") amount1=NULL;
decimal("\n") amount2=NULL;
end;
Rollup - Key - {num}
Rollup Transform -
type temporary_type = record
decimal(",") num;
decimal(",") amount1=NULL;
decimal("\n") amount2=NULL;
end;
temp :: initialize(in)=
begin
temp.num :: 0;
temp.amount1 :: 0;
temp.amount2 :: 0;
end;
record rollup(temp, in)=
begin
out.num :: temp.num;
out.amount1 :: first_defined(in.amount1, temp.amount1);
out.amount2 :: first_defined(in.amount2, temp.amount2);
end;
out :: finalize(temp, in) =
begin
out.num :: in.num;
out.amount1 :: temp.amount1;
out.amount2 :: temp.amount2;
end;
25.
- Input
Jan 100
Feb 100
Mar 100
Jun 100
Jul 100
Nov 100
Dec 100
- Output - All months if a month is missing then salary should be 0
Code - Input File --> Normalize --> Output File
Input/Output File dml -
record
string(",") month;
decimal(",") sal;
end;
Normalize:
let string(",") prev_month = '';
let string(",") curr_month = '';
let int count = 0;
out :: length(in)=
begin
prev_month = curr_month;
curr_month = in.month;
count = count + 1;
if(count == 1) 1 else date_difference_months((date("MMM"))curr_month,(date("MMM"))prev_month);
end;
out :: normalize(in,index)=
begin
out.month :: if(index ==0) (date("MMM"))date_add_months((date("MMM"))in.month,index) else (date("MMM"))date_add_months((date("MMM"))prev_month,index)
out.sal :: if(index == 0) 0 else in.sal;
end;
26.
- Input
A
B
C
D
- Output
ABCD
Code - Input File --> Rollup --> Output File
Input/Output File dml -
record
string("\n") str;
end;
Rollup : key {}
Transform :
out :: rollup(in) =
begin
out.str :: concatenation(in.str);
end;
27.
- Input
Mumbai
Chennai
Pune
Kolkata
Delhi
Bangalore
Pune
- Output
Pune
Kolkata
Delhi
Bangalore
Pune
Code - Input File --> Reformat --> Output File
Input/Output File dml -
record
string("\n") str;
end;
Reformat :
Transform 0 :
out :: reformat(in)=
begin
ou.* :: in.*;
end;
Transform 1 :
out :: reformat(in)=
begin
ou.* :: in.*;
end;
output-index :
let ind = 0;
let temp = 0;
output_index_out :: output_index(in)=
begin
if(ind == 1 or in.str == 'Pune')
begin
temp = 0;
ind = 1;
end;
else
temp = 1;
output_index_out :: temp;
end;
28.
- Input
Name City
Shree Pune
Ram Mumbai
Jai Delhi
Shyam Pune
Modi Mumbai
- Output - We need all pune records in same file and same for other cities
Code - Input File --> write Multiple files
Input/Output File dml -
record
string(",") name;
string("\n") city;
end;
Write Multiple file:
filename :: get_filename(in)=
begin
filename :: string_concat("/home/fbzdfbl", in.city,".txt");
end;
write :: reformat(in)=
begin
write.* in.*;
end;
29.
- Input
Id Item Cost
100 copy 500
100 pen 500
101 copy 500
101 pen 500
101 copy 500
- Output
Id distinct_item_count total_amount_spend
100 2 1000
101 2 1500
Code - Input File --> Rollup --> Output File
Input dml -
record
decimal(",") id;
string(",") item;
decimal("\n") cost;
end;
Output File dml -
record
decimal(",") id;
string(",") item;
decimal(",") count;
decimal("\n") total_amount_spend;
end;
Rollup : Key {id; item}
Transform :
out :: rollup(in)=
begin
out.id :: in.id;
out.item :: in.item;
out.count :: count();
out.total_amount_spend :: sum(in.cost);
end;
30.
- Input
str val
a 1
b 2
c 3
- Output
str val
abc 1
abc 2
abc 3
Code - Input File --> Replicate --> Rollup
--> Join --> Output File
Input/Output File dml -
record
string("") str;
decimal("\n") num;
end;
Rollup : Key {}
Transform :
out :: rollup(in)=
begin
out.str :: concatenation(in.str);
end;
Rollup Out Port dml :
record
string("") str;
decimal("\n") num;
end;
Join : Key {} Inner join
Transform :
out :: join(in0,in1)=
begin
out.str :: in0.str;
out.num :: in1.num;
end;
31.
- Input
str str2 num
Pune Mumbai 1
Pune Delhi 2
Mumbai Pune 3
Delhi Pune 4
- Output
str str2 num num
Pune Mumbai 1 3
Pune Delhi 2 4
Code - Input File --> ?
Input/Output File dml -
32.
- Input - aaaaabbbbcccdde
- Output
aaaaa
bbbb
ccc
dd
e
Code - Input File --> Reformat --> Normalize --> Rollup --> Output File
Input/Output File dml -
record
string("\n") str;
end;
Reformat :
out :: reformat(in)=
begin
out.str :: string_split_no_empty(string_replace(string_replace_first(string_replace(in.str,"",","),",",""),",","",(length_of(in.str) + (length_of(in.str) - 1))),",");
end;
Reformat Output dml -
ecord
string("\n")[int] str;
end;
Normalize :
out :: length(in)=
begin
out :: length_of(in.str);
end;
out :: normalize(in,index)=
begin
out.str :: in.str[index];
end;
Rollup : key {}
Transform :
out : rollup(in)
begin
out.str :: concatenation(in.str);
end;
33.
- Input
str
ab
NULL
NULL
cd
- Output - a,b,c,d
Code - Input File --> Reformat --> Output File
Input/Output File dml -
record
string("\n") str = NULL;
end;
Reformat :
Transform :
let string("") glo_str = "";
let int count = 0;
out :: reformat(in)=
begin
glo_str = glo_str + string_replace_first(string_replace(in.str,"",","),",","");
count = count + 1;
if(count == 1)
force_error("abra ka dabra");
else
string_replace(glo_str, ",","",7);
end;
34.
- Input
Id Amount
1 5
1 10
2 20
2 15
- Output
Id Amount
1 15
1 15
2 35
2 35
Code - Input File --> Rollup --> Output File
Join -->
Input/Output File dml -
record
decimal("') Id;
decimal("\n") Amount;
end;
Rollup : key {Id}
Transform :
out :: rollup(in)=
begin
out.Id :: in.Id;
out.Amount :: sum(in.Amount);
end;
Join : key {Id}
Transform :
out :: join(in0,in1)=
begin
out.Id :: in1.Id;
out.Amount :: in0.Amount;
end;
35.
- Input
A 10
B 20
B 20
C 30
C 30
C 30
D 30
- Output
A 10
B 20
B NULL
C 30
C 30
C 30
D NULL
Code - Input File --> Rollup --> Normalize --> Output File
Input/Output File dml -
record
string("") str;
decimal("\n") num;
end;
Rollup : Key {num}
Transform :
out :: rollup(in)=
begin
out.str :: in.str;
out.count :: count();
out.num :: in.num;
out.str_vec :: accumulation(in.str);
end;
Rollup Output dml -
record
string("") str;
decimal("") count;
decimal("") num;
string("\n")[int] str_vec;
end;
Normalize :
out :: length_of(in)=
begin
out :: count;
end;
out :: normalize(in,index)=
begin
out.str :: in.str_vec[index];
out.num :: if(length_of(in.str_vec) == 1) in.num
else if(index == length_of(in.str_vec) - 1) NULL
else in.num;
end;
36.
- Input
1
1 1
1 1 1
1 1 1 1
- Output
1 0 0 0
1 1 0 0
1 1 1 0
1 1 1 1
Code - Input File --> ?
Input/Output File dml -
37.
- Input
str
Vishal
Isha
Coco
Abhishek
Divya
- Output
str count
Vishal 2
Isha 2
Coco 2
Abhishek 3
Divya 2
Code - Input File --> Reformat --> Output File
Input File dml -
record
string("\n") str;
end;
Output File dml -
record
string("") str;
decimal("\n") count;
end;
Reformat :
Transform :
out :: reformat(in)=
begin
out.str :: in.str;
out.countt :: string_length(string_filter(in.str, 'AEIOUaeiou'));
end;
38.
- Input
1
2
3
4
5
6
7
8
9
- Output
123
456
789
Code - Input File --> Rollup --> Reformat --> Normalize --> Output File
Input/Output File dml -
record
string("\n") str;
end;
Rollup : key {}
Transform :
out :: rollup(in)=
begin
out.str :: concatenation(in.str);
end;
Reformat :
Transform :
out :: reformat(in)=
begin
let string("")[int] temp_vec = allocate_with_defaults();
let string("") b = "";
for(let int i = 0, i < length_of(in.str), i+3)
begin
b = in.str[i : i+3];
temp_vec = vector_append(temp_vec,b);
end;
out.str :: temp_vec;
end;
Reformat Output dml -
record
string("\n")[int] str;
end;
Normalize :
out :: length(in)=
begin
out :: length_of(in.str);
end;
out :: normalize(in,index)=
begin
out.str :: in.str[index];
end;
39.
- Input
"how are you"
- Output
"How Are You"
Code - Input File --> Reformat --> Output File
Input/Output File dml -
record
string("\n") str;
end;
40.
- Input
[12,
15,
09,
100]
- Output
Data1 Data2 Data3 Data4
12 15 09 100
Code - Input File --> ?
Input/Output File dml -
41.
- Input
id name
10 A
10 B
10 C
10 D
10 E
11 C
11 A
11 Z
12 Q
12 P
- Output
id row_order name
10 0 A
10 1 B
10 2 C
10 3 D
10 4 E
11 0 C
11 1 A
11 2 Z
12 0 Q
12 1 P
Code - Input File --> Scan --> Output File
Input File dml -
record
decimal("") num;
string("\n") str;
end;
Output File dml -
record
decimal("") num;
decimal("") row_order;
string("\n") str;
end;
Scan : Key {num}
Transform :
type temporary_type =
record
decimal("") id;
end;
temp :: initialization(in)=
begin
temp.id :: -1;
end;
temp :: scan(temp,in)=
begin
temp.id :: temp.id + 1;
end;
out :: finalize(temp,in)=
begin
out.num :: in.num;
out.row_order :: temp.id;
out.str :: in.str;
end;
42.
- Input
aaaaabbbbcccdde
- Output
aaaaa
bbbb
ccc
dd
e
Code - Input File --> Reformat --> Normalize --> rollup --> Output File
Input File dml -
record
string("\n") str;
end;
Reformat :
Transform :
out :: reformat(in)=
begin
out.str :: string_split_no_empty(string_replace(string_replace_first(string_replace(in.str,"" ","),",",""),",",""),(length_of(in.str) + (length_of(in.str) -1))),",");
end;
Reformat Output dml -
record
string("\n")[int] str;
end;
Normalize :
out :: length(in)=
begin
out :: length_of(in.str);
end;
out :: normalize(in,index)=
begin
out.str :: in.str[index];
end;
Rollup : key {str}
Transform :
out :: rollup(in)=
begin
out.str :: concatenation(in.str);
end;
43.
- Input
aaaaabbbbcccdde
- Output
a
a
a
a
a
b
b
b
b
c
c
c
d
d
e
Code - Input File --> Reformat --> Output File
Input File dml -
record
string("\n") str;
end;
Reformat :
Transform :
out :: reformat(in)=
begin
out.str :: string_split_no_empty(string_replace(string_replace_first(string_replace(in.str,"" ","),",",""),",",""),(length_of(in.str) + (length_of(in.str) -1))),",");
end;
Reformat Output dml -
record
string("\n")[int] str;
end;
44.
- Input
1
2
3
- Output
1
2
2
3
3
3
Code - Input File --> Normalize --> Output File
Input/Output File dml -
record
decimal("\n") num;
end;
Normalize :
out :: length(in)=
begin
out :: in.num;
end;
out :: normalize(in,index)=
begin
out.num :: in.num;
end;
45.cc
- Input
- Output
Code - Input File --> ?
Input File dml -
******************************Keep Learning******************************Stay Focused *****************************
- Input
- Output
Code - Input File --> ?
Input File dml -
******************************Keep Learning******************************Stay Focused *****************************
Comments
Post a Comment