File tree Expand file tree Collapse file tree 10 files changed +21
-20
lines changed Expand file tree Collapse file tree 10 files changed +21
-20
lines changed Original file line number Diff line number Diff line change @@ -46,15 +46,15 @@ import os
4646import pandas as pd
4747import ray
4848
49- from datafusion_ray import RaySqlContext
49+ from datafusion_ray import DatafusionRayContext
5050
5151SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__ ))
5252
5353# Start a local cluster
5454ray.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)
6060ctx.register_parquet(" tips" , f " { SCRIPT_DIR } /tips.parquet " )
Original file line number Diff line number Diff 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 )
Original file line number Diff line number Diff line change 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__ )
Original file line number Diff line number Diff line change 2727from datafusion_ray import Context , ExecutionGraph , QueryStage
2828from typing import List
2929
30+
3031def 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
Original file line number Diff line number Diff line change 2020
2121from pyarrow import csv as pacsv
2222import ray
23- from datafusion_ray import RaySqlContext
23+ from datafusion_ray import DatafusionRayContext
2424
2525NUM_CPUS_PER_WORKER = 8
2626
3131RESULTS_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
6262def tpch_timing (
63- ctx : RaySqlContext ,
63+ ctx : DatafusionRayContext ,
6464 q : int = 1 ,
6565 print_result : bool = False ,
6666 write_result : bool = False ,
Original file line number Diff line number Diff line change 1919import pandas as pd
2020import ray
2121
22- from raysql import RaySqlContext
22+ from datafusion_ray import DatafusionRayContext
2323
2424SCRIPT_DIR = os .path .dirname (os .path .realpath (__file__ ))
2525
2626# Start a local cluster
2727ray .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)
3333ctx .register_parquet ("tips" , f"{ SCRIPT_DIR } /tips.parquet" )
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ use tokio::task::JoinHandle;
4444
4545type PyResultSet = Vec < PyObject > ;
4646
47- #[ pyclass( name = "Context" , module = "raysql " , subclass) ]
47+ #[ pyclass( name = "Context" , module = "datafusion_ray " , subclass) ]
4848pub struct PyContext {
4949 pub ( crate ) ctx : SessionContext ,
5050 use_ray_shuffle : bool ,
Original file line number Diff line number Diff 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 > ( ) ?;
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ use std::sync::atomic::{AtomicUsize, Ordering};
3232use std:: sync:: Arc ;
3333use uuid:: Uuid ;
3434
35- #[ pyclass( name = "ExecutionGraph" , module = "raysql " , subclass) ]
35+ #[ pyclass( name = "ExecutionGraph" , module = "datafusion_ray " , subclass) ]
3636pub struct PyExecutionGraph {
3737 pub graph : ExecutionGraph ,
3838}
Original file line number Diff line number Diff line change 11syntax = "proto3" ;
22
3- package raysql .protobuf ;
3+ package datafusion_ray .protobuf ;
44
55option java_multiple_files = true ;
6- option java_package = "raysql .protobuf" ;
6+ option java_package = "datafusion_ray .protobuf" ;
77option java_outer_classname = "RaySqlProto" ;
88
99import "datafusion.proto" ;
You can’t perform that action at this time.
0 commit comments