You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by zh...@apache.org on 2025/09/05 10:50:55 UTC
(calcite) 09/09: Rename parameterType field to better reflect the semantics
This is an automated email from the ASF dual-hosted git repository.
zhenchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git
commit ea985dfb7345141d759c73d6ebbbebf8fae67e9b
Author: Michal Stutzmann <mi...@swisscom.com>
AuthorDate: Fri Sep 5 09:40:57 2025 +0200
Rename parameterType field to better reflect the semantics
---
.../org/apache/calcite/sql/type/FunctionSqlType.java | 18 +++++++++---------
.../apache/calcite/sql/type/FunctionSqlTypeTest.java | 16 ++++++++--------
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/core/src/main/java/org/apache/calcite/sql/type/FunctionSqlType.java b/core/src/main/java/org/apache/calcite/sql/type/FunctionSqlType.java
index 04c77a4585..009808a3e5 100644
--- a/core/src/main/java/org/apache/calcite/sql/type/FunctionSqlType.java
+++ b/core/src/main/java/org/apache/calcite/sql/type/FunctionSqlType.java
@@ -29,20 +29,20 @@
* <p>The type of lambda expression can be represented by a function type.
*/
public class FunctionSqlType extends AbstractSqlType {
- private final RelDataType parameterType;
+ private final RelDataType parameterTypes;
private final RelDataType returnType;
/**
* Constructs a new function SQL type. This should only be called from a factory method.
*
- * @param parameterType a struct type wrapping function's input parameter types.
+ * @param parameterTypes a struct type wrapping function's input parameter types.
* @param returnType function's return type.
*/
public FunctionSqlType(
- RelDataType parameterType, RelDataType returnType) {
+ RelDataType parameterTypes, RelDataType returnType) {
super(SqlTypeName.FUNCTION, true, null);
- this.parameterType = requireNonNull(parameterType, "parameterType");
- if (!parameterType.isStruct()) {
+ this.parameterTypes = requireNonNull(parameterTypes, "parameterTypes");
+ if (!parameterTypes.isStruct()) {
throw new IllegalArgumentException("ParameterType must be a struct");
}
this.returnType = requireNonNull(returnType, "returnType");
@@ -52,7 +52,7 @@ public FunctionSqlType(
@Override protected void generateTypeString(StringBuilder sb, boolean withDetail) {
sb.append("Function");
sb.append("(");
- for (Ord<RelDataTypeField> ord : Ord.zip(parameterType.getFieldList())) {
+ for (Ord<RelDataTypeField> ord : Ord.zip(parameterTypes.getFieldList())) {
if (ord.i > 0) {
sb.append(", ");
}
@@ -69,12 +69,12 @@ public FunctionSqlType(
}
/**
- * Returns the parameter type of the function.
+ * Returns the parameter types of the function.
*
* @return a struct wrapping function's parameter types.
*/
- public RelDataType getParameterType() {
- return parameterType;
+ public RelDataType getParameterTypes() {
+ return parameterTypes;
}
/**
diff --git a/core/src/test/java/org/apache/calcite/sql/type/FunctionSqlTypeTest.java b/core/src/test/java/org/apache/calcite/sql/type/FunctionSqlTypeTest.java
index 9c58170cd8..41bb3af475 100644
--- a/core/src/test/java/org/apache/calcite/sql/type/FunctionSqlTypeTest.java
+++ b/core/src/test/java/org/apache/calcite/sql/type/FunctionSqlTypeTest.java
@@ -34,14 +34,14 @@ public class FunctionSqlTypeTest {
final RelDataTypeFactory sqlTypeFactory =
new SqlTypeFactoryImpl(RelDataTypeSystem.DEFAULT);
- final RelDataType parameterType =
+ final RelDataType parameterTypes =
sqlTypeFactory.createStructType(
ImmutableList.of(sqlTypeFactory.createSqlType(SqlTypeName.BOOLEAN)),
ImmutableList.of("field1"));
- final RelDataType nonStructParameterType = sqlTypeFactory.createSqlType(SqlTypeName.BOOLEAN);
+ final RelDataType nonStructParameterTypes = sqlTypeFactory.createSqlType(SqlTypeName.BOOLEAN);
final RelDataType returnType = sqlTypeFactory.createSqlType(SqlTypeName.BOOLEAN);
final FunctionSqlType functionSqlType =
- new FunctionSqlType(parameterType, returnType);
+ new FunctionSqlType(parameterTypes, returnType);
@Test void testFailsOnNullParameterType() {
assertThrows(NullPointerException.class, () -> {
@@ -49,20 +49,20 @@ public class FunctionSqlTypeTest {
}, "parameterType");
}
- @Test void testFailsOnNonStructParameterType() {
+ @Test void testFailsOnNonStructParameterTypes() {
assertThrows(IllegalArgumentException.class, () -> {
- new FunctionSqlType(nonStructParameterType, returnType);
+ new FunctionSqlType(nonStructParameterTypes, returnType);
}, "ParameterType must be a struct");
}
@Test void testFailsOnNullReturnType() {
assertThrows(NullPointerException.class, () -> {
- new FunctionSqlType(parameterType, null);
+ new FunctionSqlType(parameterTypes, null);
});
}
- @Test void testGetParameterType() {
- assertEquals(parameterType, functionSqlType.getParameterType());
+ @Test void testGetParameterTypes() {
+ assertEquals(parameterTypes, functionSqlType.getParameterTypes());
}
@Test void testGetReturnType() {