diff --git a/partiql-ast/api/partiql-ast.api b/partiql-ast/api/partiql-ast.api index d4a017592..e31c4c6b0 100644 --- a/partiql-ast/api/partiql-ast.api +++ b/partiql-ast/api/partiql-ast.api @@ -2816,11 +2816,11 @@ public class org/partiql/ast/expr/TrimSpec : org/partiql/ast/AstEnum { public class org/partiql/ast/expr/TruthValue : org/partiql/ast/AstEnum { public static final field FALSE I public static final field TRUE I - public static final field UNK I + public static final field UNKNOWN I public fun (I)V public static fun FALSE ()Lorg/partiql/ast/expr/TruthValue; public static fun TRUE ()Lorg/partiql/ast/expr/TruthValue; - public static fun UNK ()Lorg/partiql/ast/expr/TruthValue; + public static fun UNKNOWN ()Lorg/partiql/ast/expr/TruthValue; public fun accept (Lorg/partiql/ast/AstVisitor;Ljava/lang/Object;)Ljava/lang/Object; protected fun canEqual (Ljava/lang/Object;)Z public fun code ()I diff --git a/partiql-ast/src/main/java/org/partiql/ast/expr/TruthValue.java b/partiql-ast/src/main/java/org/partiql/ast/expr/TruthValue.java index 167f7457d..003cacf66 100644 --- a/partiql-ast/src/main/java/org/partiql/ast/expr/TruthValue.java +++ b/partiql-ast/src/main/java/org/partiql/ast/expr/TruthValue.java @@ -15,7 +15,7 @@ public class TruthValue extends AstEnum { public static final int TRUE = 0; public static final int FALSE = 1; - public static final int UNK = 2; + public static final int UNKNOWN = 2; private final int code; @@ -31,8 +31,8 @@ public static TruthValue FALSE() { return new TruthValue(FALSE); } - public static TruthValue UNK() { - return new TruthValue(UNK); + public static TruthValue UNKNOWN() { + return new TruthValue(UNKNOWN); } @Override @@ -46,7 +46,7 @@ public String name() { switch (code) { case TRUE: return "TRUE"; case FALSE: return "FALSE"; - case UNK: return "UNK"; + case UNKNOWN: return "UNK"; default: throw new IllegalStateException("Invalid TruthValue code: " + code); } } @@ -56,7 +56,7 @@ public static TruthValue parse(@NotNull String value) { switch (value) { case "TRUE": return TruthValue.TRUE(); case "FALSE": return TruthValue.FALSE(); - case "UNK": return TruthValue.UNK(); + case "UNK": return TruthValue.UNKNOWN(); default: throw new IllegalArgumentException("No enum constant TruthValue." + value); } } diff --git a/partiql-ast/src/main/java/org/partiql/ast/sql/SqlDialect.kt b/partiql-ast/src/main/java/org/partiql/ast/sql/SqlDialect.kt index e916bb953..759d6c9f5 100644 --- a/partiql-ast/src/main/java/org/partiql/ast/sql/SqlDialect.kt +++ b/partiql-ast/src/main/java/org/partiql/ast/sql/SqlDialect.kt @@ -442,7 +442,7 @@ public abstract class SqlDialect : AstVisitor() { t = t concat when (node.truthValue.code()) { TruthValue.TRUE -> "TRUE" TruthValue.FALSE -> "FALSE" - TruthValue.UNK -> "UNKNOWN" + TruthValue.UNKNOWN -> "UNKNOWN" else -> throw UnsupportedOperationException("Cannot print $node") } return t diff --git a/partiql-ast/src/test/kotlin/org/partiql/ast/sql/SqlDialectTest.kt b/partiql-ast/src/test/kotlin/org/partiql/ast/sql/SqlDialectTest.kt index df7270383..9a2123e31 100644 --- a/partiql-ast/src/test/kotlin/org/partiql/ast/sql/SqlDialectTest.kt +++ b/partiql-ast/src/test/kotlin/org/partiql/ast/sql/SqlDialectTest.kt @@ -1043,7 +1043,7 @@ class SqlDialectTest { exprBoolTest( value = v("x"), not = false, - truthValue = TruthValue.UNK() + truthValue = TruthValue.UNKNOWN() ) ), expect( @@ -1051,7 +1051,7 @@ class SqlDialectTest { exprBoolTest( value = v("x"), not = true, - truthValue = TruthValue.UNK() + truthValue = TruthValue.UNKNOWN() ) ), // IS [NOT] NULL diff --git a/partiql-parser/src/main/kotlin/org/partiql/parser/internal/PartiQLParserDefault.kt b/partiql-parser/src/main/kotlin/org/partiql/parser/internal/PartiQLParserDefault.kt index 653e9ad10..330bd410e 100644 --- a/partiql-parser/src/main/kotlin/org/partiql/parser/internal/PartiQLParserDefault.kt +++ b/partiql-parser/src/main/kotlin/org/partiql/parser/internal/PartiQLParserDefault.kt @@ -1408,7 +1408,7 @@ internal class PartiQLParserDefault : PartiQLParser { when (ctx.truthValue.type) { GeneratedParser.TRUE -> exprBoolTest(expr, not, TruthValue.TRUE()) GeneratedParser.FALSE -> exprBoolTest(expr, not, TruthValue.FALSE()) - GeneratedParser.UNKNOWN -> exprBoolTest(expr, not, TruthValue.UNK()) + GeneratedParser.UNKNOWN -> exprBoolTest(expr, not, TruthValue.UNKNOWN()) else -> throw error(ctx, "Unexpected value for boolean test IS [NOT] TRUE|FALSE|UNKNOWN") } } diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RexConverter.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RexConverter.kt index 7f90b039a..04a87d147 100644 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RexConverter.kt +++ b/partiql-planner/src/main/kotlin/org/partiql/planner/internal/transforms/RexConverter.kt @@ -402,7 +402,7 @@ internal object RexConverter { var call = when (node.truthValue.code()) { TruthValue.TRUE -> call("is_true", value) TruthValue.FALSE -> call("is_false", value) - TruthValue.UNK -> call("is_unknown", value) + TruthValue.UNKNOWN -> call("is_unknown", value) else -> error("Unexpected TruthValue: ${node.truthValue}") } // See SQL99 6.30 pg 216 Rule 2 for equivalence