0
0
Hadoopdata~10 mins

LOAD, FILTER, and STORE operations in Hadoop - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to load data from the file 'input.txt'.

Hadoop
data = LOAD '[1]';
Drag options to blanks, or click blank then click option'
A'data.csv'
B'output.txt'
C'input.txt'
D'logfile.log'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong file name in LOAD.
Forgetting to put quotes around the file name.
2fill in blank
medium

Complete the code to filter records where the age field is greater than 30.

Hadoop
filtered_data = FILTER data BY [1] > 30;
Drag options to blanks, or click blank then click option'
Aage
Bdate
Csalary
Dname
Attempts:
3 left
💡 Hint
Common Mistakes
Filtering by a field that does not exist or is not numeric.
Using the wrong field name.
3fill in blank
hard

Fix the error in the code to store the filtered data into 'output.txt'.

Hadoop
STORE filtered_data INTO [1];
Drag options to blanks, or click blank then click option'
Ainput.txt
B'output.txt'
Cfiltered_data
D'input.txt'
Attempts:
3 left
💡 Hint
Common Mistakes
Not putting quotes around the file name.
Using the input file name instead of the output file name.
4fill in blank
hard

Fill both blanks to load data from 'data.csv' and filter records where salary is less than 50000.

Hadoop
data = LOAD [1];
filtered = FILTER data BY [2] < 50000;
Drag options to blanks, or click blank then click option'
A'data.csv'
Bsalary
Cage
D'input.txt'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up file names.
Filtering by the wrong field.
5fill in blank
hard

Fill all three blanks to load 'records.txt', filter where date equals '2023-01-01', and store the result in 'filtered.txt'.

Hadoop
data = LOAD [1];
filtered = FILTER data BY [2] == [3];
STORE filtered INTO 'filtered.txt';
Drag options to blanks, or click blank then click option'
A'records.txt'
Bdate
C'2023-01-01'
D'data.csv'
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting file names or string values.
Using the wrong field name for filtering.