Compare commits
5 Commits
c254894a1e
...
517dfc465f
Author | SHA1 | Date | |
---|---|---|---|
517dfc465f | |||
fb29391b17 | |||
e61ab45990 | |||
f6c083ac43 | |||
ccd86519ff |
@ -80,6 +80,8 @@ and sign =
|
|||||||
| Times
|
| Times
|
||||||
| Divide
|
| Divide
|
||||||
|
|
||||||
|
|
||||||
|
(* pp = pretty print *)
|
||||||
let rec pp_query fmt ast =
|
let rec pp_query fmt ast =
|
||||||
match ast with
|
match ast with
|
||||||
| Select(cols, table_exp) -> Format.fprintf fmt "%s" (String.cat "SELECT " (pp_columns cols) ^ pp_table_expression table_exp)
|
| Select(cols, table_exp) -> Format.fprintf fmt "%s" (String.cat "SELECT " (pp_columns cols) ^ pp_table_expression table_exp)
|
||||||
|
@ -215,6 +215,7 @@ column_reference:
|
|||||||
|
|
||||||
set_function_specification:
|
set_function_specification:
|
||||||
| aggregate_function { $1 }
|
| aggregate_function { $1 }
|
||||||
|
(* | grouping_function { $1 } *)
|
||||||
|
|
||||||
(*********************************)
|
(*********************************)
|
||||||
|
|
||||||
|
@ -6,8 +6,14 @@
|
|||||||
(name test_logical_plan)
|
(name test_logical_plan)
|
||||||
(libraries ast logical_plan alcotest))
|
(libraries ast logical_plan alcotest))
|
||||||
|
|
||||||
|
(test
|
||||||
|
(name test_csv)
|
||||||
|
(libraries csv ast logical_plan alcotest)
|
||||||
|
(deps
|
||||||
|
(file ./files/csv/data.csv)))
|
||||||
|
|
||||||
(test
|
(test
|
||||||
(name test_parquet)
|
(name test_parquet)
|
||||||
(libraries parquet)
|
(libraries parquet)
|
||||||
(deps
|
(deps
|
||||||
(file ./files/parquet/mock_data.parquet)))
|
(file ./files/parquet/data.parquet)))
|
||||||
|
11
test/files/csv/data.csv
Normal file
11
test/files/csv/data.csv
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
id,name,age,email,city
|
||||||
|
1,Alice,30,alice@example.com,New York
|
||||||
|
2,Bob,25,bob@example.com,Los Angeles
|
||||||
|
3,Charlie,35,charlie@example.com,Chicago
|
||||||
|
4,David,28,david@example.com,Houston
|
||||||
|
5,Eve,29,eve@example.com,Phoenix
|
||||||
|
6,Frank,40,frank@example.com,Philadelphia
|
||||||
|
7,Grace,32,grace@example.com,San Antonio
|
||||||
|
8,Heidi,27,heidi@example.com,San Diego
|
||||||
|
9,Ivan,31,ivan@example.com,Dallas
|
||||||
|
10,Judy,34,judy@example.com,San Jose
|
|
@ -411,6 +411,10 @@ let test_aggregates () =
|
|||||||
let ast1 =
|
let ast1 =
|
||||||
Select(
|
Select(
|
||||||
[
|
[
|
||||||
|
Column(
|
||||||
|
Ref("function"),
|
||||||
|
None
|
||||||
|
)
|
||||||
],
|
],
|
||||||
TableExpression(
|
TableExpression(
|
||||||
Some(
|
Some(
|
||||||
|
23
test/test_csv.ml
Normal file
23
test/test_csv.ml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
open Csv
|
||||||
|
open Alcotest
|
||||||
|
|
||||||
|
(* Function to read CSV file *)
|
||||||
|
let read_csv filename =
|
||||||
|
let ic = open_in filename in
|
||||||
|
let csv = Csv.load_in ic in
|
||||||
|
csv
|
||||||
|
|
||||||
|
(* Test to check if the CSV file is read correctly *)
|
||||||
|
let test_read_csv () =
|
||||||
|
let csv_data = read_csv "files/csv/data.csv" in
|
||||||
|
let nb_columns = Csv.columns csv_data in
|
||||||
|
check int "Number of columns" nb_columns 5
|
||||||
|
|
||||||
|
|
||||||
|
(* Run the test *)
|
||||||
|
let () =
|
||||||
|
run "CSV Tests" [
|
||||||
|
"Read CSV", [
|
||||||
|
test_case "Read and validate CSV" `Quick test_read_csv
|
||||||
|
]
|
||||||
|
]
|
@ -1,7 +1,7 @@
|
|||||||
open Parquet
|
open Parquet
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
let path = "files/parquet/mock_data.parquet" in
|
let path = "files/parquet/data.parquet" in
|
||||||
let ic = open_in path in
|
let ic = open_in path in
|
||||||
assert(parquet_check_prefix ic = true);
|
assert(parquet_check_prefix ic = true);
|
||||||
assert(parquet_check_suffix ic = true)
|
assert(parquet_check_suffix ic = true)
|
||||||
|
Loading…
Reference in New Issue
Block a user