Skip to content

Commit 2523e9f

Browse files
authored
Rename from raysql to datafusion_ray in multiple places (#13)
1 parent fe86387 commit 2523e9f

File tree

10 files changed

+21
-20
lines changed

10 files changed

+21
-20
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ import os
4646
import pandas as pd
4747
import ray
4848

49-
from datafusion_ray import RaySqlContext
49+
from datafusion_ray import DatafusionRayContext
5050

5151
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
5252

5353
# Start a local cluster
5454
ray.init(resources={"worker": 1})
5555

5656
# Create a context and register a table
57-
ctx = RaySqlContext(2, use_ray_shuffle=True)
57+
ctx = DatafusionRayContext(2, use_ray_shuffle=True)
5858
# Register either a CSV or Parquet file
5959
# ctx.register_csv("tips", f"{SCRIPT_DIR}/tips.csv", True)
6060
ctx.register_parquet("tips", f"{SCRIPT_DIR}/tips.parquet")

build.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ fn main() -> Result<(), String> {
3232

3333
// We don't include the proto files in releases so that downstreams
3434
// do not need to have PROTOC included
35-
if Path::new("src/proto/raysql.proto").exists() {
35+
if Path::new("src/proto/datafusion-ray.proto").exists() {
3636
println!("cargo:rerun-if-changed=src/proto/datafusion.proto");
37-
println!("cargo:rerun-if-changed=src/proto/raysql.proto");
37+
println!("cargo:rerun-if-changed=src/proto/datafusion-ray.proto");
3838
tonic_build::configure()
3939
.extern_path(".datafusion", "::datafusion_proto::protobuf")
40-
.compile(&["src/proto/raysql.proto"], &["src/proto"])
40+
.compile(&["src/proto/datafusion-ray.proto"], &["src/proto"])
4141
.map_err(|e| format!("protobuf compilation failed: {e}"))?;
42-
let generated_source_path = out.join("raysql.protobuf.rs");
42+
let generated_source_path = out.join("datafusion-ray.protobuf.rs");
4343
let code = std::fs::read_to_string(generated_source_path).unwrap();
4444
let mut file = std::fs::OpenOptions::new()
4545
.write(true)

datafusion_ray/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
serialize_execution_plan,
2929
deserialize_execution_plan,
3030
)
31-
from .context import RaySqlContext
31+
from .context import DatafusionRayContext
3232

3333
__version__ = importlib_metadata.version(__name__)

datafusion_ray/context.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
from datafusion_ray import Context, ExecutionGraph, QueryStage
2828
from typing import List
2929

30+
3031
def schedule_execution(
3132
graph: ExecutionGraph,
3233
stage_id: int,
@@ -208,7 +209,7 @@ def execute_query_partition(
208209
return ret[0] if len(ret) == 1 else ret
209210

210211

211-
class RaySqlContext:
212+
class DatafusionRayContext:
212213
def __init__(self, num_workers: int = 1, use_ray_shuffle: bool = False):
213214
self.ctx = Context(num_workers, use_ray_shuffle)
214215
self.num_workers = num_workers

datafusion_ray/main.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
from pyarrow import csv as pacsv
2222
import ray
23-
from datafusion_ray import RaySqlContext
23+
from datafusion_ray import DatafusionRayContext
2424

2525
NUM_CPUS_PER_WORKER = 8
2626

@@ -31,9 +31,9 @@
3131
RESULTS_DIR = f"results-sf{SF}"
3232

3333

34-
def setup_context(use_ray_shuffle: bool, num_workers: int = 2) -> RaySqlContext:
34+
def setup_context(use_ray_shuffle: bool, num_workers: int = 2) -> DatafusionRayContext:
3535
print(f"Using {num_workers} workers")
36-
ctx = RaySqlContext(num_workers, use_ray_shuffle)
36+
ctx = DatafusionRayContext(num_workers, use_ray_shuffle)
3737
for table in [
3838
"customer",
3939
"lineitem",
@@ -53,14 +53,14 @@ def load_query(n: int) -> str:
5353
return fin.read()
5454

5555

56-
def tpch_query(ctx: RaySqlContext, q: int = 1):
56+
def tpch_query(ctx: DatafusionRayContext, q: int = 1):
5757
sql = load_query(q)
5858
result_set = ctx.sql(sql)
5959
return result_set
6060

6161

6262
def tpch_timing(
63-
ctx: RaySqlContext,
63+
ctx: DatafusionRayContext,
6464
q: int = 1,
6565
print_result: bool = False,
6666
write_result: bool = False,

examples/tips.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
import pandas as pd
2020
import ray
2121

22-
from raysql import RaySqlContext
22+
from datafusion_ray import DatafusionRayContext
2323

2424
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
2525

2626
# Start a local cluster
2727
ray.init(resources={"worker": 1})
2828

2929
# Create a context and register a table
30-
ctx = RaySqlContext(2, use_ray_shuffle=True)
30+
ctx = DatafusionRayContext(2, use_ray_shuffle=True)
3131
# Register either a CSV or Parquet file
3232
# ctx.register_csv("tips", f"{SCRIPT_DIR}/tips.csv", True)
3333
ctx.register_parquet("tips", f"{SCRIPT_DIR}/tips.parquet")

src/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use tokio::task::JoinHandle;
4444

4545
type PyResultSet = Vec<PyObject>;
4646

47-
#[pyclass(name = "Context", module = "raysql", subclass)]
47+
#[pyclass(name = "Context", module = "datafusion_ray", subclass)]
4848
pub struct PyContext {
4949
pub(crate) ctx: SessionContext,
5050
use_ray_shuffle: bool,

src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub mod utils;
3131

3232
/// A Python module implemented in Rust.
3333
#[pymodule]
34-
fn _datafusion_ray_internal(_py: Python, m: &PyModule) -> PyResult<()> {
34+
fn _datafusion_ray_internal(m: &Bound<'_, PyModule>) -> PyResult<()> {
3535
// register classes that can be created directly from Python code
3636
m.add_class::<context::PyContext>()?;
3737
m.add_class::<planner::PyExecutionGraph>()?;

src/planner.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
3232
use std::sync::Arc;
3333
use uuid::Uuid;
3434

35-
#[pyclass(name = "ExecutionGraph", module = "raysql", subclass)]
35+
#[pyclass(name = "ExecutionGraph", module = "datafusion_ray", subclass)]
3636
pub struct PyExecutionGraph {
3737
pub graph: ExecutionGraph,
3838
}

src/proto/raysql.proto src/proto/datafusion_ray.proto

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
syntax = "proto3";
22

3-
package raysql.protobuf;
3+
package datafusion_ray.protobuf;
44

55
option java_multiple_files = true;
6-
option java_package = "raysql.protobuf";
6+
option java_package = "datafusion_ray.protobuf";
77
option java_outer_classname = "RaySqlProto";
88

99
import "datafusion.proto";

0 commit comments

Comments
 (0)