This is an automated email from the ASF dual-hosted git repository.
jiadongb 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 0965b80ebe refactor(scala): move SortCriteriaUnit and HyperParameters
from Java to Scala (#4186)
0965b80ebe is described below
commit 0965b80ebe2d24d06d87805308224f39f83fa793
Author: carloea2 <[email protected]>
AuthorDate: Fri Jan 30 16:19:08 2026 -0800
refactor(scala): move SortCriteriaUnit and HyperParameters from Java to
Scala (#4186)
### What changes were proposed in this PR?
This PR moves two existing classes from Java to Scala (no functional
changes intended),
1. SortCriteriaUnit →`
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/sort/SortCriteriaUnit.scala`
2.
3. HyperParameters →
`common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/machineLearning/sklearnAdvanced/base/HyperParameters.scala`
### Any related issues, documentation, discussions?
No
### How was this PR tested?
Existing tests for operators
### Was this PR authored or co-authored using generative AI tooling?
No
---
.../sklearnAdvanced/base/HyperParameters.java | 58 ------------------
.../sklearnAdvanced/base/HyperParameters.scala | 68 ++++++++++++++++++++++
...ortCriteriaUnit.java => SortCriteriaUnit.scala} | 23 ++++----
3 files changed, 79 insertions(+), 70 deletions(-)
diff --git
a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/machineLearning/sklearnAdvanced/base/HyperParameters.java
b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/machineLearning/sklearnAdvanced/base/HyperParameters.java
deleted file mode 100644
index 06906325ba..0000000000
---
a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/machineLearning/sklearnAdvanced/base/HyperParameters.java
+++ /dev/null
@@ -1,58 +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.amber.operator.machineLearning.sklearnAdvanced.base;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyDescription;
-import com.kjetland.jackson.jsonSchema.annotations.*;
-import
org.apache.texera.amber.operator.metadata.annotations.CommonOpDescAnnotation;
-import org.apache.texera.amber.operator.metadata.annotations.HideAnnotation;
-
-public class HyperParameters<T> {
- @JsonProperty(required = true)
- @JsonSchemaTitle("Parameter")
- @JsonPropertyDescription("Choose the name of the parameter")
- public T parameter;
-
- @JsonSchemaInject(
- strings = {
- @JsonSchemaString(path = CommonOpDescAnnotation.autofill,
value = CommonOpDescAnnotation.attributeName),
- @JsonSchemaString(path = HideAnnotation.hideTarget, value
= "parametersSource"),
- @JsonSchemaString(path = HideAnnotation.hideType, value =
HideAnnotation.Type.equals),
- @JsonSchemaString(path = HideAnnotation.hideExpectedValue,
value = "false")
- },
- ints = @JsonSchemaInt(path =
CommonOpDescAnnotation.autofillAttributeOnPort, value = 1))
- @JsonProperty(value = "attribute")
- public String attribute;
-
- @JsonSchemaInject(strings = {
- @JsonSchemaString(path = HideAnnotation.hideTarget, value =
"parametersSource"),
- @JsonSchemaString(path = HideAnnotation.hideType, value =
HideAnnotation.Type.equals),
- @JsonSchemaString(path = HideAnnotation.hideExpectedValue, value =
"true")
- },
- bools = @JsonSchemaBool(path = HideAnnotation.hideOnNull, value =
true))
- @JsonProperty(value = "value")
- public String value;
-
- @JsonProperty(defaultValue = "false")
- @JsonSchemaTitle("Workflow")
- @JsonPropertyDescription("Parameter from workflow")
- public boolean parametersSource;
-}
diff --git
a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/machineLearning/sklearnAdvanced/base/HyperParameters.scala
b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/machineLearning/sklearnAdvanced/base/HyperParameters.scala
new file mode 100644
index 0000000000..f947ee6948
--- /dev/null
+++
b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/machineLearning/sklearnAdvanced/base/HyperParameters.scala
@@ -0,0 +1,68 @@
+/*
+ * 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.amber.operator.machineLearning.sklearnAdvanced.base
+
+import com.fasterxml.jackson.annotation.{JsonProperty, JsonPropertyDescription}
+import com.kjetland.jackson.jsonSchema.annotations._
+import org.apache.texera.amber.operator.metadata.annotations.{
+ CommonOpDescAnnotation,
+ HideAnnotation
+}
+
+class HyperParameters[T] {
+
+ @JsonProperty(required = true)
+ @JsonSchemaTitle("Parameter")
+ @JsonPropertyDescription("Choose the name of the parameter")
+ var parameter: T = _
+
+ @JsonSchemaInject(
+ strings = Array(
+ new JsonSchemaString(
+ path = CommonOpDescAnnotation.autofill,
+ value = CommonOpDescAnnotation.attributeName
+ ),
+ new JsonSchemaString(path = HideAnnotation.hideTarget, value =
"parametersSource"),
+ new JsonSchemaString(path = HideAnnotation.hideType, value =
HideAnnotation.Type.`equals`),
+ new JsonSchemaString(path = HideAnnotation.hideExpectedValue, value =
"false")
+ ),
+ ints = Array(
+ new JsonSchemaInt(path = CommonOpDescAnnotation.autofillAttributeOnPort,
value = 1)
+ )
+ )
+ @JsonProperty(value = "attribute")
+ var attribute: String = _
+
+ @JsonSchemaInject(
+ strings = Array(
+ new JsonSchemaString(path = HideAnnotation.hideTarget, value =
"parametersSource"),
+ new JsonSchemaString(path = HideAnnotation.hideType, value =
HideAnnotation.Type.`equals`),
+ new JsonSchemaString(path = HideAnnotation.hideExpectedValue, value =
"true")
+ ),
+ bools = Array(new JsonSchemaBool(path = HideAnnotation.hideOnNull, value =
true))
+ )
+ @JsonProperty(value = "value")
+ var value: String = _
+
+ @JsonProperty(defaultValue = "false")
+ @JsonSchemaTitle("Workflow")
+ @JsonPropertyDescription("Parameter from workflow")
+ var parametersSource: Boolean = false
+}
diff --git
a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/sort/SortCriteriaUnit.java
b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/sort/SortCriteriaUnit.scala
similarity index 59%
rename from
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/sort/SortCriteriaUnit.java
rename to
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/sort/SortCriteriaUnit.scala
index 09c35a8c1b..b4bae266ef 100644
---
a/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/sort/SortCriteriaUnit.java
+++
b/common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/sort/SortCriteriaUnit.scala
@@ -17,20 +17,19 @@
* under the License.
*/
-package org.apache.texera.amber.operator.sort;
+package org.apache.texera.amber.operator.sort
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyDescription;
-import
org.apache.texera.amber.operator.metadata.annotations.AutofillAttributeName;
+import com.fasterxml.jackson.annotation.{JsonProperty, JsonPropertyDescription}
+import
org.apache.texera.amber.operator.metadata.annotations.AutofillAttributeName
-public class SortCriteriaUnit {
+class SortCriteriaUnit {
- @JsonProperty(value = "attribute", required = true)
- @JsonPropertyDescription("Attribute name to sort by")
- @AutofillAttributeName
- public String attributeName;
+ @JsonProperty(value = "attribute", required = true)
+ @JsonPropertyDescription("Attribute name to sort by")
+ @AutofillAttributeName
+ var attributeName: String = _
- @JsonProperty(value = "sortPreference", required = true)
- @JsonPropertyDescription("Sort preference (ASC or DESC)")
- public org.apache.texera.amber.operator.sort.SortPreference sortPreference;
+ @JsonProperty(value = "sortPreference", required = true)
+ @JsonPropertyDescription("Sort preference (ASC or DESC)")
+ var sortPreference: SortPreference = _
}