Bird
Raised Fist0
Hadoopdata~10 mins

Hive architecture in Hadoop - Interactive Code Practice

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

Complete the code to create a Hive table named 'employees'.

Hadoop
CREATE TABLE employees (id INT, name STRING, department STRING, salary INT) [1];
Drag options to blanks, or click blank then click option'
ASTORED AS TEXTFILE
BDROP TABLE employees
CWHERE id > 10
DSELECT * FROM employees
Attempts:
3 left
💡 Hint
Common Mistakes
Using SELECT or WHERE clauses in CREATE TABLE statement
Forgetting to specify storage format
2fill in blank
medium

Complete the code to load data from HDFS path '/data/employees.txt' into the Hive table 'employees'.

Hadoop
LOAD DATA INPATH '[1]' INTO TABLE employees;
Drag options to blanks, or click blank then click option'
A/user/hive/warehouse/employees
B/data/employees.json
C/tmp/employees.csv
D/data/employees.txt
Attempts:
3 left
💡 Hint
Common Mistakes
Using a directory path instead of the file path
Using a path that does not exist in HDFS
3fill in blank
hard

Fix the error in the Hive query to select all employees with id greater than 100.

Hadoop
SELECT * FROM employees WHERE id [1] 100;
Drag options to blanks, or click blank then click option'
A=
B>
C<
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>'
Using '=' which selects only id equal to 100
4fill in blank
hard

Fill both blanks to create a Hive query that counts employees grouped by department.

Hadoop
SELECT [1], COUNT(*) [2] employees GROUP BY [1];
Drag options to blanks, or click blank then click option'
Adepartment
BFROM
CWHERE
Demployees
Attempts:
3 left
💡 Hint
Common Mistakes
Using WHERE instead of FROM
Not grouping by the selected column
5fill in blank
hard

Fill all three blanks to create a Hive query that selects employee names and salaries where salary is greater than 50000.

Hadoop
SELECT [1], [2] FROM employees WHERE [3] > 50000;
Drag options to blanks, or click blank then click option'
Aname
Bsalary
Did
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting wrong columns
Using incorrect column in WHERE clause

Practice

(1/5)
1. What is the main role of the Hive Metastore in Hive architecture?
easy
A. It stores the actual data files in HDFS
B. It executes the SQL queries on Hadoop data
C. It manages user authentication and security
D. It stores metadata about tables and partitions

Solution

  1. Step 1: Understand the components of Hive architecture

    Hive architecture includes Metastore, Driver, Compiler, Execution Engine, and HDFS storage.
  2. Step 2: Identify the role of Metastore

    The Metastore stores metadata like table definitions, schema, and partition info, not the actual data.
  3. Final Answer:

    It stores metadata about tables and partitions -> Option D
  4. Quick Check:

    Metastore = Metadata storage [OK]
Hint: Metastore always holds metadata, not data itself [OK]
Common Mistakes:
  • Confusing Metastore with data storage
  • Thinking Metastore runs queries
  • Mixing Metastore with security management
2. Which of the following is the correct sequence of components involved when a Hive query is executed?
easy
A. Driver -> Compiler -> Metastore -> Execution Engine
B. Compiler -> Driver -> Execution Engine -> Metastore
C. Driver -> Compiler -> Execution Engine -> Metastore
D. Metastore -> Driver -> Compiler -> Execution Engine

Solution

  1. Step 1: Recall the Hive query execution flow

    The Driver receives the query, then the Compiler parses and plans it.
  2. Step 2: Understand component order

    The Compiler consults the Metastore for metadata, then the Execution Engine runs the tasks.
  3. Final Answer:

    Driver -> Compiler -> Metastore -> Execution Engine -> Option A
  4. Quick Check:

    Execution flow = Driver, Compiler, Metastore, Execution Engine [OK]
Hint: Driver starts, Compiler plans, Metastore provides metadata, then Execution Engine runs [OK]
Common Mistakes:
  • Mixing order of Compiler and Driver
  • Placing Metastore after Execution Engine
  • Ignoring Metastore's role in query planning
3. Given the following Hive query execution steps, which component is responsible for converting the query into a directed acyclic graph (DAG) of tasks?
SELECT * FROM sales WHERE year = 2023;
medium
A. Driver
B. Metastore
C. Compiler
D. Execution Engine

Solution

  1. Step 1: Identify the role of Compiler in Hive

    The Compiler parses the query and creates a logical plan, then converts it into a DAG of tasks.
  2. Step 2: Differentiate from other components

    The Driver manages the session, Metastore stores metadata, and Execution Engine runs the DAG tasks.
  3. Final Answer:

    Compiler -> Option C
  4. Quick Check:

    Compiler creates DAG = C [OK]
Hint: Compiler turns query into task graph (DAG) [OK]
Common Mistakes:
  • Thinking Driver creates the DAG
  • Confusing Metastore with query planning
  • Assuming Execution Engine creates the DAG
4. A Hive query fails with an error saying metadata not found for a table. Which component is most likely causing this error?
medium
A. Metastore
B. Compiler
C. Driver
D. Execution Engine

Solution

  1. Step 1: Understand the error context

    Metadata not found means Hive cannot find table schema or info.
  2. Step 2: Identify responsible component

    The Metastore stores all metadata; if missing, it causes this error.
  3. Final Answer:

    Metastore -> Option A
  4. Quick Check:

    Metadata error = Metastore issue [OK]
Hint: Metadata errors point to Metastore problems [OK]
Common Mistakes:
  • Blaming Execution Engine for metadata errors
  • Confusing Driver with metadata storage
  • Assuming Compiler handles metadata retrieval
5. You want to optimize Hive query execution by reducing the number of MapReduce jobs. Which Hive architecture component should you focus on tuning or configuring?
hard
A. Metastore
B. Execution Engine
C. Driver
D. Compiler

Solution

  1. Step 1: Identify which component runs jobs

    The Execution Engine runs the MapReduce or Tez jobs generated by Hive.
  2. Step 2: Understand optimization target

    Reducing jobs means tuning Execution Engine settings or choosing efficient engines like Tez or Spark.
  3. Final Answer:

    Execution Engine -> Option B
  4. Quick Check:

    Job optimization = Execution Engine tuning [OK]
Hint: Tune Execution Engine to reduce jobs and improve speed [OK]
Common Mistakes:
  • Trying to optimize Metastore for job count
  • Confusing Driver with job execution
  • Ignoring Execution Engine's role in running jobs
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard