Skip to content

Commit 654d11b

Browse files
committed
move functions.rs to sqllogictests
1 parent 1a1efcf commit 654d11b

File tree

3 files changed

+87
-145
lines changed

3 files changed

+87
-145
lines changed

datafusion/core/tests/sql/functions.rs

Lines changed: 0 additions & 143 deletions
This file was deleted.

datafusion/core/tests/sql/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ pub mod arrow_files;
8484
pub mod create_drop;
8585
pub mod explain_analyze;
8686
pub mod expr;
87-
pub mod functions;
8887
pub mod group_by;
8988
pub mod joins;
9089
pub mod limit;

datafusion/core/tests/sqllogictests/test_files/functions.slt

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,4 +479,90 @@ SELECT struct(c1,c2,c3,c4,a,b) from simple_struct_test
479479
{c0: 1, c1: 1, c2: 3.1, c3: 3.14, c4: str, c5: text}
480480

481481
statement ok
482-
drop table simple_struct_test
482+
drop table simple_struct_test
483+
484+
# create aggregate_test_100 table for functions test
485+
statement ok
486+
CREATE EXTERNAL TABLE aggregate_test_100 (
487+
c1 VARCHAR NOT NULL,
488+
c2 TINYINT NOT NULL,
489+
c3 SMALLINT NOT NULL,
490+
c4 SMALLINT,
491+
c5 INT,
492+
c6 BIGINT NOT NULL,
493+
c7 SMALLINT NOT NULL,
494+
c8 INT NOT NULL,
495+
c9 BIGINT UNSIGNED NOT NULL,
496+
c10 VARCHAR NOT NULL,
497+
c11 FLOAT NOT NULL,
498+
c12 DOUBLE NOT NULL,
499+
c13 VARCHAR NOT NULL
500+
)
501+
STORED AS CSV
502+
WITH HEADER ROW
503+
LOCATION '../../testing/data/csv/aggregate_test_100.csv'
504+
505+
506+
# sqrt_f32_vs_f64
507+
query R
508+
SELECT avg(sqrt(c11)) FROM aggregate_test_100
509+
----
510+
0.658440848589
511+
512+
query R
513+
SELECT avg(CAST(sqrt(c11) AS double)) FROM aggregate_test_100
514+
----
515+
0.658440848589
516+
517+
query R
518+
SELECT avg(sqrt(CAST(c11 AS double))) FROM aggregate_test_100
519+
----
520+
0.658440848342
521+
522+
statement ok
523+
drop table aggregate_test_100
524+
525+
526+
# case_sensitive_identifiers_functions
527+
statement ok
528+
create table t as values (
529+
arrow_cast(2, 'Int8'),
530+
arrow_cast(2, 'Int16'),
531+
arrow_cast(2, 'Int32'),
532+
arrow_cast(2, 'Int64'),
533+
arrow_cast(2, 'UInt8'),
534+
arrow_cast(2, 'UInt16'),
535+
arrow_cast(2, 'UInt32'),
536+
arrow_cast(2, 'UInt64'),
537+
arrow_cast(2, 'Float32'),
538+
arrow_cast(2, 'Float64')
539+
)
540+
;
541+
542+
query R
543+
SELECT sqrt(column1) FROM t
544+
----
545+
1.414213562373
546+
547+
query R
548+
SELECT SQRT(column1) FROM t
549+
----
550+
1.414213562373
551+
552+
statement error Error during planning: Invalid function 'SQRT'
553+
SELECT "SQRT"(column1) FROM t
554+
555+
query R
556+
SELECT "sqrt"(column1) FROM t
557+
----
558+
1.414213562373
559+
560+
# case_builtin_math_expression
561+
query RRRRRRRRRR
562+
SELECT sqrt(column1),sqrt(column2),sqrt(column3),sqrt(column4),sqrt(column5),sqrt(column6),sqrt(column7),sqrt(column8),sqrt(column9),sqrt(column10) FROM t
563+
----
564+
1.414213562373 1.414213562373 1.414213562373 1.414213562373 1.414213562373 1.414213562373 1.414213562373 1.414213562373 1.4142135 1.414213562373
565+
566+
statement ok
567+
drop table t
568+

0 commit comments

Comments
 (0)