Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/builder/analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,14 +657,15 @@ impl AnalyzerContext {
let source_factory = get_source_factory(&import_op.spec.source.kind)?;
let (output_type, executor) = source_factory
.build(
&import_op.name,
serde_json::Value::Object(import_op.spec.source.spec),
self.flow_ctx.clone(),
)
.await?;

let op_name = import_op.name.clone();
let op_name = import_op.name;
let primary_key_schema = Box::from(output_type.typ.key_schema());
let output = op_scope.add_op_output(import_op.name, output_type)?;
let output = op_scope.add_op_output(op_name.clone(), output_type)?;

let concur_control_options = import_op
.spec
Expand Down
7 changes: 5 additions & 2 deletions src/ops/factory_bases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ pub trait SourceFactoryBase: SourceFactory + Send + Sync + 'static {

async fn build_executor(
self: Arc<Self>,
source_name: &str,
spec: Self::Spec,
context: Arc<FlowInstanceContext>,
) -> Result<Box<dyn SourceExecutor>>;
Expand All @@ -237,6 +238,7 @@ pub trait SourceFactoryBase: SourceFactory + Send + Sync + 'static {
impl<T: SourceFactoryBase> SourceFactory for T {
async fn build(
self: Arc<Self>,
source_name: &str,
spec: serde_json::Value,
context: Arc<FlowInstanceContext>,
) -> Result<(
Expand All @@ -245,8 +247,9 @@ impl<T: SourceFactoryBase> SourceFactory for T {
)> {
let spec: T::Spec = serde_json::from_value(spec)?;
let output_schema = self.get_output_schema(&spec, &context).await?;
let executor = self.build_executor(spec, context);
Ok((output_schema, executor))
let source_name = source_name.to_string();
let executor = async move { self.build_executor(&source_name, spec, context).await };
Ok((output_schema, Box::pin(executor)))
}
}

Expand Down
1 change: 1 addition & 0 deletions src/ops/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ pub trait SourceExecutor: Send + Sync {
pub trait SourceFactory {
async fn build(
self: Arc<Self>,
source_name: &str,
spec: serde_json::Value,
context: Arc<FlowInstanceContext>,
) -> Result<(
Expand Down
1 change: 1 addition & 0 deletions src/ops/sources/amazon_s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ impl SourceFactoryBase for Factory {

async fn build_executor(
self: Arc<Self>,
_source_name: &str,
spec: Spec,
_context: Arc<FlowInstanceContext>,
) -> Result<Box<dyn SourceExecutor>> {
Expand Down
1 change: 1 addition & 0 deletions src/ops/sources/azure_blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ impl SourceFactoryBase for Factory {

async fn build_executor(
self: Arc<Self>,
_source_name: &str,
spec: Spec,
context: Arc<FlowInstanceContext>,
) -> Result<Box<dyn SourceExecutor>> {
Expand Down
1 change: 1 addition & 0 deletions src/ops/sources/google_drive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ impl SourceFactoryBase for Factory {

async fn build_executor(
self: Arc<Self>,
_source_name: &str,
spec: Spec,
_context: Arc<FlowInstanceContext>,
) -> Result<Box<dyn SourceExecutor>> {
Expand Down
1 change: 1 addition & 0 deletions src/ops/sources/local_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ impl SourceFactoryBase for Factory {

async fn build_executor(
self: Arc<Self>,
_source_name: &str,
spec: Spec,
_context: Arc<FlowInstanceContext>,
) -> Result<Box<dyn SourceExecutor>> {
Expand Down
1 change: 1 addition & 0 deletions src/ops/sources/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,7 @@ impl SourceFactoryBase for Factory {

async fn build_executor(
self: Arc<Self>,
_source_name: &str,
spec: Spec,
context: Arc<FlowInstanceContext>,
) -> Result<Box<dyn SourceExecutor>> {
Expand Down
Loading