Giter Site home page Giter Site logo

Comments (3)

messense avatar messense commented on July 28, 2024 1

@waynexia #108

from incubator-horaedb.

messense avatar messense commented on July 28, 2024

Since ceresdb-client-py only needs the Datum type, what do you think about the following change? Just feature-gate arrow-deps for now.

diff --git a/common_types/Cargo.toml b/common_types/Cargo.toml
index ed2736d..59558f6 100644
--- a/common_types/Cargo.toml
+++ b/common_types/Cargo.toml
@@ -7,11 +7,12 @@ edition = "2018"
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 
 [features]
+default = ["arrow_deps"]
 test = []
 
 [dependencies]
 # In alphabetical order
-arrow_deps = { path = "../arrow_deps" }
+arrow_deps = { path = "../arrow_deps", optional = true }
 byteorder = "1.2"
 bytes = { path = "../components/bytes" }
 chrono = "0.4"
diff --git a/common_types/src/datum.rs b/common_types/src/datum.rs
index 4e9dc03..84ff4e4 100644
--- a/common_types/src/datum.rs
+++ b/common_types/src/datum.rs
@@ -4,6 +4,7 @@
 
 use std::{convert::TryFrom, fmt, str};
 
+#[cfg(feature = "arrow_deps")]
 use arrow_deps::{
     arrow::datatypes::{DataType, TimeUnit},
     datafusion::scalar::ScalarValue,
@@ -156,6 +157,7 @@ impl DatumKind {
 
     /// Create DatumKind from [arrow_deps::arrow::datatypes::DataType], if the
     /// type is not supported, returns None
+    #[cfg(feature = "arrow_deps")]
     pub fn from_data_type(data_type: &DataType) -> Option<Self> {
         match data_type {
             DataType::Null => Some(Self::Null),
@@ -223,6 +225,7 @@ impl DatumKind {
     }
 }
 
+#[cfg(feature = "arrow_deps")]
 impl From<DatumKind> for DataType {
     fn from(kind: DatumKind) -> Self {
         match kind {
@@ -609,6 +612,7 @@ impl Datum {
         }
     }
 
+    #[cfg(feature = "arrow_deps")]
     pub fn as_scalar_value(&self) -> Option<ScalarValue> {
         match self {
             Datum::Null => None,
@@ -787,6 +791,7 @@ impl<'a> DatumView<'a> {
         }
     }
 
+    #[cfg(feature = "arrow_deps")]
     pub fn from_scalar_value(val: &'a ScalarValue) -> Option<Self> {
         match val {
             ScalarValue::Boolean(v) => v.map(DatumView::Boolean),
diff --git a/common_types/src/lib.rs b/common_types/src/lib.rs
index e247e2f..a07ca1c 100644
--- a/common_types/src/lib.rs
+++ b/common_types/src/lib.rs
@@ -3,14 +3,20 @@
 //! Contains common types
 
 pub mod bytes;
+#[cfg(feature = "arrow_deps")]
 pub mod column;
+#[cfg(feature = "arrow_deps")]
 pub mod column_schema;
 pub mod datum;
 pub mod hash;
+#[cfg(feature = "arrow_deps")]
 pub mod projected_schema;
+#[cfg(feature = "arrow_deps")]
 pub mod record_batch;
 pub mod request_id;
+#[cfg(feature = "arrow_deps")]
 pub mod row;
+#[cfg(feature = "arrow_deps")]
 pub mod schema;
 pub mod string;
 pub mod time;

from incubator-horaedb.

waynexia avatar waynexia commented on July 28, 2024

Since ceresdb-client-py only needs the Datum type, what do you think about the following change? Just feature-gate arrow-deps for now.

This looks pretty neat to me 👍 would you like to submit this patch?

from incubator-horaedb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.