Skip to content

Commit

Permalink
[CHORE]: Move jq out of core (#2828)
Browse files Browse the repository at this point in the history
  • Loading branch information
universalmind303 authored Sep 12, 2024
1 parent 8aad04c commit 2e35d5b
Show file tree
Hide file tree
Showing 19 changed files with 282 additions and 226 deletions.
25 changes: 20 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ daft-core = {path = "src/daft-core", default-features = false}
daft-csv = {path = "src/daft-csv", default-features = false}
daft-dsl = {path = "src/daft-dsl", default-features = false}
daft-functions = {path = "src/daft-functions", default-features = false}
daft-functions-json = {path = "src/daft-functions-json", default-features = false}
daft-image = {path = "src/daft-image", default-features = false}
daft-io = {path = "src/daft-io", default-features = false}
daft-json = {path = "src/daft-json", default-features = false}
Expand Down Expand Up @@ -53,6 +54,7 @@ python = [
"daft-sql/python",
"daft-table/python",
"daft-functions/python",
"daft-functions-json/python",
"common-daft-config/python",
"common-system-info/python",
"common-display/python",
Expand Down Expand Up @@ -129,6 +131,7 @@ members = [
"src/daft-scheduler",
"src/daft-sketch",
"src/daft-functions",
"src/daft-functions-json",
"src/daft-sql",
"src/hyperloglog"
]
Expand Down
6 changes: 5 additions & 1 deletion daft/daft/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1165,7 +1165,6 @@ class PyExpr:
def partitioning_years(self) -> PyExpr: ...
def partitioning_iceberg_bucket(self, n: int) -> PyExpr: ...
def partitioning_iceberg_truncate(self, w: int) -> PyExpr: ...
def json_query(self, query: str) -> PyExpr: ...

###
# Helper methods required by optimizer:
Expand Down Expand Up @@ -1256,6 +1255,11 @@ def image_encode(expr: PyExpr, image_format: ImageFormat) -> PyExpr: ...
def image_resize(expr: PyExpr, w: int, h: int) -> PyExpr: ...
def image_to_mode(expr: PyExpr, mode: ImageMode) -> PyExpr: ...

# ---
# expr.json namespace
# ---
def json_query(expr: PyExpr, query: str) -> PyExpr: ...

class PyCatalog:
@staticmethod
def new() -> PyCatalog: ...
Expand Down
2 changes: 1 addition & 1 deletion daft/expressions/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3391,7 +3391,7 @@ def query(self, jq_query: str) -> Expression:
Expression: Expression representing the result of the JQ query as a column of JSON-compatible strings
"""

return Expression._from_pyexpr(self._expr.json_query(jq_query))
return Expression._from_pyexpr(native.json_query(self._expr, jq_query))


class ExpressionEmbeddingNamespace(ExpressionNamespace):
Expand Down
5 changes: 0 additions & 5 deletions src/daft-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ html-escape = {workspace = true}
hyperloglog = {path = "../hyperloglog"}
indexmap = {workspace = true, features = ["serde"]}
itertools = {workspace = true}
jaq-core = {workspace = true}
jaq-interpret = {workspace = true}
jaq-parse = {workspace = true}
jaq-std = {workspace = true}
lazy_static = {workspace = true}
log = {workspace = true}
mur3 = "0.1.0"
Expand All @@ -46,7 +42,6 @@ num-traits = {workspace = true}
pyo3 = {workspace = true, optional = true}
regex = {workspace = true}
serde = {workspace = true}
serde_json = {workspace = true}
sketches-ddsketch = {workspace = true}
unicode-normalization = "0.1.23"

Expand Down
104 changes: 0 additions & 104 deletions src/daft-core/src/array/ops/json.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/daft-core/src/array/ops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ mod hll_merge;
mod hll_sketch;
mod if_else;
mod is_in;
mod json;
mod len;
mod list;
mod list_agg;
Expand Down
8 changes: 8 additions & 0 deletions src/daft-core/src/datatypes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,3 +362,11 @@ impl<T: DaftNumericType> DataArray<T> {
self.as_arrow().values().as_slice()
}
}

impl<P: AsRef<str>> FromIterator<Option<P>> for Utf8Array {
#[inline]
fn from_iter<I: IntoIterator<Item = Option<P>>>(iter: I) -> Self {
let arrow_arr = arrow2::array::Utf8Array::<i64>::from_iter(iter);
Self::from(("", Box::new(arrow_arr)))
}
}
17 changes: 0 additions & 17 deletions src/daft-core/src/series/ops/json.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/daft-core/src/series/ops/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ pub mod groups;
pub mod hash;
pub mod if_else;
pub mod is_in;
pub mod json;
pub mod len;
pub mod list;
pub mod log;
Expand Down
31 changes: 0 additions & 31 deletions src/daft-dsl/src/functions/json/mod.rs

This file was deleted.

51 changes: 0 additions & 51 deletions src/daft-dsl/src/functions/json/query.rs

This file was deleted.

4 changes: 0 additions & 4 deletions src/daft-dsl/src/functions/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pub mod float;
pub mod json;
pub mod list;
pub mod map;
pub mod numeric;
Expand All @@ -17,7 +16,6 @@ use std::hash::Hash;
use crate::{Expr, ExprRef, Operator};

use self::float::FloatExpr;
use self::json::JsonExpr;
use self::list::ListExpr;
use self::map::MapExpr;
use self::numeric::NumericExpr;
Expand Down Expand Up @@ -46,7 +44,6 @@ pub enum FunctionExpr {
Map(MapExpr),
Sketch(SketchExpr),
Struct(StructExpr),
Json(JsonExpr),
Python(PythonUDF),
Partitioning(PartitioningExpr),
}
Expand Down Expand Up @@ -75,7 +72,6 @@ impl FunctionExpr {
Map(expr) => expr.get_evaluator(),
Sketch(expr) => expr.get_evaluator(),
Struct(expr) => expr.get_evaluator(),
Json(expr) => expr.get_evaluator(),
Python(expr) => expr.get_evaluator(),
Partitioning(expr) => expr.get_evaluator(),
}
Expand Down
Loading

0 comments on commit 2e35d5b

Please sign in to comment.