feat:init to add new geo types

This commit is contained in:
liangxingjian
2022-10-09 17:46:06 +08:00
parent 178f8b64b5
commit 8a91e26020
19 changed files with 724 additions and 8 deletions

257
Cargo.lock generated
View File

@@ -256,6 +256,15 @@ dependencies = [
"syn",
]
[[package]]
name = "atomic-polyfill"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c041a8d9751a520ee19656232a18971f18946a7900f1520ee4400002244dd89"
dependencies = [
"critical-section",
]
[[package]]
name = "atomic_float"
version = "0.1.0"
@@ -430,6 +439,21 @@ dependencies = [
"rustc-demangle",
]
[[package]]
name = "bare-metal"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3"
dependencies = [
"rustc_version 0.2.3",
]
[[package]]
name = "bare-metal"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8fe8f5a8a398345e52358e18ff07cc17a568fbca5c6f73873d3a62056309603"
[[package]]
name = "base64"
version = "0.13.0"
@@ -475,6 +499,18 @@ dependencies = [
"shlex",
]
[[package]]
name = "bit_field"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcb6dd1c2376d2e096796e234a70e17e94cc2d5d54ff8ce42b28cef1d0d359a4"
[[package]]
name = "bitfield"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719"
[[package]]
name = "bitflags"
version = "1.3.2"
@@ -1086,6 +1122,18 @@ version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
[[package]]
name = "cortex-m"
version = "0.7.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70858629a458fdfd39f9675c4dc309411f2a3f83bede76988d81bf1a0ecee9e0"
dependencies = [
"bare-metal 0.2.5",
"bitfield",
"embedded-hal",
"volatile-register",
]
[[package]]
name = "cpufeatures"
version = "0.2.5"
@@ -1155,6 +1203,18 @@ dependencies = [
"itertools",
]
[[package]]
name = "critical-section"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95da181745b56d4bd339530ec393508910c909c784e8962d15d722bacf0bcbcd"
dependencies = [
"bare-metal 1.0.0",
"cfg-if",
"cortex-m",
"riscv",
]
[[package]]
name = "crossbeam"
version = "0.8.2"
@@ -1471,6 +1531,7 @@ dependencies = [
"common-time",
"datafusion-common",
"enum_dispatch",
"geo",
"num",
"num-traits",
"ordered-float 3.0.0",
@@ -1592,6 +1653,16 @@ version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
[[package]]
name = "embedded-hal"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff"
dependencies = [
"nb 0.1.3",
"void",
]
[[package]]
name = "encode_unicode"
version = "0.3.6"
@@ -1717,6 +1788,15 @@ dependencies = [
"miniz_oxide",
]
[[package]]
name = "float_next_after"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4fc612c5837986b7104a87a0df74a5460931f1c5274be12f8d0f40aa2f30d632"
dependencies = [
"num-traits",
]
[[package]]
name = "fnv"
version = "1.0.7"
@@ -1979,6 +2059,42 @@ dependencies = [
"version_check",
]
[[package]]
name = "geo"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b684179d4c034f9e6718692601a7ec77e4a3b654dbc09b5e4fd342f0e48f2ba1"
dependencies = [
"float_next_after",
"geo-types",
"geographiclib-rs",
"log",
"num-traits",
"robust",
"rstar",
"serde",
]
[[package]]
name = "geo-types"
version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8d77ceb80f375dc4cda113a3ae1b06a36ef623f8f035c03752ca6698f4ddfee"
dependencies = [
"approx",
"num-traits",
"rstar",
]
[[package]]
name = "geographiclib-rs"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdbd3cdc1856ca7736763d2784671c2c9b0093f0ee47e2bed0059feed6afca89"
dependencies = [
"lazy_static",
]
[[package]]
name = "gethostname"
version = "0.2.3"
@@ -2051,6 +2167,15 @@ version = "1.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7"
[[package]]
name = "hash32"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67"
dependencies = [
"byteorder",
]
[[package]]
name = "hash_hasher"
version = "2.0.3"
@@ -2079,6 +2204,19 @@ dependencies = [
"num-traits",
]
[[package]]
name = "heapless"
version = "0.7.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db04bc24a18b9ea980628ecf00e6c0264f3c1426dac36c00cb49b6fbad8b0743"
dependencies = [
"atomic-polyfill",
"hash32",
"rustc_version 0.4.0",
"spin 0.9.4",
"stable_deref_trait",
]
[[package]]
name = "heck"
version = "0.3.3"
@@ -3011,6 +3149,21 @@ dependencies = [
"tempfile",
]
[[package]]
name = "nb"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f"
dependencies = [
"nb 1.0.0",
]
[[package]]
name = "nb"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae"
[[package]]
name = "nibble_vec"
version = "0.1.0"
@@ -4232,12 +4385,39 @@ dependencies = [
"cc",
"libc",
"once_cell",
"spin",
"spin 0.5.2",
"untrusted",
"web-sys",
"winapi",
]
[[package]]
name = "riscv"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6907ccdd7a31012b70faf2af85cd9e5ba97657cc3987c4f13f8e4d2c2a088aba"
dependencies = [
"bare-metal 1.0.0",
"bit_field",
"riscv-target",
]
[[package]]
name = "riscv-target"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88aa938cda42a0cf62a20cfe8d139ff1af20c2e681212b5b34adb5a58333f222"
dependencies = [
"lazy_static",
"regex",
]
[[package]]
name = "robust"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5864e7ef1a6b7bcf1d6ca3f655e65e724ed3b52546a0d0a663c991522f552ea"
[[package]]
name = "ron"
version = "0.7.1"
@@ -4249,6 +4429,17 @@ dependencies = [
"serde",
]
[[package]]
name = "rstar"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b40f1bfe5acdab44bc63e6699c28b74f75ec43afb59f3eda01e145aff86a25fa"
dependencies = [
"heapless",
"num-traits",
"smallvec",
]
[[package]]
name = "rust-ini"
version = "0.18.0"
@@ -4282,13 +4473,22 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
[[package]]
name = "rustc_version"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
dependencies = [
"semver 0.9.0",
]
[[package]]
name = "rustc_version"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
dependencies = [
"semver",
"semver 1.0.13",
]
[[package]]
@@ -4472,7 +4672,7 @@ dependencies = [
"paste",
"rand 0.8.5",
"result-like",
"rustc_version",
"rustc_version 0.4.0",
"rustpython-ast",
"rustpython-bytecode",
"rustpython-common",
@@ -4635,12 +4835,27 @@ dependencies = [
"libc",
]
[[package]]
name = "semver"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
dependencies = [
"semver-parser",
]
[[package]]
name = "semver"
version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93f6841e709003d68bb2deee8c343572bf446003ec20a583e76f7b15cebf3711"
[[package]]
name = "semver-parser"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
version = "1.0.144"
@@ -4901,6 +5116,15 @@ version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
[[package]]
name = "spin"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09"
dependencies = [
"lock_api",
]
[[package]]
name = "sql"
version = "0.1.0"
@@ -4932,6 +5156,12 @@ dependencies = [
"num_enum",
]
[[package]]
name = "stable_deref_trait"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
[[package]]
name = "static_assertions"
version = "1.1.0"
@@ -5982,6 +6212,12 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
[[package]]
name = "vcell"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002"
[[package]]
name = "vcpkg"
version = "0.2.15"
@@ -6000,12 +6236,27 @@ version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "void"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
[[package]]
name = "volatile"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8e76fae08f03f96e166d2dfda232190638c10e0383841252416f9cfe2ae60e6"
[[package]]
name = "volatile-register"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ee8f19f9d74293faf70901bc20ad067dc1ad390d2cbf1e3f75f721ffee908b6"
dependencies = [
"vcell",
]
[[package]]
name = "waker-fn"
version = "1.1.0"

View File

@@ -67,6 +67,7 @@ impl TryFrom<ConcreteDataType> for ColumnDataTypeWrapper {
ConcreteDataType::Null(_) | ConcreteDataType::List(_) => {
return error::IntoColumnDataTypeSnafu { from: datatype }.fail()
}
ConcreteDataType::Geometry(_) => todo!(),
});
Ok(datatype)
}

View File

@@ -194,6 +194,7 @@ fn try_into_scalar_value(value: Value, datatype: &ConcreteDataType) -> Result<Sc
Value::Null => try_convert_null_value(datatype)?,
Value::List(list) => try_convert_list_value(list)?,
Value::Timestamp(t) => timestamp_to_scalar_value(t.unit(), Some(t.value())),
Value::Geometry(_) => todo!(),
})
}

View File

@@ -186,6 +186,7 @@ fn convert_values(data_type: &ConcreteDataType, values: Values) -> Vec<Value> {
.collect(),
ConcreteDataType::Null(_) => unreachable!(),
ConcreteDataType::List(_) => unreachable!(),
ConcreteDataType::Geometry(_) => todo!(),
}
}

View File

@@ -20,8 +20,18 @@ paste = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
snafu = { version = "0.7", features = ["backtraces"] }
geo = { version = "0.23.0", features = ["serde"] }
[dependencies.arrow]
package = "arrow2"
version = "0.10"
features = ["io_csv", "io_json", "io_parquet", "io_parquet_compression", "io_ipc", "ahash", "compute", "serde_types"]
features = [
"io_csv",
"io_json",
"io_parquet",
"io_parquet_compression",
"io_ipc",
"ahash",
"compute",
"serde_types",
]

View File

@@ -8,8 +8,9 @@ use serde::{Deserialize, Serialize};
use crate::error::{self, Error, Result};
use crate::type_id::LogicalTypeId;
use crate::types::{
BinaryType, BooleanType, DateType, Float32Type, Float64Type, Int16Type, Int32Type, Int64Type,
Int8Type, ListType, NullType, StringType, UInt16Type, UInt32Type, UInt64Type, UInt8Type,
BinaryType, BooleanType, DateType, Float32Type, Float64Type, GeometryType, Int16Type,
Int32Type, Int64Type, Int8Type, ListType, NullType, StringType, UInt16Type, UInt32Type,
UInt64Type, UInt8Type,
};
use crate::types::{DateTimeType, TimestampType};
use crate::value::Value;
@@ -42,6 +43,7 @@ pub enum ConcreteDataType {
Timestamp(TimestampType),
List(ListType),
Geometry(GeometryType),
}
impl ConcreteDataType {

View File

@@ -3,7 +3,8 @@ use std::any::Any;
use common_time::{Date, DateTime, Timestamp};
use crate::prelude::*;
use crate::value::{ListValue, ListValueRef};
use crate::value::{GeometryValue, ListValue, ListValueRef};
use crate::vectors::all::GeometryVector;
use crate::vectors::*;
fn get_iter_capacity<T, I: Iterator<Item = T>>(iter: &I) -> usize {
@@ -340,6 +341,30 @@ impl<'a> ScalarRef<'a> for ListValueRef<'a> {
}
}
impl Scalar for GeometryValue {
type VectorType = GeometryVector;
type RefType<'a> = &'a GeometryValue;
fn as_scalar_ref(&self) -> Self::RefType<'_> {
todo!()
}
fn upcast_gat<'short, 'long: 'short>(long: Self::RefType<'long>) -> Self::RefType<'short> {
todo!()
}
}
impl<'a> ScalarRef<'a> for &'a GeometryValue {
type VectorType = GeometryVector;
type ScalarType = GeometryValue;
fn to_owned_scalar(&self) -> Self::ScalarType {
todo!()
}
}
#[cfg(test)]
mod tests {
use super::*;

View File

@@ -31,6 +31,8 @@ pub enum LogicalTypeId {
Timestamp,
List,
Geometry,
}
impl LogicalTypeId {
@@ -64,6 +66,7 @@ impl LogicalTypeId {
LogicalTypeId::List => {
ConcreteDataType::list_datatype(ConcreteDataType::null_datatype())
}
LogicalTypeId::Geometry => todo!(),
}
}
}

View File

@@ -2,6 +2,7 @@ mod binary_type;
mod boolean_type;
mod date;
mod datetime;
mod geometry;
mod list_type;
mod null_type;
mod primitive_traits;
@@ -13,6 +14,7 @@ pub use binary_type::BinaryType;
pub use boolean_type::BooleanType;
pub use date::DateType;
pub use datetime::DateTimeType;
pub use geometry::GeometryType;
pub use list_type::ListType;
pub use null_type::NullType;
pub use primitive_traits::{OrdPrimitive, Primitive};

View File

@@ -0,0 +1,29 @@
use serde::{Deserialize, Serialize};
use crate::data_type::DataType;
use crate::prelude::{DataTypeRef, LogicalTypeId, Value};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum GeometryType {}
impl DataType for GeometryType {
fn name(&self) -> &str {
"Geometry"
}
fn logical_type_id(&self) -> crate::type_id::LogicalTypeId {
LogicalTypeId::Geometry
}
fn default_value(&self) -> crate::value::Value {
todo!()
}
fn as_arrow_type(&self) -> arrow::datatypes::DataType {
unimplemented!()
}
fn create_mutable_vector(&self, capacity: usize) -> Box<dyn crate::vectors::MutableVector> {
todo!()
}
}

View File

@@ -44,6 +44,7 @@ pub enum Value {
Timestamp(Timestamp),
List(ListValue),
Geometry(GeometryValue),
}
impl Value {
@@ -71,6 +72,7 @@ impl Value {
Value::Date(_) => ConcreteDataType::date_datatype(),
Value::DateTime(_) => ConcreteDataType::date_datatype(),
Value::Timestamp(v) => ConcreteDataType::timestamp_datatype(v.unit()),
Value::Geometry(_) => todo!(),
}
}
@@ -112,6 +114,7 @@ impl Value {
Value::DateTime(v) => ValueRef::DateTime(*v),
Value::List(v) => ValueRef::List(ListValueRef::Ref { val: v }),
Value::Timestamp(v) => ValueRef::Timestamp(*v),
Value::Geometry(_) => todo!(),
}
}
}
@@ -249,6 +252,7 @@ impl TryFrom<Value> for serde_json::Value {
Value::DateTime(v) => serde_json::Value::Number(v.val().into()),
Value::List(v) => serde_json::to_value(v)?,
Value::Timestamp(v) => serde_json::to_value(v.value())?,
Value::Geometry(_) => todo!(),
};
Ok(json_value)
@@ -304,6 +308,16 @@ impl Ord for ListValue {
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize,)]
pub enum GeometryValue {
Point(f64, f64),
}
impl Default for GeometryValue {
fn default() -> Self {
GeometryValue::Point(0.0, 0.0)
}
}
/// Reference to [Value].
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ValueRef<'a> {
@@ -331,6 +345,7 @@ pub enum ValueRef<'a> {
DateTime(DateTime),
Timestamp(Timestamp),
List(ListValueRef<'a>),
Geometry(&'a GeometryValue),
}
macro_rules! impl_as_for_value_ref {

View File

@@ -5,6 +5,7 @@ pub mod constant;
pub mod date;
pub mod datetime;
mod eq;
mod geometry;
mod helper;
mod list;
pub mod mutable;
@@ -20,7 +21,7 @@ pub mod all {
BinaryVector, BooleanVector, ConstantVector, DateTimeVector, DateVector, Float32Vector,
Float64Vector, Int16Vector, Int32Vector, Int64Vector, Int8Vector, ListVector, NullVector,
PrimitiveVector, StringVector, TimestampVector, UInt16Vector, UInt32Vector, UInt64Vector,
UInt8Vector,
UInt8Vector,geometry::GeometryVector
};
}

View File

@@ -76,6 +76,7 @@ fn equal(lhs: &dyn Vector, rhs: &dyn Vector) -> bool {
unreachable!("should not compare {} with {}", lhs.vector_type_name(), rhs.vector_type_name())
})
}
Geometry(_) => todo!(),
}
}

View File

@@ -0,0 +1,182 @@
use snafu::ensure;
use super::{MutableVector, Vector};
use crate::{
error,
prelude::{ScalarVector, ScalarVectorBuilder},
serialize::Serializable,
value::GeometryValue,
};
mod point;
#[derive(Debug, Clone, PartialEq)]
pub enum GeometryVector {}
impl Vector for GeometryVector {
fn data_type(&self) -> crate::data_type::ConcreteDataType {
todo!()
}
fn vector_type_name(&self) -> String {
todo!()
}
fn as_any(&self) -> &dyn std::any::Any {
todo!()
}
fn len(&self) -> usize {
todo!()
}
fn to_arrow_array(&self) -> arrow::array::ArrayRef {
todo!()
}
fn to_boxed_arrow_array(&self) -> Box<dyn arrow::array::Array> {
todo!()
}
fn validity(&self) -> super::Validity {
todo!()
}
fn memory_size(&self) -> usize {
todo!()
}
fn is_null(&self, row: usize) -> bool {
todo!()
}
fn slice(&self, offset: usize, length: usize) -> super::VectorRef {
todo!()
}
fn get(&self, index: usize) -> crate::value::Value {
todo!()
}
fn get_ref(&self, index: usize) -> crate::value::ValueRef {
todo!()
}
fn is_empty(&self) -> bool {
self.len() == 0
}
fn null_count(&self) -> usize {
match self.validity() {
super::Validity::Slots(bitmap) => bitmap.null_count(),
super::Validity::AllValid => 0,
super::Validity::AllNull => self.len(),
}
}
fn is_const(&self) -> bool {
false
}
fn only_null(&self) -> bool {
self.null_count() == self.len()
}
fn try_get(&self, index: usize) -> crate::Result<crate::value::Value> {
ensure!(
index < self.len(),
error::BadArrayAccessSnafu {
index,
size: self.len()
}
);
Ok(self.get(index))
}
}
impl ScalarVector for GeometryVector {
type OwnedItem = GeometryValue;
type RefItem<'a> = &'a GeometryValue;
type Iter<'a> = GeometryVectorIter<'a>;
type Builder = GeometryVectorBuilder;
fn get_data(&self, idx: usize) -> Option<Self::RefItem<'_>> {
todo!()
}
fn iter_data(&self) -> Self::Iter<'_> {
todo!()
}
}
pub struct GeometryVectorIter<'a> {
vector: &'a GeometryVector,
}
impl<'a> Iterator for GeometryVectorIter<'a> {
type Item = Option<&'a GeometryValue>;
fn next(&mut self) -> Option<Self::Item> {
todo!()
}
}
pub enum GeometryVectorBuilder {}
impl MutableVector for GeometryVectorBuilder {
fn data_type(&self) -> crate::data_type::ConcreteDataType {
todo!()
}
fn len(&self) -> usize {
todo!()
}
fn as_any(&self) -> &dyn std::any::Any {
todo!()
}
fn as_mut_any(&mut self) -> &mut dyn std::any::Any {
todo!()
}
fn to_vector(&mut self) -> super::VectorRef {
todo!()
}
fn push_value_ref(&mut self, value: crate::value::ValueRef) -> crate::Result<()> {
todo!()
}
fn extend_slice_of(
&mut self,
vector: &dyn Vector,
offset: usize,
length: usize,
) -> crate::Result<()> {
todo!()
}
}
impl ScalarVectorBuilder for GeometryVectorBuilder {
type VectorType = GeometryVector;
fn with_capacity(capacity: usize) -> Self {
todo!()
}
fn push(&mut self, value: Option<<Self::VectorType as ScalarVector>::RefItem<'_>>) {
todo!()
}
fn finish(&mut self) -> Self::VectorType {
todo!()
}
}
impl Serializable for GeometryVector {
fn serialize_to_json(&self) -> crate::Result<Vec<serde_json::Value>> {
todo!()
}
}

View File

@@ -0,0 +1,174 @@
// use arrow::array::{FixedSizeListArray, MutableFixedSizeListArray};
// use geo::Point;
// use crate::{
// prelude::{ScalarVector, ScalarVectorBuilder, Vector},
// vectors::MutableVector,
// };
// #[derive(Debug, Clone, PartialEq)]
// struct PointVector {
// array: FixedSizeListArray,
// }
// impl Vector for PointVector {
// fn data_type(&self) -> crate::data_type::ConcreteDataType {
// todo!()
// }
// fn vector_type_name(&self) -> String {
// todo!()
// }
// fn as_any(&self) -> &dyn std::any::Any {
// todo!()
// }
// fn len(&self) -> usize {
// todo!()
// }
// fn to_arrow_array(&self) -> arrow::array::ArrayRef {
// todo!()
// }
// fn to_boxed_arrow_array(&self) -> Box<dyn arrow::array::Array> {
// todo!()
// }
// fn validity(&self) -> crate::vectors::Validity {
// todo!()
// }
// fn memory_size(&self) -> usize {
// todo!()
// }
// fn is_null(&self, row: usize) -> bool {
// todo!()
// }
// fn slice(&self, offset: usize, length: usize) -> crate::vectors::VectorRef {
// todo!()
// }
// fn get(&self, index: usize) -> crate::value::Value {
// todo!()
// }
// fn get_ref(&self, index: usize) -> crate::value::ValueRef {
// todo!()
// }
// fn is_empty(&self) -> bool {
// self.len() == 0
// }
// fn null_count(&self) -> usize {
// match self.validity() {
// crate::vectors::Validity::Slots(bitmap) => bitmap.null_count(),
// crate::vectors::Validity::AllValid => 0,
// crate::vectors::Validity::AllNull => self.len(),
// }
// }
// fn is_const(&self) -> bool {
// false
// }
// fn only_null(&self) -> bool {
// self.null_count() == self.len()
// }
// fn try_get(&self, index: usize) -> crate::Result<crate::value::Value> {
// ensure!(
// index < self.len(),
// error::BadArrayAccessSnafu {
// index,
// size: self.len()
// }
// );
// Ok(self.get(index))
// }
// }
// impl ScalarVector for PointVector {
// type OwnedItem;
// type RefItem<'a>
// where
// Self: 'a;
// type Iter<'a>
// where
// Self: 'a;
// type Builder;
// fn get_data(&self, idx: usize) -> Option<Self::RefItem<'_>> {
// todo!()
// }
// fn iter_data(&self) -> Self::Iter<'_> {
// todo!()
// }
// fn from_slice(data: &[Self::RefItem<'_>]) -> Self {
// let mut builder = Self::Builder::with_capacity(data.len());
// for item in data {
// builder.push(Some(*item));
// }
// builder.finish()
// }
// fn from_iterator<'a>(it: impl Iterator<Item = Self::RefItem<'a>>) -> Self {
// let mut builder = Self::Builder::with_capacity(get_iter_capacity(&it));
// for item in it {
// builder.push(Some(item));
// }
// builder.finish()
// }
// fn from_owned_iterator(it: impl Iterator<Item = Option<Self::OwnedItem>>) -> Self {
// let mut builder = Self::Builder::with_capacity(get_iter_capacity(&it));
// for item in it {
// match item {
// Some(item) => builder.push(Some(item.as_scalar_ref())),
// None => builder.push(None),
// }
// }
// builder.finish()
// }
// fn from_vec<I: Into<Self::OwnedItem>>(values: Vec<I>) -> Self {
// let it = values.into_iter();
// let mut builder = Self::Builder::with_capacity(get_iter_capacity(&it));
// for item in it {
// builder.push(Some(item.into().as_scalar_ref()));
// }
// builder.finish()
// }
// }
// struct PointVectorBuilder {
// buffer: MutableFixedSizeListArray<f64>,
// }
// impl MutableVector for PointVectorBuilder {}
// impl ScalarVectorBuilder for PointVectorBuilder {
// type VectorType = PointVector;
// fn with_capacity(capacity: usize) -> Self {
// todo!()
// }
// fn push(
// &mut self,
// value: Option<<Self::VectorType as crate::prelude::ScalarVector>::RefItem<'_>>,
// ) {
// }
// fn finish(&mut self) -> Self::VectorType {
// todo!()
// }
// }

View File

@@ -119,3 +119,16 @@ where
filter::filter_non_constant!(self, PrimitiveVector<T>, filter)
}
}
impl VectorOp for GeometryVector {
fn replicate(&self, offsets: &[usize]) -> VectorRef {
todo!()
}
fn dedup(&self, selected: &mut MutableBitmap, prev_vector: Option<&dyn Vector>) {
todo!()
}
fn filter(&self, filter: &BooleanVector) -> Result<VectorRef> {
todo!()
}
}

View File

@@ -882,6 +882,7 @@ pub fn pyobj_try_to_typed_val(
None
}
}
ConcreteDataType::Geometry(_) => todo!(),
}
} else if is_instance::<PyNone>(&obj, vm) {
// if Untyped then by default return types with highest precision
@@ -940,6 +941,7 @@ pub fn val_to_pyobj(val: value::Value, vm: &VirtualMachine) -> PyObjectRef {
// FIXME(dennis): lose the timestamp unit here
Value::Timestamp(v) => vm.ctx.new_int(v.value()).into(),
value::Value::List(_) => unreachable!(),
Value::Geometry(_) => todo!(),
}
}

View File

@@ -117,6 +117,7 @@ impl<'a, W: io::Write> MysqlResultWriter<'a, W> {
),
})
}
Value::Geometry(_) => todo!(),
}
}
row_writer.end_row()?;

View File

@@ -120,6 +120,7 @@ fn encode_value(value: &Value, builder: &mut TextQueryResponseBuilder) -> PgWire
&value
),
}))),
Value::Geometry(_) => todo!(),
}
}
@@ -142,6 +143,7 @@ fn type_translate(origin: &ConcreteDataType) -> Result<Type> {
err_msg: format!("not implemented for column datatype {:?}", origin),
}
.fail(),
&ConcreteDataType::Geometry(_) => todo!(),
}
}