-
Notifications
You must be signed in to change notification settings - Fork 137
Add TPC-H to sqllogictests #6830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
d403993
82cefaf
1625151
85fe753
623c24d
b9f1d55
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -253,6 +253,9 @@ impl<'a> TryFrom<&'a ValueRef> for Scalar { | |
| ExtractedValue::HugeInt(_) => { | ||
| vortex_bail!("DuckDB HugeInt is not yet supported in Vortex"); | ||
| } | ||
| ExtractedValue::UHugeInt(_) => { | ||
| vortex_bail!("DuckDB UHugeInt is not yet supported in Vortex"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this u128 int? We might add this soon. Good to know duckdb has it
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah duckdb seems to have both |
||
| } | ||
| ExtractedValue::UTinyInt(v) => Ok(Scalar::primitive(v, Nullable)), | ||
| ExtractedValue::USmallInt(v) => Ok(Scalar::primitive(v, Nullable)), | ||
| ExtractedValue::UInteger(v) => Ok(Scalar::primitive(v, Nullable)), | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,6 +59,10 @@ impl ValueRef { | |
| DUCKDB_TYPE::DUCKDB_TYPE_BIGINT => { | ||
| ExtractedValue::BigInt(unsafe { cpp::duckdb_get_int64(self.as_ptr()) }) | ||
| } | ||
| DUCKDB_TYPE::DUCKDB_TYPE_HUGEINT => { | ||
| let huge_int = unsafe { cpp::duckdb_get_hugeint(self.as_ptr()) }; | ||
| ExtractedValue::HugeInt(i128_from_parts(huge_int.upper, huge_int.lower)) | ||
| } | ||
| DUCKDB_TYPE::DUCKDB_TYPE_UTINYINT => { | ||
| ExtractedValue::UTinyInt(unsafe { cpp::duckdb_get_uint8(self.as_ptr()) }) | ||
| } | ||
|
|
@@ -71,6 +75,10 @@ impl ValueRef { | |
| DUCKDB_TYPE::DUCKDB_TYPE_UBIGINT => { | ||
| ExtractedValue::UBigInt(unsafe { cpp::duckdb_get_uint64(self.as_ptr()) }) | ||
| } | ||
| DUCKDB_TYPE::DUCKDB_TYPE_UHUGEINT => { | ||
| let huge_uint = unsafe { cpp::duckdb_get_uhugeint(self.as_ptr()) }; | ||
| ExtractedValue::UHugeInt(u128_from_parts(huge_uint.upper, huge_uint.lower)) | ||
| } | ||
| DUCKDB_TYPE::DUCKDB_TYPE_FLOAT => { | ||
| ExtractedValue::Float(unsafe { cpp::duckdb_get_float(self.as_ptr()) }) | ||
| } | ||
|
|
@@ -149,7 +157,7 @@ impl ValueRef { | |
| .collect::<Vec<_>>(), | ||
| ), | ||
| // ...other types remain unimplemented.. | ||
| _ => vortex_panic!("Unsupported DuckDB value type {:?}", self), | ||
| other => vortex_panic!("Unsupported DuckDB value type {other:?}"), | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -264,6 +272,11 @@ pub fn i128_from_parts(high: i64, low: u64) -> i128 { | |
| ((high as i128) << 64) | (low as i128) | ||
| } | ||
|
|
||
| #[inline] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe worth defining in #[tests]?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We use it in |
||
| pub fn u128_from_parts(high: u64, low: u64) -> u128 { | ||
| ((high as u128) << 64) | (low as u128) | ||
| } | ||
|
|
||
| impl<T> TryFrom<Option<T>> for Value | ||
| where | ||
| T: Into<Value> + NativeDType, | ||
|
|
@@ -376,6 +389,7 @@ pub enum ExtractedValue { | |
| USmallInt(u16), | ||
| UInteger(u32), | ||
| UBigInt(u64), | ||
| UHugeInt(u128), | ||
| Float(f32), | ||
| Double(f64), | ||
| Boolean(bool), | ||
|
|
@@ -394,6 +408,7 @@ pub enum ExtractedValue { | |
| #[cfg(test)] | ||
| mod tests { | ||
| use crate::duckdb::i128_from_parts; | ||
| use crate::duckdb::u128_from_parts; | ||
|
|
||
| #[test] | ||
| fn test_huge_int_from_parts() { | ||
|
|
@@ -408,4 +423,17 @@ mod tests { | |
| (1i128 << 64) + (u64::MAX as i128) | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn test_uhuge_int_from_parts() { | ||
| assert_eq!(u128_from_parts(0, 0), 0u128); | ||
| assert_eq!(u128_from_parts(0, 34534912), 34534912u128); | ||
| assert_eq!(u128_from_parts(0, u64::MAX), u64::MAX as u128); | ||
| assert_eq!(u128_from_parts(u64::MAX, u64::MAX), u128::MAX); | ||
| assert_eq!( | ||
| u128_from_parts(1, u64::MAX), | ||
| (1u128 << 64) + (u64::MAX as u128) | ||
| ); | ||
| assert_eq!(u128_from_parts(1, 0), 1u128 << 64); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /data |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # SPDX-FileCopyrightText: Copyright the Vortex contributors | ||
|
|
||
| statement ok | ||
| CREATE EXTERNAL TABLE IF NOT EXISTS supplier ( | ||
| s_suppkey BIGINT, | ||
| s_name VARCHAR, | ||
| s_address VARCHAR, | ||
| s_nationkey BIGINT, | ||
| s_phone VARCHAR, | ||
| s_acctbal DECIMAL(15, 2), | ||
| s_comment VARCHAR, | ||
| s_rev VARCHAR, | ||
| ) STORED AS VORTEX | ||
| LOCATION 'slt/tpch/data/supplier.vortex'; | ||
|
|
||
| statement ok | ||
| CREATE EXTERNAL TABLE IF NOT EXISTS part ( | ||
| p_partkey BIGINT, | ||
| p_name VARCHAR, | ||
| p_mfgr VARCHAR, | ||
| p_brand VARCHAR, | ||
| p_type VARCHAR, | ||
| p_size INTEGER, | ||
| p_container VARCHAR, | ||
| p_retailprice DECIMAL(15, 2), | ||
| p_comment VARCHAR, | ||
| p_rev VARCHAR, | ||
| ) STORED AS VORTEX | ||
| LOCATION 'slt/tpch/data/part.vortex'; | ||
|
|
||
|
|
||
| statement ok | ||
| CREATE EXTERNAL TABLE IF NOT EXISTS partsupp ( | ||
| ps_partkey BIGINT, | ||
| ps_suppkey BIGINT, | ||
| ps_availqty INTEGER, | ||
| ps_supplycost DECIMAL(15, 2), | ||
| ps_comment VARCHAR, | ||
| ps_rev VARCHAR, | ||
| ) STORED AS VORTEX | ||
| LOCATION 'slt/tpch/data/partsupp.vortex'; | ||
|
|
||
| statement ok | ||
| CREATE EXTERNAL TABLE IF NOT EXISTS customer ( | ||
| c_custkey BIGINT, | ||
| c_name VARCHAR, | ||
| c_address VARCHAR, | ||
| c_nationkey BIGINT, | ||
| c_phone VARCHAR, | ||
| c_acctbal DECIMAL(15, 2), | ||
| c_mktsegment VARCHAR, | ||
| c_comment VARCHAR, | ||
| c_rev VARCHAR, | ||
| ) STORED AS VORTEX | ||
| LOCATION 'slt/tpch/data/customer.vortex'; | ||
|
|
||
| statement ok | ||
| CREATE EXTERNAL TABLE IF NOT EXISTS orders ( | ||
| o_orderkey BIGINT, | ||
| o_custkey BIGINT, | ||
| o_orderstatus VARCHAR, | ||
| o_totalprice DECIMAL(15, 2), | ||
| o_orderdate DATE, | ||
| o_orderpriority VARCHAR, | ||
| o_clerk VARCHAR, | ||
| o_shippriority INTEGER, | ||
| o_comment VARCHAR, | ||
| o_rev VARCHAR, | ||
| ) STORED AS VORTEX | ||
| LOCATION 'slt/tpch/data/orders.vortex'; | ||
|
|
||
| statement ok | ||
| CREATE EXTERNAL TABLE IF NOT EXISTS lineitem ( | ||
| l_orderkey BIGINT, | ||
| l_partkey BIGINT, | ||
| l_suppkey BIGINT, | ||
| l_linenumber INTEGER, | ||
| l_quantity DECIMAL(15, 2), | ||
| l_extendedprice DECIMAL(15, 2), | ||
| l_discount DECIMAL(15, 2), | ||
| l_tax DECIMAL(15, 2), | ||
| l_returnflag VARCHAR, | ||
| l_linestatus VARCHAR, | ||
| l_shipdate DATE, | ||
| l_commitdate DATE, | ||
| l_receiptdate DATE, | ||
| l_shipinstruct VARCHAR, | ||
| l_shipmode VARCHAR, | ||
| l_comment VARCHAR, | ||
| l_rev VARCHAR, | ||
| ) STORED AS VORTEX | ||
| LOCATION 'slt/tpch/data/lineitem.vortex'; | ||
|
|
||
| statement ok | ||
| CREATE EXTERNAL TABLE IF NOT EXISTS nation ( | ||
| n_nationkey BIGINT, | ||
| n_name VARCHAR, | ||
| n_regionkey BIGINT, | ||
| n_comment VARCHAR, | ||
| n_rev VARCHAR, | ||
| ) STORED AS VORTEX | ||
| LOCATION 'slt/tpch/data/nation.vortex'; | ||
|
|
||
| statement ok | ||
| CREATE EXTERNAL TABLE IF NOT EXISTS region ( | ||
| r_regionkey BIGINT, | ||
| r_name VARCHAR, | ||
| r_comment VARCHAR, | ||
| r_rev VARCHAR, | ||
| ) STORED AS VORTEX | ||
| LOCATION 'slt/tpch/data/region.vortex'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # SPDX-FileCopyrightText: Copyright the Vortex contributors | ||
|
|
||
| include ../../setup.slt | ||
|
|
||
|
|
||
| include ./create.slt.no | ||
|
|
||
| include ../results/*.slt.no | ||
| # include ../drop.slt.no |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # SPDX-FileCopyrightText: Copyright the Vortex contributors | ||
|
|
||
| statement ok | ||
| DROP TABLE supplier; | ||
|
|
||
| statement ok | ||
| DROP TABLE region; | ||
|
|
||
| statement ok | ||
| DROP TABLE nation; | ||
|
|
||
| statement ok | ||
| DROP TABLE lineitem; | ||
|
|
||
| statement ok | ||
| DROP TABLE orders; | ||
|
|
||
| statement ok | ||
| DROP TABLE customer; | ||
|
|
||
| statement ok | ||
| DROP TABLE partsupp; | ||
|
|
||
| statement ok | ||
| DROP TABLE part; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We set up uv to upload coverage results, worth removing it from there to avoid duplicate installation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a different job IMO, runs on a different machine