Update COMPAT table and remove unused deps

This commit is contained in:
Bennett Clement
2024-07-20 00:35:15 +08:00
parent 4590c3cc7c
commit 0a4e094ef6
8 changed files with 35 additions and 79 deletions

View File

@@ -44,7 +44,7 @@ This document describes the SQLite compatibility status of Limbo:
| SELECT ... WHERE | Partial | |
| SELECT ... WHERE ... LIKE | Yes | |
| SELECT ... LIMIT | Yes | |
| SELECT ... ORDER BY | No | |
| SELECT ... ORDER BY | Partial | |
| SELECT ... GROUP BY | No | |
| SELECT ... JOIN | Partial | |
| SELECT ... CROSS JOIN | Partial | |

49
Cargo.lock generated
View File

@@ -357,26 +357,6 @@ dependencies = [
"crossbeam-utils",
]
[[package]]
name = "const-random"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359"
dependencies = [
"const-random-macro",
]
[[package]]
name = "const-random-macro"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e"
dependencies = [
"getrandom",
"once_cell",
"tiny-keccak",
]
[[package]]
name = "cpp_demangle"
version = "0.4.3"
@@ -505,15 +485,6 @@ dependencies = [
"windows-sys 0.48.0",
]
[[package]]
name = "dlv-list"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "442039f5147480ba31067cb00ada1adae6892028e40e45fc5de7b7df6dcc1b5f"
dependencies = [
"const-random",
]
[[package]]
name = "either"
version = "1.13.0"
@@ -1005,7 +976,6 @@ dependencies = [
"log",
"mimalloc",
"nix 0.29.0",
"ordered-multimap",
"polling",
"pprof",
"regex",
@@ -1171,16 +1141,6 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
[[package]]
name = "ordered-multimap"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49203cdcae0030493bad186b28da2fa25645fa276a51b6fec8010d281e02ef79"
dependencies = [
"dlv-list",
"hashbrown 0.14.5",
]
[[package]]
name = "os_str_bytes"
version = "6.6.1"
@@ -1809,15 +1769,6 @@ dependencies = [
"syn 2.0.69",
]
[[package]]
name = "tiny-keccak"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237"
dependencies = [
"crunchy",
]
[[package]]
name = "tinytemplate"
version = "1.2.1"

View File

@@ -34,7 +34,6 @@ fallible-iterator = "0.3.0"
libc = "0.2.155"
log = "0.4.20"
nix = { version = "0.29.0", features = ["fs"] }
ordered-multimap = "0.7.1"
sieve-cache = "0.1.4"
sqlite3-parser = "0.11.0"
thiserror = "1.0.61"

View File

@@ -4,7 +4,7 @@ use crate::types::{Cursor, CursorResult, OwnedRecord};
use anyhow::Result;
use std::cell::RefCell;
use std::cell::{Ref, RefCell};
use std::rc::Rc;
pub struct MemPage {
@@ -156,8 +156,8 @@ impl Cursor for BTreeCursor {
Ok(*self.rowid.borrow())
}
fn record(&self) -> Result<Option<OwnedRecord>> {
Ok(self.record.borrow().to_owned())
fn record(&self) -> Result<Ref<Option<OwnedRecord>>> {
Ok(self.record.borrow())
}
fn insert(&mut self, _record: &OwnedRecord) -> Result<()> {

View File

@@ -1,5 +1,5 @@
use anyhow::Result;
use std::cell::RefCell;
use std::cell::{Ref, RefCell};
use crate::types::{Cursor, CursorResult, OwnedRecord, OwnedValue};
@@ -46,8 +46,8 @@ impl Cursor for PseudoCursor {
Ok(x)
}
fn record(&self) -> Result<Option<OwnedRecord>> {
Ok(self.current.borrow().to_owned())
fn record(&self) -> Result<Ref<Option<OwnedRecord>>> {
Ok(self.current.borrow())
}
fn insert(&mut self, record: &OwnedRecord) -> Result<()> {

View File

@@ -1,13 +1,13 @@
use crate::types::{Cursor, CursorResult, OwnedRecord};
use anyhow::Result;
use std::{
cell::RefCell,
cell::{Ref, RefCell},
collections::{BTreeMap, VecDeque},
};
pub struct Sorter {
records: BTreeMap<OwnedRecord, VecDeque<OwnedRecord>>,
current: RefCell<Option<VecDeque<OwnedRecord>>>,
current: RefCell<Option<OwnedRecord>>,
order: Vec<bool>,
}
@@ -35,25 +35,32 @@ impl Cursor for Sorter {
}
fn rewind(&mut self) -> Result<CursorResult<()>> {
let empty = {
let current = self.current.borrow();
current.as_ref().map(|r| r.is_empty()).unwrap_or(true)
};
if empty {
let mut c = self.current.borrow_mut();
*c = self.records.pop_first().map(|(_, record)| record);
let mut c = self.current.borrow_mut();
for (_, record) in self.records.iter_mut() {
let record = record.pop_front();
if record.is_some() {
*c = record;
break;
}
}
Ok(CursorResult::Ok(()))
}
fn next(&mut self) -> Result<CursorResult<()>> {
let empty = {
let current = self.current.borrow();
current.as_ref().map(|r| r.is_empty()).unwrap_or(true)
};
if empty {
let mut c = self.current.borrow_mut();
*c = self.records.pop_first().map(|(_, record)| record);
let mut c = self.current.borrow_mut();
let mut matched = false;
for (_, record) in self.records.iter_mut() {
let record = record.pop_front();
if record.is_some() {
*c = record;
matched = true;
break;
}
}
self.records.retain(|_, v| !v.is_empty());
if !matched {
*c = None;
}
Ok(CursorResult::Ok(()))
}
@@ -66,9 +73,8 @@ impl Cursor for Sorter {
todo!();
}
fn record(&self) -> Result<Option<OwnedRecord>> {
let mut current = self.current.borrow_mut();
Ok(current.as_mut().map(|r| r.pop_front().unwrap()))
fn record(&self) -> Result<Ref<Option<OwnedRecord>>> {
Ok(self.current.borrow())
}
fn insert(&mut self, record: &OwnedRecord) -> Result<()> {

View File

@@ -297,7 +297,7 @@ pub trait Cursor {
fn next(&mut self) -> Result<CursorResult<()>>;
fn wait_for_completion(&mut self) -> Result<()>;
fn rowid(&self) -> Result<Option<u64>>;
fn record(&self) -> Result<Option<OwnedRecord>>;
fn record(&self) -> Result<Ref<Option<OwnedRecord>>>;
fn insert(&mut self, record: &OwnedRecord) -> Result<()>;
fn set_null_flag(&mut self, flag: bool);
fn get_null_flag(&self) -> bool;

View File

@@ -892,7 +892,7 @@ impl Program {
dest,
} => {
let cursor = cursors.get_mut(cursor_id).unwrap();
if let Some(ref record) = cursor.record()? {
if let Some(ref record) = *cursor.record()? {
let null_flag = cursor.get_null_flag();
state.registers[*dest] = if null_flag {
OwnedValue::Null
@@ -1228,7 +1228,7 @@ impl Program {
pseudo_cursor: sorter_cursor,
} => {
let cursor = cursors.get_mut(cursor_id).unwrap();
let record = match cursor.record()? {
let record = match *cursor.record()? {
Some(ref record) => record.clone(),
None => {
todo!();