-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KunalBhade-Module5 #90
Open
kunal15112001
wants to merge
12
commits into
hotwax:main
Choose a base branch
from
kunal15112001:KunalBhade-Module5
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ebeb94c
Solved all Problems of Module-5 JOLT Transformation
kunal15112001 e265f8d
Added the jolt transformation for Problem statement 1
kunal15112001 7680f07
rearranged the first_name and last_name field in the output in Proble…
kunal15112001 ee21ae6
corrected the output in Problem statement 12
kunal15112001 826f985
Added the missing workPhone field in Problem statement 14
kunal15112001 6c56bf4
Added the Transformation spec.json in Problem statement 16
kunal15112001 ebcc0b1
use address key instead of traversing all keys in problem 9
kunal15112001 14b31c8
used different approach in problem 30
kunal15112001 6b19a35
removed unncessary field 'returnId' from spec in problem 26
kunal15112001 66778fd
Added explanation for all the problem in module 5.
kunal15112001 3b53488
Corrected the problem 1 (changed the variable name from newprice to t…
kunal15112001 e0b65b4
Corrected the problem 19 (changed the variable name from ans to price)
kunal15112001 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
### Number of Operations: 4 | ||
|
||
1. modify-overwrite-beta | ||
2. shift | ||
3. modify-overwrite-beta | ||
4. remove | ||
|
||
### Explanation: | ||
|
||
1. Used modify-overwrite-beta operation and concating the firstName, lastName into new key fullName also concating the keys inside address (street, city,state,zip) into address field. | ||
|
||
created new fields:- | ||
|
||
inverse- inverse the quantity for multiplication. | ||
|
||
newPrice- using divide function to multiply the inverse of quantity to price and updating price to double. | ||
|
||
2. Used shift operation then to structure the fields to new location by shifting the newPrice in orders list. | ||
|
||
3. used modify-overwrite-beta to modify newPrice to double. | ||
|
||
4. Used remove operation removes unnecessary fields such as 'inverse' field from each item and the 'firstName' and 'lastName' fields from the customer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"orders": [ | ||
{ | ||
"orderId": 1, | ||
"orderDate": "2022-02-20T12:34:56Z", | ||
"customer": { | ||
"customerId": 1, | ||
"firstName": "John", | ||
"lastName": "Doe", | ||
"email": "[email protected]", | ||
"address": { | ||
"street": "123 Main St", | ||
"city": "Anytown", | ||
"state": "CA", | ||
"zip": "12345" | ||
} | ||
}, | ||
"items": [ | ||
{ | ||
"itemId": 1, | ||
"name": "Product A", | ||
"quantity": 2, | ||
"price": 10.0 | ||
}, | ||
{ | ||
"itemId": 2, | ||
"name": "Product B", | ||
"quantity": 1, | ||
"price": 20.0 | ||
} | ||
] | ||
}, | ||
{ | ||
"orderId": 2, | ||
"orderDate": "2022-02-21T09:12:34Z", | ||
"customer": { | ||
"customerId": 2, | ||
"firstName": "Jane", | ||
"lastName": "Smith", | ||
"email": "[email protected]", | ||
"address": { | ||
"street": "456 Oak St", | ||
"city": "Somewhere", | ||
"state": "NY", | ||
"zip": "67890" | ||
} | ||
}, | ||
"items": [ | ||
{ | ||
"itemId": 3, | ||
"name": "Product C", | ||
"quantity": 3, | ||
"price": 15.0 | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"orders" : [ { | ||
"orderId" : 1, | ||
"orderDate" : "2022-02-20T12:34:56Z", | ||
"customer" : { | ||
"customerId" : 1, | ||
"email" : "[email protected]", | ||
"address" : "123 Main St, Anytown, CA 12345", | ||
"fullName" : "John Doe" | ||
}, | ||
"items" : [ { | ||
"itemId" : 1, | ||
"name" : "Product A", | ||
"quantity" : 2, | ||
"price" : 10.0 | ||
}, { | ||
"itemId" : 2, | ||
"name" : "Product B", | ||
"quantity" : 1, | ||
"price" : 20.0 | ||
} ], | ||
"newprice" : 40.0 | ||
}, { | ||
"orderId" : 2, | ||
"orderDate" : "2022-02-21T09:12:34Z", | ||
"customer" : { | ||
"customerId" : 2, | ||
"email" : "[email protected]", | ||
"address" : "456 Oak St, Somewhere, NY 67890", | ||
"fullName" : "Jane Smith" | ||
}, | ||
"items" : [ { | ||
"itemId" : 3, | ||
"name" : "Product C", | ||
"quantity" : 3, | ||
"price" : 15.0 | ||
} ], | ||
"newprice" : 45.0 | ||
} ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
[ | ||
{ | ||
"operation": "modify-overwrite-beta", | ||
"spec": { | ||
"orders": { | ||
"*": { | ||
"customer": { | ||
"fullName": "=concat(@(1,firstName),' ',@(1,lastName))", | ||
"address": "=concat(@(0,street),', ',@(0,city),', ',@(0,state),' ',@(0,zip))" | ||
}, | ||
"items": { | ||
"*": { | ||
"inverse": "=divide(1,@(1,quantity))", | ||
"newprice": "=divide(@(1,price),@(1,inverse))", | ||
"price": "=toDouble(@(1,price))" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"operation": "shift", | ||
"spec": { | ||
"orders": { | ||
"*": { | ||
"*": "orders[&1].&", | ||
"items": { | ||
"*": { | ||
"*": "orders[&3].items[&1].&", | ||
"newprice": "orders[&3].&" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"operation": "modify-overwrite-beta", | ||
"spec": { | ||
"orders": { | ||
"*": { | ||
"newprice": "=doubleSum(@(1,newprice))" | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"operation": "remove", | ||
"spec": { | ||
"orders": { | ||
"*": { | ||
"items": { | ||
"*": { | ||
"inverse": "" | ||
} | ||
}, | ||
"customer": { | ||
"firstName": "", | ||
"lastName": "" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
### Number of Operations: 2 | ||
|
||
1. modify-overwrite-beta | ||
2. shift | ||
|
||
### Explanation: | ||
|
||
1. Used modify-overwrite-beta operation first and split the name by space " " used firstElement, lastElement function to get first element and last element from name and then created two new keys first_name and last_name, also used size function to get the count of phone_numbers list of object store it in phone_number_count. | ||
|
||
2. Used shift operation then to structure the field according to output. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "John Smith", | ||
"age": 35, | ||
"address": { | ||
"street": "123 Main St", | ||
"city": "Anytown", | ||
"state": "CA", | ||
"zip": "12345" | ||
}, | ||
"phone_numbers": [ | ||
{ | ||
"type": "home", | ||
"number": "555-1234" | ||
}, | ||
{ | ||
"type": "work", | ||
"number": "555-5678" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"first_name" : "John", | ||
"last_name" : "Smith", | ||
"age" : 35, | ||
"address" : { | ||
"street" : "123 Main St", | ||
"city" : "Anytown", | ||
"state" : "CA", | ||
"zip" : "12345" | ||
}, | ||
"phone_numbers" : [ { | ||
"type" : "home", | ||
"number" : "555-1234" | ||
}, { | ||
"type" : "work", | ||
"number" : "555-5678" | ||
} ], | ||
"phone_number_count" : 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[ | ||
{ | ||
"operation": "modify-overwrite-beta", | ||
"spec": { | ||
"name": "=split(' ', @(1,name))", | ||
"first_name": "=firstElement(@(1,name))", | ||
"last_name": "=lastElement(@(1,name))", | ||
"phone_number_count": "=size(@(1,phone_numbers))" | ||
} | ||
}, | ||
{ | ||
"operation": "shift", | ||
"spec": { | ||
"first_name": "&", | ||
"last_name": "&", | ||
"age": "&", | ||
"address": "&", | ||
"phone_numbers": "&", | ||
"phone_number_count": "&" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
### Number of Operations: 1 | ||
|
||
1. shift | ||
|
||
### Explanation: | ||
|
||
1. Used shift operation to change key 'name' and 'value' to 'itemName' and 'itemValue' inside items list by iterate over items. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"items": [ | ||
{ | ||
"name": "item1", | ||
"value": 10 | ||
}, | ||
{ | ||
"name": "item2", | ||
"value": 20 | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"items" : [ { | ||
"itemName" : "item1", | ||
"itemValue" : 10 | ||
}, { | ||
"itemName" : "item2", | ||
"itemValue" : 20 | ||
} ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[ | ||
{ | ||
"operation": "shift", | ||
"spec": { | ||
"items": { | ||
"*": { | ||
"name": "items.[#2].itemName", | ||
"value": "items.[#2].itemValue" | ||
} | ||
} | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
### Number of Operations: 2 | ||
|
||
1. modify-overwrite-beta | ||
2. shift | ||
|
||
### Explanation: | ||
|
||
1. Used modify-overwrite-beta operation to concat the firstName,lastName and stored in new field name, also concat the keys from address map (street, city, state, zip) in address key. | ||
|
||
2. Used shift operation to change phones list of object to PhoneNumbers and shifted name and address keys. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"employee": { | ||
"firstName": "John", | ||
"lastName": "Doe", | ||
"address": { | ||
"street": "123 Main St", | ||
"city": "Anytown", | ||
"state": "CA", | ||
"zip": "12345" | ||
}, | ||
"phones": [ | ||
{ | ||
"type": "home", | ||
"number": "555-555-1234" | ||
}, | ||
{ | ||
"type": "work", | ||
"number": "555-555-5678" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name" : "John Doe", | ||
"address" : "123 Main St, Anytown, CA 12345", | ||
"PhoneNumbers" : [ { | ||
"type" : "home", | ||
"number" : "555-555-1234" | ||
}, { | ||
"type" : "work", | ||
"number" : "555-555-5678" | ||
} ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[ | ||
{ | ||
"operation": "modify-overwrite-beta", | ||
"spec": { | ||
"employee": { | ||
"name": "=concat(@(1,firstName),' ',@(1,lastName))", | ||
"address": "=concat(@(0,street),', ',@(0,city),', ',@(0,state),' ',@(0,zip))" | ||
} | ||
} | ||
}, | ||
{ | ||
"operation": "shift", | ||
"spec": { | ||
"employee": { | ||
"name": "name", | ||
"address": "address", | ||
"phones": "PhoneNumbers" | ||
} | ||
} | ||
} | ||
] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be total instead of newprice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected the output and changed the name to total instead of newprice.