DRILL-3610: Functional tests for TIMESTAMPADD and TIMESTAMPDIFF (#530)

* DRILL-3610: Functional tests for TIMESTAMPADD and TIMESTAMPDIFF functions

- Basic functional tests for TIMESTAMPADD and TIMESTAMPDIFF functions.
- Tests cover different SQL_TSI intervals.

* DRILL 3610: Address review comments, make it self-sufficient
diff --git a/framework/resources/Functional/timestamp_functions/timestamp_functions.json b/framework/resources/Functional/timestamp_functions/timestamp_functions.json
new file mode 100644
index 0000000..cb8c1e0
--- /dev/null
+++ b/framework/resources/Functional/timestamp_functions/timestamp_functions.json
@@ -0,0 +1,26 @@
+{
+  "testId": "timestampadd_timestampdiff_tests",
+  "type": "group",
+  "description": "Tests for TIMESTAMPADD and TIMESTAMPDIFF functions",
+  "categories": [
+    "functional"
+  ],
+  "matrices": [
+    {
+      "query-file": ".*.sql",
+      "schema": "dfs.drilltestdirtpch01parquet",
+      "output-format": "tsv",
+      "expected-file": ".*.e_tsv",
+      "verification-type": [
+        "in-memory"
+      ]
+    }
+  ],
+  "datasources": [
+    {
+      "mode": "cp",
+      "src": "Datasources/Tpch0.01/parquet/orders.parquet",
+      "dest": "Tpch0.01/parquet/orders/orders.parquet"
+    }
+  ]
+}
\ No newline at end of file
diff --git a/framework/resources/Functional/timestamp_functions/timestampadd_diff_day_week.e_tsv b/framework/resources/Functional/timestamp_functions/timestampadd_diff_day_week.e_tsv
new file mode 100644
index 0000000..d8263ee
--- /dev/null
+++ b/framework/resources/Functional/timestamp_functions/timestampadd_diff_day_week.e_tsv
@@ -0,0 +1 @@
+2
\ No newline at end of file
diff --git a/framework/resources/Functional/timestamp_functions/timestampadd_diff_day_week.sql b/framework/resources/Functional/timestamp_functions/timestampadd_diff_day_week.sql
new file mode 100644
index 0000000..5be7c87
--- /dev/null
+++ b/framework/resources/Functional/timestamp_functions/timestampadd_diff_day_week.sql
@@ -0,0 +1,6 @@
+SELECT
+  TIMESTAMPDIFF(SQL_TSI_WEEK, CAST(TIMESTAMPADD(SQL_TSI_DAY, -DAYOFMONTH(o_orderdate), o_orderdate) AS DATE), o_orderdate) AS week_diff
+FROM
+  orders
+WHERE
+  o_orderkey = 3;
\ No newline at end of file
diff --git a/framework/resources/Functional/timestamp_functions/timestampadd_diff_minute_hour.e_tsv b/framework/resources/Functional/timestamp_functions/timestampadd_diff_minute_hour.e_tsv
new file mode 100644
index 0000000..9a03714
--- /dev/null
+++ b/framework/resources/Functional/timestamp_functions/timestampadd_diff_minute_hour.e_tsv
@@ -0,0 +1 @@
+10
\ No newline at end of file
diff --git a/framework/resources/Functional/timestamp_functions/timestampadd_diff_minute_hour.sql b/framework/resources/Functional/timestamp_functions/timestampadd_diff_minute_hour.sql
new file mode 100644
index 0000000..9e25393
--- /dev/null
+++ b/framework/resources/Functional/timestamp_functions/timestampadd_diff_minute_hour.sql
@@ -0,0 +1,6 @@
+SELECT
+   TIMESTAMPDIFF(SQL_TSI_HOUR, CAST(TIMESTAMPADD(SQL_TSI_MINUTE, -600, CAST(o_orderdate AS TIMESTAMP)) AS TIMESTAMP), CAST(o_orderdate AS TIMESTAMP)) AS num_of_hours
+FROM
+  orders
+WHERE
+  o_orderkey = 3;
\ No newline at end of file
diff --git a/framework/resources/Functional/timestamp_functions/timestampadd_diff_month.e_tsv b/framework/resources/Functional/timestamp_functions/timestampadd_diff_month.e_tsv
new file mode 100644
index 0000000..3f10ffe
--- /dev/null
+++ b/framework/resources/Functional/timestamp_functions/timestampadd_diff_month.e_tsv
@@ -0,0 +1 @@
+15
\ No newline at end of file
diff --git a/framework/resources/Functional/timestamp_functions/timestampadd_diff_month.sql b/framework/resources/Functional/timestamp_functions/timestampadd_diff_month.sql
new file mode 100644
index 0000000..aeff230
--- /dev/null
+++ b/framework/resources/Functional/timestamp_functions/timestampadd_diff_month.sql
@@ -0,0 +1,6 @@
+SELECT
+  TIMESTAMPDIFF(SQL_TSI_MONTH, CAST(TIMESTAMPADD(SQL_TSI_MONTH, -15, o_orderdate) AS DATE), o_orderdate) AS num_of_months
+FROM
+  orders
+WHERE
+  o_orderkey = 1;
\ No newline at end of file
diff --git a/framework/resources/Functional/timestamp_functions/timestampadd_diff_quarter.e_tsv b/framework/resources/Functional/timestamp_functions/timestampadd_diff_quarter.e_tsv
new file mode 100644
index 0000000..301160a
--- /dev/null
+++ b/framework/resources/Functional/timestamp_functions/timestampadd_diff_quarter.e_tsv
@@ -0,0 +1 @@
+8
\ No newline at end of file
diff --git a/framework/resources/Functional/timestamp_functions/timestampadd_diff_quarter.sql b/framework/resources/Functional/timestamp_functions/timestampadd_diff_quarter.sql
new file mode 100644
index 0000000..4b3666a
--- /dev/null
+++ b/framework/resources/Functional/timestamp_functions/timestampadd_diff_quarter.sql
@@ -0,0 +1,6 @@
+SELECT
+  TIMESTAMPDIFF(SQL_TSI_QUARTER, CAST(TIMESTAMPADD(SQL_TSI_QUARTER, -8, o_orderdate) AS DATE), o_orderdate) AS num_of_quarters
+FROM
+  orders
+WHERE
+  o_orderkey = 1;
\ No newline at end of file
diff --git a/framework/resources/Functional/timestamp_functions/timestampadd_diff_second_hour.e_tsv b/framework/resources/Functional/timestamp_functions/timestampadd_diff_second_hour.e_tsv
new file mode 100644
index 0000000..0605667
--- /dev/null
+++ b/framework/resources/Functional/timestamp_functions/timestampadd_diff_second_hour.e_tsv
@@ -0,0 +1 @@
+-2
\ No newline at end of file
diff --git a/framework/resources/Functional/timestamp_functions/timestampadd_diff_second_hour.sql b/framework/resources/Functional/timestamp_functions/timestampadd_diff_second_hour.sql
new file mode 100644
index 0000000..f6de436
--- /dev/null
+++ b/framework/resources/Functional/timestamp_functions/timestampadd_diff_second_hour.sql
@@ -0,0 +1,6 @@
+SELECT
+   TIMESTAMPDIFF(SQL_TSI_HOUR, CAST(TIMESTAMPADD(SQL_TSI_SECOND, 7200, CAST(o_orderdate AS TIMESTAMP)) AS TIMESTAMP), CAST(o_orderdate AS TIMESTAMP)) AS num_of_hours
+FROM
+  orders
+WHERE
+  o_orderkey = 3;
\ No newline at end of file
diff --git a/framework/resources/Functional/timestamp_functions/timestampadd_diff_year.e_tsv b/framework/resources/Functional/timestamp_functions/timestampadd_diff_year.e_tsv
new file mode 100644
index 0000000..6f9c2b2
--- /dev/null
+++ b/framework/resources/Functional/timestamp_functions/timestampadd_diff_year.e_tsv
@@ -0,0 +1 @@
+-8
\ No newline at end of file
diff --git a/framework/resources/Functional/timestamp_functions/timestampadd_diff_year.sql b/framework/resources/Functional/timestamp_functions/timestampadd_diff_year.sql
new file mode 100644
index 0000000..b24bb9e
--- /dev/null
+++ b/framework/resources/Functional/timestamp_functions/timestampadd_diff_year.sql
@@ -0,0 +1,6 @@
+SELECT
+  TIMESTAMPDIFF(SQL_TSI_YEAR, CAST(TIMESTAMPADD(SQL_TSI_YEAR, 8, o_orderdate) AS DATE), o_orderdate) AS num_of_years
+FROM
+  orders
+WHERE
+  o_orderkey = 1;
\ No newline at end of file