Skip to content

Commit 30cb28e

Browse files
committed
Fix default value for concurrency in remote projection
the java code expects the input to be not present or a valid number. NULL is not accepted
1 parent ddcc01d commit 30cb28e

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

graphdatascience/procedure_surface/arrow/catalog_arrow_endpoints.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,12 @@ def project(
114114

115115
job_id = job_id if job_id is not None else str(uuid4())
116116

117-
params = {
118-
"concurrency": concurrency,
117+
params: dict[str, Any] = {
119118
"undirected_relationship_types": undirected_relationship_types,
120119
"inverse_indexed_relationship_types": inverse_indexed_relationship_types,
121120
}
121+
if concurrency is not None:
122+
params["concurrency"] = concurrency
122123

123124
project_params = self._project_protocol.project_params(graph_name, query, job_id, params, arrow_config)
124125

graphdatascience/query_runner/protocol/project_protocols.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def project_params(
5151
return CallParameters(
5252
graph_name=graph_name,
5353
query=query,
54-
concurrency=params["concurrency"],
54+
concurrency=params.get("concurrency", 4),
5555
undirected_relationship_types=params["undirected_relationship_types"],
5656
inverse_indexed_relationship_types=params["inverse_indexed_relationship_types"],
5757
arrow_configuration=arrow_config,
@@ -77,15 +77,17 @@ class ProjectProtocolV2(ProjectProtocol):
7777
def project_params(
7878
self, graph_name: str, query: str, job_id: str, params: dict[str, Any], arrow_config: dict[str, Any]
7979
) -> CallParameters:
80+
config = {
81+
"undirectedRelationshipTypes": params["undirected_relationship_types"],
82+
"inverseIndexedRelationshipTypes": params["inverse_indexed_relationship_types"],
83+
}
84+
if "concurrency" in params:
85+
config["concurrency"] = params["concurrency"]
8086
return CallParameters(
8187
graph_name=graph_name,
8288
query=query,
8389
arrow_configuration=arrow_config,
84-
configuration={
85-
"concurrency": params["concurrency"],
86-
"undirectedRelationshipTypes": params["undirected_relationship_types"],
87-
"inverseIndexedRelationshipTypes": params["inverse_indexed_relationship_types"],
88-
},
90+
configuration=config,
8991
)
9092

9193
def run_projection(
@@ -108,16 +110,19 @@ class ProjectProtocolV3(ProjectProtocol):
108110
def project_params(
109111
self, graph_name: str, query: str, job_id: str, params: dict[str, Any], arrow_config: dict[str, Any]
110112
) -> CallParameters:
113+
config = {
114+
"undirectedRelationshipTypes": params["undirected_relationship_types"],
115+
"inverseIndexedRelationshipTypes": params["inverse_indexed_relationship_types"],
116+
}
117+
if "concurrency" in params:
118+
config["concurrency"] = params["concurrency"]
119+
111120
return CallParameters(
112121
graph_name=graph_name,
113122
query=query,
114123
job_id=job_id,
115124
arrow_configuration=arrow_config,
116-
configuration={
117-
"concurrency": params["concurrency"],
118-
"undirectedRelationshipTypes": params["undirected_relationship_types"],
119-
"inverseIndexedRelationshipTypes": params["inverse_indexed_relationship_types"],
120-
},
125+
configuration=config,
121126
)
122127

123128
def run_projection(

0 commit comments

Comments
 (0)