当前位置:

代写Executor、代做Executor设计程序

来源:互联网 编辑:code 时间:2024-04-17


Assignment 3: Executor
Introduction
Welcome to the Executor assignment. This assignment exercises your understanding of an evaluator implementation for WHERE clauses. 

In the Database Management Systems (DBMS), the ability to effectively query and manipulate data is foundational. A pivotal component of querying databases is the WHERE clause, which serves as a filter to select specific data that meets certain conditions. This assignment is designed to deepen your understanding of how DBMS evaluates these conditions, determining whether they are true or false for given data rows. By implementing an evaluator for the WHERE clause, you will gain hands-on experience in parsing and executing conditional logic.
Where Clause
The WHERE clause is a fundamental element of SQL queries that allows for the filtering of records, ensuring that only data satisfying specific conditions is selected, updated, or deleted from a database. It serves as a critical tool for data analysis and management, enabling precise control over the retrieval of information based on defined criteria.

A simplified WHERE clause can include various components:
●Column References: Direct references to the columns of a database table whose values are part of the conditions being evaluated.
●Constants: Fixed values against which column values are compared.
●Arithmetic Operations: Basic mathematical operations (addition, subtraction, multiplication, division) that can be performed on column values or constants within the condition.
●Logical Operators: Operators such as AND, OR, and NOT that are used to combine multiple conditions or negate a condition, respectively.
●Pattern Matching: Utilization of patterns (often with the LIKE operator) for matching string values according to a specified format.
●BETWEEN: A condition that checks if a column's value falls within a specified range.
●IN: A condition that checks if a column's value matches any value within a provided list.
●IS NULL and IS NOT NULL: Conditions that check for null (or missing) values.
●EXISTS: A logical operator that checks for the existence of rows in a subquery (though, for simplicity, subqueries won’t be considered in this assignment).

The WHERE clause is a powerful part of SQL that enhances the flexibility and effectiveness of database operations by allowing for complex and nuanced data querying strategies.

Assignment 3 Requirement
1.Understanding the Existing Code: 
○Download the starter code at https://github.com/dbms-summer-2023/Command_Processor_Layer/tree/Assignment3. 
○Familiarize yourself with the provided C++ starter code. Read the comments on the “testWhere.cpp” to understand how to test the Evaluator class.
○Analyze the structure of ParserTreeNode. It is necessary because you need to traverse an instance of ParseTreeNode when evaluating each node of the tree by your implementation of the Evaluator class.
2.Implement the Evaluate Function: 
○Here is the signature of the method in the Evaluator class you need to implement. It is located in the folder /executor in the starter code.
bool evaluate(ParserTreeNode &node, std::unordered_map<std::string, std::string> &column_name_to_value);

○The provided parameters include a parsed tree, column names and its corresponding values. To simplify the process, column values are always provided as strings[In the production version of CapybaraDB, the method receives Storage Type instead of string.]. And the output is bool type, true or false. Your evaluator is expected to give a correct evaluation of the condition.
○Your implementation of evaluate() function in Evaluator class should cover the following:
i.Identify column names and find their values
ii.Comparison operators: =, >, <, >=, <=, <>
iii.Logical operators: AND, OR, NOT
iv.Range operators: BETWEEN ... AND …
v.List operators: IN (list)
○Your implementation of evaluate() function in Evaluator class DOES NOT need to cover the following:
i.Any built-in functions, such as UPPER(), GETDATE()
ii.Nullity checks: IS NULL, IS NOT NULL
iii.String operations: first_name || ' ' || last_name
iv.Arithmetic operation: +, -, *, /, %
v.Bitwise Operators: &, |, ^
vi.Pattern matching: LIKE
vii.Any subqueries or nested select statements: WHERE age IN (SELECT age from user_table)
viii.CASE WHEN THEN (ELSE) END
ix.ANY, ALL operators
x.Existence checks: EXISTS

3.Testing and Debugging:
○Take advantage of the 21 test cases provided under `Google_tests/testWhere.cpp` to test your implementation. You can also develop your own test cases.
○There are 27 hidden test cases on Autolab.
Output Examples
●Case 1
○Parsed tree node: WHERE age > 30;
○Values: {age: 31}
○Expected output: true
●Case 2
○Parse tree: WHERE age > 30 AND birth_year BETWEEN 2000 AND 2020;
○Values: {age: 31, birth_year: 1999}
○Expectedutput: false

Submission
In this assignment, you are expected to submit using Autolab. You should submit a "tar", which should contain the evaluator.cpp and evaluator.h.

How to Submit to Autolab:
1.Go to the website https://mvlander.dns.army/courses/18-671/assessments.
2.Use your Andrew email and your name to sign up.

3.Check your email for an activation message and use the access code YATHMX to activate your account.

4.Log in to your Autolab account.

5.Tar your evaluator.cpp and evaluator.h files using the command: tar -cvf <YourAndrewID>_Assignment3.tar evaluator.cpp evaluator.h.
6.Navigate to the assignment submission page.
7.Click on the "Submit" link for Assignment 3.
8.Choose your tarred file and upload it. And you will see the score and feedback

9.You are allowed only 10 attempts.
Rubric
Your assignment will be graded based on the following criteria:
●Correct implementation of the `evaluate`  function;
●Number of Tests passed.

We strongly recommend starting your work locally and submit your Autolab "final version" as early as possible. Don't leave until the last moment to submit your assignment otherwise you may receive a penalty for late submission. This is because building the C++ project on Autolab can be time-consuming, and there is likely to be a high volume of users as the deadline approaches. You can also test your own test cases before attempting the autolab since everyone has only 10 chances.
Good luck and enjoy!

阅读下一篇

返回首页 返回科技