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 2023/07/11 09:08:42 UTC
[calcite] branch main updated: [MINOR] Adjust nullableType and java doc for RexProgramBuilderBase
This is an automated email from the ASF dual-hosted git repository.
zhehu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git
The following commit(s) were added to refs/heads/main by this push:
new baf37913f7 [MINOR] Adjust nullableType and java doc for RexProgramBuilderBase
baf37913f7 is described below
commit baf37913f75908537ac63deb2f4bfb8e6dc77aee
Author: ILuffZhe <il...@163.com>
AuthorDate: Sat Jul 8 09:06:50 2023 +0800
[MINOR] Adjust nullableType and java doc for RexProgramBuilderBase
---
.../apache/calcite/rex/RexProgramBuilderBase.java | 27 ++++++++++++----------
1 file changed, 15 insertions(+), 12 deletions(-)
diff --git a/core/src/test/java/org/apache/calcite/rex/RexProgramBuilderBase.java b/core/src/test/java/org/apache/calcite/rex/RexProgramBuilderBase.java
index 7fc52d9efa..36fec90759 100644
--- a/core/src/test/java/org/apache/calcite/rex/RexProgramBuilderBase.java
+++ b/core/src/test/java/org/apache/calcite/rex/RexProgramBuilderBase.java
@@ -147,6 +147,8 @@ public abstract class RexProgramBuilderBase {
});
}
+ // Operators
+
protected RexNode isNull(RexNode node) {
return rexBuilder.makeCall(SqlStdOperatorTable.IS_NULL, node);
}
@@ -341,6 +343,7 @@ public abstract class RexProgramBuilderBase {
}
// Types
+
protected RelDataType nullable(RelDataType type) {
if (type.isNullable()) {
return type;
@@ -368,7 +371,6 @@ public abstract class RexProgramBuilderBase {
return sqlType;
}
-
protected RelDataType tChar(int precision) {
return tChar(false, precision);
}
@@ -437,6 +439,7 @@ public abstract class RexProgramBuilderBase {
protected RelDataType tArray(RelDataType elemType) {
return typeFactory.createArrayType(elemType, -1);
}
+
// Literals
/**
@@ -529,7 +532,7 @@ public abstract class RexProgramBuilderBase {
* @return nullable boolean variable with given index (0-based)
*/
protected RexNode vBool(int arg) {
- return vParam("bool", arg, nonNullableBool);
+ return vParam("bool", arg, nullableBool);
}
/**
@@ -573,7 +576,7 @@ public abstract class RexProgramBuilderBase {
* @return nullable int variable with given index (0-based)
*/
protected RexNode vInt(int arg) {
- return vParam("int", arg, nonNullableInt);
+ return vParam("int", arg, nullableInt);
}
/**
@@ -603,7 +606,7 @@ public abstract class RexProgramBuilderBase {
* If you need several distinct variables, use {@link #vSmallInt(int)}.
* The resulting node would look like {@code ?0.notNullSmallInt0}
*
- * @return nullable int variable with index of 0
+ * @return nullable smallint variable with index of 0
*/
protected RexNode vSmallInt() {
return vSmallInt(0);
@@ -614,10 +617,10 @@ public abstract class RexProgramBuilderBase {
* The resulting node would look like {@code ?0.int3} if {@code arg} is {@code 3}.
*
* @param arg argument index (0-based)
- * @return nullable int variable with given index (0-based)
+ * @return nullable smallint variable with given index (0-based)
*/
protected RexNode vSmallInt(int arg) {
- return vParam("smallint", arg, nonNullableSmallInt);
+ return vParam("smallint", arg, nullableSmallInt);
}
/**
@@ -625,7 +628,7 @@ public abstract class RexProgramBuilderBase {
* If you need several distinct variables, use {@link #vSmallIntNotNull(int)}.
* The resulting node would look like {@code ?0.notNullSmallInt0}
*
- * @return non-nullable int variable with index of 0
+ * @return non-nullable smallint variable with index of 0
*/
protected RexNode vSmallIntNotNull() {
return vSmallIntNotNull(0);
@@ -636,7 +639,7 @@ public abstract class RexProgramBuilderBase {
* The resulting node would look like {@code ?0.notNullSmallInt3} if {@code arg} is {@code 3}.
*
* @param arg argument index (0-based)
- * @return non-nullable int variable with given index (0-based)
+ * @return non-nullable smallint variable with given index (0-based)
*/
protected RexNode vSmallIntNotNull(int arg) {
return vParamNotNull("smallint", arg, nonNullableSmallInt);
@@ -661,7 +664,7 @@ public abstract class RexProgramBuilderBase {
* @return nullable varchar variable with given index (0-based)
*/
protected RexNode vVarchar(int arg) {
- return vParam("varchar", arg, nonNullableVarchar);
+ return vParam("varchar", arg, nullableVarchar);
}
/**
@@ -705,7 +708,7 @@ public abstract class RexProgramBuilderBase {
* @return nullable decimal variable with given index (0-based)
*/
protected RexNode vDecimal(int arg) {
- return vParam("decimal", arg, nonNullableDecimal);
+ return vParam("decimal", arg, nullableDecimal);
}
/**
@@ -769,7 +772,7 @@ public abstract class RexProgramBuilderBase {
* {@link #vParamNotNull(String, int, RelDataType)}
*
* @param name variable name prefix
- * @return nullable variable of a given type
+ * @return non-nullable variable of a given type
*/
protected RexNode vParamNotNull(String name, RelDataType type) {
return vParamNotNull(name, 0, type);
@@ -784,7 +787,7 @@ public abstract class RexProgramBuilderBase {
*
* @param name variable name prefix
* @param arg argument index (0-based)
- * @return nullable varchar variable with given index (0-based)
+ * @return non-nullable varchar variable with given index (0-based)
*/
protected RexNode vParamNotNull(String name, int arg, RelDataType type) {
assertArgValue(arg);