This project implements a custom MapReduce-based query execution engine and compares its performance with a traditional relational database (SQL Server).
The system executes the same SQL query across two fundamentally different paradigms:
- 🔹 Custom MapReduce Engine (Python)
- 🔹 SQL Server Execution Engine
It then collects performance metrics and visualizes them using an interactive dashboard.
To understand and demonstrate:
- How distributed data processing systems (like Hadoop) work internally
- How they compare with optimized relational databases
- The trade-offs in performance, scalability, and execution design
SQL Input
↓
Query Router / Controller
↓ ↓
MapReduce Engine SQL Server
↓ ↓
Execution Pipeline Optimized DB Execution
↓ ↓
Metrics + Comparison Layer
↓
Dashboard (Streamlit)
-
Converts SQL queries into an Intermediate Representation (IR)
-
Supports:
SELECTWHEREGROUP BY- Aggregations:
COUNT,SUM,AVG
Implements a full pipeline:
Split → Map → Shuffle → Reduce
- Partition-based processing
- Reducer distribution
- Simulates parallel data processing
- Executes the same query using SQL Server
- Uses
pyodbcfor database connectivity - Includes a query translation layer for compatibility
Tracks:
- ⏱ Execution time
- ⚡ CPU usage
- 🧠 System specifications
- 📊 Rows processed
- Visual comparison of both engines
- Bar charts for execution time
- System & execution insights
SELECT Score, COUNT(*), SUM(Score), AVG(Score)
FROM data
WHERE Score > 1
GROUP BY Score;Score COUNT SUM AVG
--------------------------------------------------------
1 156804 428892 2.7352
2 89307 166023 1.8590
3 127920 217587 1.7010
4 241965 336402 1.3903
5 1089366 1824936 1.6752
Score COUNT SUM AVG
--------------------------------------------------------
1 156804 428892 2
2 89307 166023 1
3 127920 217587 1
4 241965 336402 1
5 1089366 1824936 1
SQL Server performs integer division in AVG by default, while the custom MapReduce engine computes floating-point averages.
Miniature MAP-REDUCE/
│
├── Data/
│ ├── Processed Data/
│ ├── Raw Data/
│
├── Data Processing Stage/
│ └── processor.ipynb
│
├── Results/
│ ├── metrics.json
│ └── report.txt
│
├── SQL/
│ ├── Queries.sql
│ └── test_cases.sql
│
├── Src/
│ │
│ ├── Analytics/
│ │ ├── __pycache__/
│ │ ├── dashboard.py
│ │ ├── metrics.py
│ │ └── report.py
│ │
│ ├── config/
│ │ ├── __pycache__/
│ │ ├── db_config.py
│ │ ├── paths.py
│ │ └── settings.py
│ │
│ ├── Execution_Engine/
│ │ ├── __pycache__/
│ │ ├── context.py
│ │ └── engine.py
│ │
│ ├── Map_Reduce/
│ │ ├── __pycache__/
│ │ ├── mapper.py
│ │ ├── reducer.py
│ │ ├── shuffle.py
│ │ └── splitter.py
│ │
│ ├── Optimizer/
│ │ ├── __pycache__/
│ │ └── optimizer.py
│ │
│ ├── Parser/
│ │ ├── __pycache__/
│ │ └── sql_parser.py
│ │
│ ├── SQL_Server/
│ │ ├── __pycache__/
│ │ ├── adapter.py
│ │ ├── connection.py
│ │ ├── executor.py
│ │ ├── loader.py
│ │ ├── metrics.py
│ │ └── translator.py
│ │
│ └── Utils/
│ ├── bootstrap.py
│ └── main.py
git clone <https://github.com/RiddhiDhara/Hadoop_Mini_Map_Reduce_Implementation>
cd Miniature MAP-REDUCEpip install -r requirements.txtpython bootstrap.pycd Src
python main.pystreamlit run Analytics/dashboard.pyAll configurations are centralized:
- Partitions
- Reducers
- Threads
- Engine toggles
- CSV path
- SQL query file
- Metrics & report paths
- SQL Server connection details
-
Internals of MapReduce processing
-
Query execution pipeline design
-
Difference between:
- Distributed systems
- Relational databases
-
Performance benchmarking techniques
-
System modularization & architecture
-
SQL Server is faster due to:
- Query optimization
- Execution planning
- Internal indexing
-
MapReduce provides:
- Better conceptual scalability
- Flexibility for distributed environments
- Support for JOIN operations
- Multi-column
GROUP BY - True parallelism using
multiprocessing - Cost-based query optimizer
- Query caching
- Cloud deployment (AWS / Azure)
- Python
- Pandas
- SQL Server
- pyodbc
- Streamlit
This project demonstrates how the same query can be executed across two fundamentally different architectures and compares their performance using real metrics.
Riddhi Dhara
Software Engineer
Give it a ⭐ on GitHub and share your feedback!
