Skip to content

Commit

Permalink
Merge branch 'main' into xxchan/multiple-scan-node
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jul 8, 2022
2 parents 62fafb7 + 17c0417 commit f1022a1
Show file tree
Hide file tree
Showing 34 changed files with 442 additions and 297 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/license_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Check License Header
uses: apache/skywalking-eyes@main
uses: apache/skywalking-eyes/header@main
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion e2e_test/batch/types/interval.slt.part
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,14 @@ t
query T
SELECT interval '1' day - interval '12' hour = interval '12' hour;
----
t
t

query T
SELECT 1.5 * INTERVAL '3 mins';
----
00:04:30

query T
SELECT INTERVAL '3 mins' * 1.5;
----
00:04:30
12 changes: 11 additions & 1 deletion e2e_test/batch/types/time.slt.part
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,14 @@ values(extract(hour from timestamp '2001-02-16 20:38:40'));
query TTTTT
select timestamp '2001-03-16 23:38:45' - timestamp '2001-02-16 20:38:40';
----
28 days 03:00:05
28 days 03:00:05

query T
select TIME '19:46:41' <= TIME '11:33:43';
----
f

query T
select TIME '19:46:41' >= TIME '11:33:43';
----
t
2 changes: 2 additions & 0 deletions e2e_test/streaming/nexmark/create_views.slt.part
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ include ./views/q4.slt.part
include ./views/q5.slt.part
include ./views/q7.slt.part
include ./views/q8.slt.part
include ./views/q10.slt.part
include ./views/q14.slt.part
6 changes: 6 additions & 0 deletions e2e_test/streaming/nexmark/drop_views.slt.part
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ drop materialized view nexmark_q7;

statement ok
drop materialized view nexmark_q8;

statement ok
drop materialized view nexmark_q10;

statement ok
drop materialized view nexmark_q14;
24 changes: 24 additions & 0 deletions e2e_test/streaming/nexmark/q10.slt.part
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
query IIITTT rowsort
select * from nexmark_q10;
----
1000 1001 499920 2015-07-15 00:00:01.001 2015-07-15 12:00
1000 1007 12655 2015-07-15 00:00:01.001 2015-07-15 12:00
1012 1003 19269 2015-07-15 00:00:02.001 2015-07-15 12:00
1000 1001 43672280 2015-07-15 00:03:00.001 2015-07-15 12:03
1000 1010 235 2015-07-15 00:00:04.001 2015-07-15 12:00
1007 1001 242 2015-07-15 00:00:05.002 2015-07-15 12:00
1012 1001 71083760 2015-07-15 00:00:06.002 2015-07-15 12:00
1009 1001 209960 2015-07-15 00:00:07.002 2015-07-15 12:00
1003 1001 89027544 2015-07-15 00:00:08.002 2015-07-15 12:00
1000 1002 322 2015-07-15 00:00:09.002 2015-07-15 12:00
1000 1004 2349 2015-07-15 00:00:10.003 2015-07-15 12:00
1011 1001 5255 2015-07-15 00:00:11.003 2015-07-15 12:00
1000 1001 13982877 2015-07-15 00:00:13.003 2015-07-15 12:00
1001 1001 84935 2015-07-15 00:00:14.003 2015-07-15 12:00
1000 1001 28676694 2015-07-15 00:00:15.003 2015-07-15 12:00
1000 1001 1930913 2015-07-15 00:00:16.004 2015-07-15 12:00
1000 1001 567581 2015-07-15 00:00:16.004 2015-07-15 12:00
1010 1001 213 2015-07-15 00:00:20.004 2015-07-15 12:00
1006 1001 21659600 2015-07-15 00:00:21.004 2015-07-15 12:00
1012 1001 170060 2015-07-15 00:00:22.004 2015-07-15 12:00
1010 1002 2092 2015-07-15 00:00:23.005 2015-07-15 12:00
8 changes: 8 additions & 0 deletions e2e_test/streaming/nexmark/q14.slt.part
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
query IIRTT rowsort
SELECT * FROM nexmark_q14;
----
1000 1001 39654430.240 nightTime 2015-07-15 00:03:00.001
1000 1001 12696452.316 nightTime 2015-07-15 00:00:13.003
1000 1001 26038438.152 nightTime 2015-07-15 00:00:15.003
1000 1001 1753269.004 nightTime 2015-07-15 00:00:16.004
1006 1001 19666916.800 nightTime 2015-07-15 00:00:21.004
3 changes: 3 additions & 0 deletions e2e_test/streaming/nexmark/views/q10.slt.part
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
statement ok
CREATE MATERIALIZED VIEW nexmark_q10 AS
SELECT auction, bidder, price, dateTime, TO_CHAR(dateTime, 'YYYY-MM-DD') as date, TO_CHAR(dateTime, 'HH:MI') as time FROM bid;
24 changes: 24 additions & 0 deletions e2e_test/streaming/nexmark/views/q14.slt.part
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
statement ok
CREATE MATERIALIZED VIEW nexmark_q14 AS
SELECT
auction,
bidder,
0.908 * price as price,
CASE
WHEN
extract(hour from dateTime) >= 8 AND
extract(hour from dateTime) <= 18
THEN 'dayTime'
WHEN
extract(hour from dateTime) <= 6 OR
extract(hour from dateTime) >= 20
THEN 'nightTime'
ELSE 'otherTime'
END AS bidTimeType,
dateTime
-- extra
-- TODO: count_char is an UDF, add it back when we support similar functionality.
-- https://github.com/nexmark/nexmark/blob/master/nexmark-flink/src/main/java/com/github/nexmark/flink/udf/CountChar.java
-- count_char(extra, 'c') AS c_counts
FROM bid
WHERE 0.908 * price > 1000000 AND 0.908 * price < 50000000;
2 changes: 2 additions & 0 deletions e2e_test/streaming/nexmark_snapshot.slt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ include ./nexmark/q4.slt.part
include ./nexmark/q5.slt.part
include ./nexmark/q7.slt.part
include ./nexmark/q8.slt.part
include ./nexmark/q10.slt.part
include ./nexmark/q14.slt.part

include ./nexmark/drop_views.slt.part

Expand Down
2 changes: 2 additions & 0 deletions e2e_test/streaming/nexmark_upstream.slt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ include ./nexmark/q4.slt.part
include ./nexmark/q5.slt.part
include ./nexmark/q7.slt.part
include ./nexmark/q8.slt.part
include ./nexmark/q10.slt.part
include ./nexmark/q14.slt.part

include ./nexmark/drop_views.slt.part

Expand Down
26 changes: 6 additions & 20 deletions e2e_test/streaming/tpch_snapshot.slt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ include ../tpch/insert_supplier.slt.part
include ./tpch/views/q1.slt.part
include ./tpch/views/q2.slt.part
include ./tpch/views/q3.slt.part
include ./tpch/views/q4.slt.part
# include ./tpch/views/q4.slt.part
include ./tpch/views/q5.slt.part
include ./tpch/views/q6.slt.part
include ./tpch/views/q7.slt.part
Expand All @@ -24,15 +24,14 @@ include ./tpch/views/q12.slt.part
include ./tpch/views/q13.slt.part
include ./tpch/views/q14.slt.part
include ./tpch/views/q17.slt.part
include ./tpch/views/q18.slt.part
# include ./tpch/views/q18.slt.part
include ./tpch/views/q19.slt.part
include ./tpch/views/q20.slt.part
include ./tpch/views/q22.slt.part
# include ./tpch/views/q20.slt.part

include ./tpch/q1.slt.part
include ./tpch/q2.slt.part
include ./tpch/q3.slt.part
include ./tpch/q4.slt.part
# include ./tpch/q4.slt.part
include ./tpch/q5.slt.part
include ./tpch/q6.slt.part
include ./tpch/q7.slt.part
Expand All @@ -44,10 +43,9 @@ include ./tpch/q12.slt.part
include ./tpch/q13.slt.part
include ./tpch/q14.slt.part
include ./tpch/q17.slt.part
include ./tpch/q18.slt.part
# include ./tpch/q18.slt.part
include ./tpch/q19.slt.part
include ./tpch/q20.slt.part
include ./tpch/q22.slt.part
# include ./tpch/q20.slt.part

statement ok
drop materialized view tpch_q1;
Expand All @@ -58,9 +56,6 @@ drop materialized view tpch_q2;
statement ok
drop materialized view tpch_q3;

statement ok
drop materialized view tpch_q4;

statement ok
drop materialized view tpch_q5;

Expand Down Expand Up @@ -94,16 +89,7 @@ drop materialized view tpch_q14;
statement ok
drop materialized view tpch_q17;

statement ok
drop materialized view tpch_q18;

statement ok
drop materialized view tpch_q19;

statement ok
drop materialized view tpch_q20;

statement ok
drop materialized view tpch_q22;

include ../tpch/drop_tables.slt.part
26 changes: 6 additions & 20 deletions e2e_test/streaming/tpch_upstream.slt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ flush;
include ./tpch/views/q1.slt.part
include ./tpch/views/q2.slt.part
include ./tpch/views/q3.slt.part
include ./tpch/views/q4.slt.part
# include ./tpch/views/q4.slt.part
include ./tpch/views/q5.slt.part
include ./tpch/views/q6.slt.part
include ./tpch/views/q7.slt.part
Expand All @@ -27,15 +27,14 @@ include ./tpch/views/q12.slt.part
include ./tpch/views/q13.slt.part
include ./tpch/views/q14.slt.part
include ./tpch/views/q17.slt.part
include ./tpch/views/q18.slt.part
# include ./tpch/views/q18.slt.part
include ./tpch/views/q19.slt.part
include ./tpch/views/q20.slt.part
include ./tpch/views/q22.slt.part
# include ./tpch/views/q20.slt.part

include ./tpch/q1.slt.part
include ./tpch/q2.slt.part
include ./tpch/q3.slt.part
include ./tpch/q4.slt.part
# include ./tpch/q4.slt.part
include ./tpch/q5.slt.part
include ./tpch/q6.slt.part
include ./tpch/q7.slt.part
Expand All @@ -47,10 +46,9 @@ include ./tpch/q12.slt.part
include ./tpch/q13.slt.part
include ./tpch/q14.slt.part
include ./tpch/q17.slt.part
include ./tpch/q18.slt.part
# include ./tpch/q18.slt.part
include ./tpch/q19.slt.part
include ./tpch/q20.slt.part
include ./tpch/q22.slt.part
# include ./tpch/q20.slt.part

statement ok
drop materialized view tpch_q1;
Expand All @@ -61,9 +59,6 @@ drop materialized view tpch_q2;
statement ok
drop materialized view tpch_q3;

statement ok
drop materialized view tpch_q4;

statement ok
drop materialized view tpch_q5;

Expand Down Expand Up @@ -97,16 +92,7 @@ drop materialized view tpch_q14;
statement ok
drop materialized view tpch_q17;

statement ok
drop materialized view tpch_q18;

statement ok
drop materialized view tpch_q19;

statement ok
drop materialized view tpch_q20;

statement ok
drop materialized view tpch_q22;

include ../tpch/drop_tables.slt.part
10 changes: 4 additions & 6 deletions proto/stream_plan.proto
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,11 @@ message HashJoinNode {
catalog.Table left_table = 6;
// Used for internal table states.
catalog.Table right_table = 7;
repeated uint32 dist_key_l = 8;
repeated uint32 dist_key_r = 9;
// It is true when the input is append-only
bool is_append_only = 10;
// Whether to optimize for append only stream.
// the output indices of current node
repeated uint32 output_indices = 11;
// It is true when the input is append-only
bool is_append_only = 8;
// The output indices of current node
repeated uint32 output_indices = 9;
}

message DynamicFilterNode {
Expand Down
1 change: 1 addition & 0 deletions src/expr/src/expr/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ macro_rules! for_all_cmp_variants {
{ float64, decimal, float64, $general_f },
{ timestamp, timestamp, timestamp, $general_f },
{ interval, interval, interval, $general_f },
{ time, time, time, $general_f },
{ date, date, date, $general_f },
{ boolean, boolean, boolean, $general_f },
{ timestamp, date, timestamp, $general_f },
Expand Down
8 changes: 6 additions & 2 deletions src/frontend/src/expr/type_inference/func.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,13 @@ fn build_type_derive_map() -> FuncSigMap {
E::IsDistinctFrom,
];
build_binary_cmp_funcs(&mut map, cmp_exprs, &num_types);
build_binary_cmp_funcs(&mut map, cmp_exprs, &[T::Struct, T::List]);
build_binary_cmp_funcs(&mut map, cmp_exprs, &[T::Struct]);
build_binary_cmp_funcs(&mut map, cmp_exprs, &[T::List]);
build_binary_cmp_funcs(&mut map, cmp_exprs, &[T::Date, T::Timestamp, T::Timestampz]);
build_binary_cmp_funcs(&mut map, cmp_exprs, &[T::Time, T::Interval]);
// TODO: add support for time-interval comparison
// build_binary_cmp_funcs(&mut map, cmp_exprs, &[T::Time, T::Interval]);
build_binary_cmp_funcs(&mut map, cmp_exprs, &[T::Time]);
build_binary_cmp_funcs(&mut map, cmp_exprs, &[T::Interval]);
for e in cmp_exprs {
for t in [T::Boolean, T::Varchar] {
map.insert(*e, vec![t, t], T::Boolean);
Expand Down
6 changes: 3 additions & 3 deletions src/frontend/src/handler/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ async fn distribute_execute(

let plan = root.gen_batch_query_plan()?;

info!(
tracing::trace!(
"Generated distributed plan: {:?}",
plan.explain_to_string()?
);

let plan_fragmenter = BatchPlanFragmenter::new(session.env().worker_node_manager_ref());
let query = plan_fragmenter.split(plan)?;
info!("Generated query after plan fragmenter: {:?}", &query);
tracing::trace!("Generated query after plan fragmenter: {:?}", &query);
(query, pg_descs)
};

Expand Down Expand Up @@ -137,7 +137,7 @@ fn local_execute(

let plan_fragmenter = BatchPlanFragmenter::new(session.env().worker_node_manager_ref());
let query = plan_fragmenter.split(plan)?;
info!("Generated query after plan fragmenter: {:?}", &query);
tracing::trace!("Generated query after plan fragmenter: {:?}", &query);
(query, pg_descs)
};

Expand Down
Loading

0 comments on commit f1022a1

Please sign in to comment.