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 a1 STRING, 18 a2 BIG INT, 19 dur BIG INT, 20 a3 BIG INT, 21 ts BIG INT PRIMARY KEY 22) without rowid; 23 24INSERT INTO t1(a1, a2, dur, a3, ts) 25VALUES 26("A", 1, 10, 100, 0), 27("B", 2, 90, 101, 10), 28("C", 3, 1, 102, 100); 29 30create table t2( 31 b1 STRING, 32 ts BIG INT, 33 b2 BIG INT, 34 part BIG INT, 35 dur BIG INT, 36 b3 BIG INT, 37 PRIMARY KEY (part, ts) 38) without rowid; 39 40INSERT INTO t2(b1, ts, b2, part, dur, b3) 41VALUES 42("A", 10, 10, 0, 90, 100), 43("B", 100, 90, 0, 10, 200), 44("C", 110, 1, 0, 5, 300), 45("A", 5, 10, 1, 45, 100), 46("B", 50, 90, 1, 40, 200), 47("C", 90, 1, 1, 100, 300); 48 49create virtual table sp using span_join(t1, t2 PARTITIONED part); 50 51select ts,dur,part,b1,b2,b3,a1,a2,a3 from sp; 52