1-- 2-- Copyright 2019 The Android Open Source Project 3-- 4-- Licensed under the Apache License, Version 2.0 (the "License"); 5-- you may not use this file except in compliance with the License. 6-- You may obtain a copy of the License at 7-- 8-- https://www.apache.org/licenses/LICENSE-2.0 9-- 10-- Unless required by applicable law or agreed to in writing, software 11-- distributed under the License is distributed on an "AS IS" BASIS, 12-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13-- See the License for the specific language governing permissions and 14-- limitations under the License. 15-- 16create table t1( 17 ts BIG INT, 18 dur BIG INT, 19 part BIG INT, 20 a BIG INT, 21 PRIMARY KEY (part, ts) 22) without rowid; 23 24create table t2( 25 ts BIG INT, 26 dur BIG INT, 27 b BIG INT, 28 PRIMARY KEY (ts) 29) without rowid; 30 31-- Then insert some rows into t1 in part 1, 3, 4 and 5. 32INSERT INTO t1(ts, dur, part, a) 33VALUES 34(100, 400, 1, 111), 35(500, 150, 1, 111), 36(500, 50, 3, 222), 37(500, 100, 4, 333), 38(0, 1000, 5, 444); 39 40-- Then insert some rows into t2. 41INSERT INTO t2(ts, dur, b) 42VALUES 43(50, 200, 111), 44(300, 100, 222), 45(400, 250, 333); 46 47create virtual table sp using span_left_join(t1 PARTITIONED part, t2); 48 49select * from sp; 50