This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/texera.git
The following commit(s) were added to refs/heads/main by this push:
new 097fecc56a refactor(amber): consolidate websocket request and response
models (#9304)
097fecc56a is described below
commit 097fecc56ad76e904a222e6bb3ff2cc3ee2ff597
Author: Xinyuan Lin <[email protected]>
AuthorDate: Sun Nov 8 02:03:01 2026 +0000
refactor(amber): consolidate websocket request and response models (#9304)
### What changes were proposed in this PR?
Consolidates remaining individual WebSocket request and response/event
case classes into their respective message model files:
-
`amber/src/main/scala/org/apache/texera/web/model/websocket/request/TexeraWebSocketRequest.scala`:
Consolidates `ModifyLogicRequest` and `ResultPaginationRequest` (2
standalone files deleted).
-
`amber/src/main/scala/org/apache/texera/web/model/websocket/response/TexeraWebSocketResponse.scala`:
Consolidates `HeartBeatResponse`, `ModifyLogicResponse`,
`ModifyLogicCompletedEvent`, `ClusterStatusUpdateEvent`, and
`RegionUpdateEvent` into a shared definitions file (4 standalone files
deleted).
Deletes 6 redundant single-class source files and repetitive license
headers (-109 net lines).
| Surface | Pinned |
| --- | --- |
| Package namespaces | `org.apache.texera.web.model.websocket.request`
and `org.apache.texera.web.model.websocket.response` unchanged |
| Class names & signatures | All case class names, field names, default
argument values, and types identical |
| Jackson polymorphic wire mappings | `@JsonTypeInfo` and
`@JsonSubTypes` discriminator resolutions preserved identically |
| Public API & imports | Unchanged; existing import sites continue to
resolve identically |
### Any related issues?
Closes #9303.
### How was this PR tested?
- **Tests passed**:
```bash
sbt "WorkflowExecutionService/testOnly
org.apache.texera.web.model.websocket.request.TexeraWebSocketRequestSpec
org.apache.texera.web.model.websocket.event.TexeraWebSocketEventSpec
org.apache.texera.web.resource.WorkflowWebsocketResourceSpec
org.apache.texera.web.WebsocketInputSpec"
```
- `TexeraWebSocketRequestSpec`: 12/12 passed (including
`ModifyLogicRequest` and `ResultPaginationRequest` default arguments)
- `TexeraWebSocketEventSpec`: 11/11 passed (including
`HeartBeatResponse`, `ModifyLogicResponse`, `ModifyLogicCompletedEvent`,
`ClusterStatusUpdateEvent`, `RegionUpdateEvent`)
- `WorkflowWebsocketResourceSpec`: 18/18 passed
- `WebsocketInputSpec`: 6/6 passed
- Total: 47/47 tests succeeded.
- **Code formatting & linting**:
```bash
sbt "WorkflowExecutionService/scalafmtCheck"
"WorkflowExecutionService/Test/scalafmtCheck"
sbt "WorkflowExecutionService/scalafix --check"
"WorkflowExecutionService/Test/scalafix --check"
```
All passed cleanly.
- **Net change**: 7 files changed, +19 / -128 (net -109 lines).
### Was this PR authored or co-authored using generative AI tooling?
No.
---
.../websocket/request/ModifyLogicRequest.scala | 24 ----------------
.../request/ResultPaginationRequest.scala | 32 ----------------------
.../websocket/request/TexeraWebSocketRequest.scala | 13 +++++++++
.../response/ClusterStatusUpdateEvent.scala | 24 ----------------
.../websocket/response/HeartBeatResponse.scala | 24 ----------------
.../websocket/response/RegionUpdateEvent.scala | 24 ----------------
...esponse.scala => TexeraWebSocketResponse.scala} | 6 ++++
7 files changed, 19 insertions(+), 128 deletions(-)
diff --git
a/amber/src/main/scala/org/apache/texera/web/model/websocket/request/ModifyLogicRequest.scala
b/amber/src/main/scala/org/apache/texera/web/model/websocket/request/ModifyLogicRequest.scala
deleted file mode 100644
index 84ae56eecc..0000000000
---
a/amber/src/main/scala/org/apache/texera/web/model/websocket/request/ModifyLogicRequest.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.texera.web.model.websocket.request
-
-import org.apache.texera.amber.operator.LogicalOp
-
-case class ModifyLogicRequest(operator: LogicalOp) extends
TexeraWebSocketRequest
diff --git
a/amber/src/main/scala/org/apache/texera/web/model/websocket/request/ResultPaginationRequest.scala
b/amber/src/main/scala/org/apache/texera/web/model/websocket/request/ResultPaginationRequest.scala
deleted file mode 100644
index 2696d90bcb..0000000000
---
a/amber/src/main/scala/org/apache/texera/web/model/websocket/request/ResultPaginationRequest.scala
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.texera.web.model.websocket.request
-
-case class ResultPaginationRequest(
- requestID: String,
- operatorID: String,
- pageIndex: Int,
- pageSize: Int,
- columnOffset: Int = 0,
- columnLimit: Int = Int.MaxValue,
- columnSearch: Option[String] = None,
- // which of the operator's output ports to read; an operator with one
output has only port 0
- portIndex: Int = 0
-) extends TexeraWebSocketRequest
diff --git
a/amber/src/main/scala/org/apache/texera/web/model/websocket/request/TexeraWebSocketRequest.scala
b/amber/src/main/scala/org/apache/texera/web/model/websocket/request/TexeraWebSocketRequest.scala
index 5a1575df72..dc0cba77fb 100644
---
a/amber/src/main/scala/org/apache/texera/web/model/websocket/request/TexeraWebSocketRequest.scala
+++
b/amber/src/main/scala/org/apache/texera/web/model/websocket/request/TexeraWebSocketRequest.scala
@@ -21,6 +21,7 @@ package org.apache.texera.web.model.websocket.request
import com.fasterxml.jackson.annotation.JsonSubTypes.Type
import com.fasterxml.jackson.annotation.{JsonSubTypes, JsonTypeInfo}
+import org.apache.texera.amber.operator.LogicalOp
import org.apache.texera.web.model.websocket.request.python.{
DebugCommandRequest,
PythonExpressionEvaluateRequest
@@ -46,6 +47,18 @@ import org.apache.texera.web.model.websocket.request.python.{
trait TexeraWebSocketRequest {}
case class HeartBeatRequest() extends TexeraWebSocketRequest
+case class ModifyLogicRequest(operator: LogicalOp) extends
TexeraWebSocketRequest
+case class ResultPaginationRequest(
+ requestID: String,
+ operatorID: String,
+ pageIndex: Int,
+ pageSize: Int,
+ columnOffset: Int = 0,
+ columnLimit: Int = Int.MaxValue,
+ columnSearch: Option[String] = None,
+ // which of the operator's output ports to read; an operator with one
output has only port 0
+ portIndex: Int = 0
+) extends TexeraWebSocketRequest
case class RetryRequest(workers: Seq[String]) extends TexeraWebSocketRequest
case class SkipTupleRequest(workerIds: Array[String]) extends
TexeraWebSocketRequest
case class WorkflowCheckpointRequest() extends TexeraWebSocketRequest
diff --git
a/amber/src/main/scala/org/apache/texera/web/model/websocket/response/ClusterStatusUpdateEvent.scala
b/amber/src/main/scala/org/apache/texera/web/model/websocket/response/ClusterStatusUpdateEvent.scala
deleted file mode 100644
index 5e6b187e9c..0000000000
---
a/amber/src/main/scala/org/apache/texera/web/model/websocket/response/ClusterStatusUpdateEvent.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.texera.web.model.websocket.response
-
-import org.apache.texera.web.model.websocket.event.TexeraWebSocketEvent
-
-case class ClusterStatusUpdateEvent(numWorkers: Int) extends
TexeraWebSocketEvent
diff --git
a/amber/src/main/scala/org/apache/texera/web/model/websocket/response/HeartBeatResponse.scala
b/amber/src/main/scala/org/apache/texera/web/model/websocket/response/HeartBeatResponse.scala
deleted file mode 100644
index bf4beca397..0000000000
---
a/amber/src/main/scala/org/apache/texera/web/model/websocket/response/HeartBeatResponse.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.texera.web.model.websocket.response
-
-import org.apache.texera.web.model.websocket.event.TexeraWebSocketEvent
-
-case class HeartBeatResponse() extends TexeraWebSocketEvent
diff --git
a/amber/src/main/scala/org/apache/texera/web/model/websocket/response/RegionUpdateEvent.scala
b/amber/src/main/scala/org/apache/texera/web/model/websocket/response/RegionUpdateEvent.scala
deleted file mode 100644
index 9578b28b46..0000000000
---
a/amber/src/main/scala/org/apache/texera/web/model/websocket/response/RegionUpdateEvent.scala
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.texera.web.model.websocket.response
-
-import org.apache.texera.web.model.websocket.event.TexeraWebSocketEvent
-
-case class RegionUpdateEvent(regions: List[(Long, List[String])]) extends
TexeraWebSocketEvent
diff --git
a/amber/src/main/scala/org/apache/texera/web/model/websocket/response/ModifyLogicResponse.scala
b/amber/src/main/scala/org/apache/texera/web/model/websocket/response/TexeraWebSocketResponse.scala
similarity index 82%
rename from
amber/src/main/scala/org/apache/texera/web/model/websocket/response/ModifyLogicResponse.scala
rename to
amber/src/main/scala/org/apache/texera/web/model/websocket/response/TexeraWebSocketResponse.scala
index d2270cfeff..2b671bfe7c 100644
---
a/amber/src/main/scala/org/apache/texera/web/model/websocket/response/ModifyLogicResponse.scala
+++
b/amber/src/main/scala/org/apache/texera/web/model/websocket/response/TexeraWebSocketResponse.scala
@@ -21,6 +21,8 @@ package org.apache.texera.web.model.websocket.response
import org.apache.texera.web.model.websocket.event.TexeraWebSocketEvent
+case class HeartBeatResponse() extends TexeraWebSocketEvent
+
case class ModifyLogicResponse(
opId: String,
isValid: Boolean,
@@ -30,3 +32,7 @@ case class ModifyLogicResponse(
case class ModifyLogicCompletedEvent(
opIds: List[String]
) extends TexeraWebSocketEvent
+
+case class ClusterStatusUpdateEvent(numWorkers: Int) extends
TexeraWebSocketEvent
+
+case class RegionUpdateEvent(regions: List[(Long, List[String])]) extends
TexeraWebSocketEvent