Skip to content
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

Apurva Shukla- Module 5 #89

Open
wants to merge 45 commits into
base: main
Choose a base branch
from

Conversation

apurvaone
Copy link

Completed: Module 5

Solved all 34 problems

Learnt the following things in the module about Jolt:

  • Json to Json conversion
  • Why Jolt
  • Operators (shift, default, remove, modify-default-beta, modify-overwrite-beta, cardinality, sort)
  • Wildcards (@,&,*,#,|)
  • Levels
  • Advantages and Disadvantages of Jolt

"address": "=concat(@(1,address.street),' ',@(1,address.city), ' ', @(1,address.state), ' ',@(1,address.zip))",
"fullname": "=concat(@(1,firstName),' ',@(1,lastName))"
},
"itemTemp": "@(1,items)"
Copy link

@Nidhipal09 Nidhipal09 Jun 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can be easily done without creating a duplicate of the 'items' list. Please optimize this.

"email": "email",
"address": {
"city": "city",
"zip": "zip"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use & here for all RHS values?

"name": "[#2].Name",
"hobbies": {
"*": {
"name": "[#4].Hobbies"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

& is preferred over # to define levels.

"employees": {
"[0]": {
"bonus": 1000,
"tempBonus": 1000

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be optimized. No need to create a bonus duplicate.

"spec": {
"fullname": "=split(' ',@(2,name))",
"first_name": "=firstElement(@(2,fullname))",
"last_name": "=lastElement(@(2,fullname))",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is giving the desired output but 2 is not the correct level here. Please check.

"employee": {
"name": "&",
"address": "&",
"phones": "&"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the output.

"*": {
"id": "employees.[#2].&",
"name": "employees.[#2].&",
"department": "employees[#2].&",
Copy link

@Nidhipal09 Nidhipal09 Jun 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of wildcards is recommended over manually writing fields. Need to correct this in many other places.

}
},
{
"operation": "sort"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to sort.

"spec": {
"*": "&",
"person-address": {
"*": "person-address-&"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reduce the number of operations.

"operation": "shift",
"spec": {
"employee": {
"name": "&",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect

"*": {
"id": "@(3,id)",
"hobby_name": "@(1,name)",
"hobby_level": "@(1,level)",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be more optimized. Please check.

"Country": "Canada"
},
"[2]": {
"Country": "NA"
Copy link

@Nidhipal09 Nidhipal09 Jun 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indexing is hard coded. Make sure your spec is always loosely written, so that even if there are more fields you don't have to change the approach.

},
"[2]": {
"bonus": 900,
"tempBonus": 900

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this, the bonus is related to the department in some way. You can add that approach also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants