diff --git a/lib/partiql-byob/src/main/kotlin/org/partiql/transpiler/cli/Shell.kt b/lib/partiql-byob/src/main/kotlin/org/partiql/transpiler/cli/Shell.kt index 1422d02a87..488c01f75f 100644 --- a/lib/partiql-byob/src/main/kotlin/org/partiql/transpiler/cli/Shell.kt +++ b/lib/partiql-byob/src/main/kotlin/org/partiql/transpiler/cli/Shell.kt @@ -131,11 +131,13 @@ internal class Shell( fun start() { val interrupter = ThreadInterrupter() val exited = CountDownLatch(1) - Runtime.getRuntime().addShutdownHook(Thread { - exiting.set(true) - interrupter.interrupt() - Uninterruptibles.awaitUninterruptibly(exited, EXIT_DELAY.millis, TimeUnit.MILLISECONDS) - }) + Runtime.getRuntime().addShutdownHook( + Thread { + exiting.set(true) + interrupter.interrupt() + Uninterruptibles.awaitUninterruptibly(exited, EXIT_DELAY.millis, TimeUnit.MILLISECONDS) + } + ) try { AnsiConsole.systemInstall() run(exiting) diff --git a/lib/partiql-transpiler/src/main/kotlin/org/partiql/transpiler/sql/SqlCalls.kt b/lib/partiql-transpiler/src/main/kotlin/org/partiql/transpiler/sql/SqlCalls.kt index 468b0206c0..093e8d2d59 100644 --- a/lib/partiql-transpiler/src/main/kotlin/org/partiql/transpiler/sql/SqlCalls.kt +++ b/lib/partiql-transpiler/src/main/kotlin/org/partiql/transpiler/sql/SqlCalls.kt @@ -6,7 +6,6 @@ import org.partiql.ast.Expr import org.partiql.ast.Identifier import org.partiql.types.StaticType import org.partiql.value.NumericValue -import org.partiql.value.PartiQLValue import org.partiql.value.PartiQLValueExperimental import org.partiql.value.PartiQLValueType import org.partiql.value.symbolValue @@ -246,7 +245,7 @@ public abstract class SqlCalls { exprCast(value, asType) } - public open fun isType(type: PartiQLValueType, args: SqlArgs) : Expr = Ast.create { + public open fun isType(type: PartiQLValueType, args: SqlArgs): Expr = Ast.create { assert(args.size == 1) { "IS should only have 1 argument" } val value = args.last().expr val asType = when (type) { @@ -257,9 +256,7 @@ public abstract class SqlCalls { PartiQLValueType.INT32 -> Ast.typeInt4() PartiQLValueType.INT64 -> Ast.typeInt8() PartiQLValueType.INT -> Ast.typeInt() - PartiQLValueType.DECIMAL -> { - Ast.typeDecimal(args[0].toInt(), args[1].toInt()) - } + PartiQLValueType.DECIMAL -> Ast.typeDecimal(args[0].toInt(), args[1].toInt()) PartiQLValueType.FLOAT32 -> Ast.typeFloat32() PartiQLValueType.FLOAT64 -> Ast.typeFloat64() PartiQLValueType.CHAR -> Ast.typeChar(args[0].toInt()) diff --git a/lib/partiql-transpiler/src/main/kotlin/org/partiql/transpiler/targets/redshift/RedshiftCalls.kt b/lib/partiql-transpiler/src/main/kotlin/org/partiql/transpiler/targets/redshift/RedshiftCalls.kt index 7fda0326ed..9fc02fe873 100644 --- a/lib/partiql-transpiler/src/main/kotlin/org/partiql/transpiler/targets/redshift/RedshiftCalls.kt +++ b/lib/partiql-transpiler/src/main/kotlin/org/partiql/transpiler/targets/redshift/RedshiftCalls.kt @@ -77,7 +77,7 @@ public class RedshiftCalls(private val onProblem: ProblemCallback) : SqlCalls() * Throwing a warning message if the type assertion is not targeting null type. */ override fun isType(type: PartiQLValueType, args: SqlArgs): Expr { - when(type) { + when (type) { PartiQLValueType.NULL -> Unit else -> onProblem.warn("Redshift does not support type assertion on ${type.name} ") } diff --git a/lib/partiql-transpiler/src/test/kotlin/org/partiql/transpiler/test/targets/partiql/PartiQLTargetTestSuite.kt b/lib/partiql-transpiler/src/test/kotlin/org/partiql/transpiler/test/targets/partiql/PartiQLTargetTestSuite.kt index b6e22acbec..66fd87cd21 100644 --- a/lib/partiql-transpiler/src/test/kotlin/org/partiql/transpiler/test/targets/partiql/PartiQLTargetTestSuite.kt +++ b/lib/partiql-transpiler/src/test/kotlin/org/partiql/transpiler/test/targets/partiql/PartiQLTargetTestSuite.kt @@ -29,4 +29,4 @@ public class PartiQLTargetTestSuite( return PartiQLTargetTestSuite(name, tests) } } -} \ No newline at end of file +} diff --git a/lib/partiql-transpiler/src/test/kotlin/org/partiql/transpiler/test/targets/redshift/RedshiftTargetTestSuite.kt b/lib/partiql-transpiler/src/test/kotlin/org/partiql/transpiler/test/targets/redshift/RedshiftTargetTestSuite.kt index 66b5a66423..f74185b98a 100644 --- a/lib/partiql-transpiler/src/test/kotlin/org/partiql/transpiler/test/targets/redshift/RedshiftTargetTestSuite.kt +++ b/lib/partiql-transpiler/src/test/kotlin/org/partiql/transpiler/test/targets/redshift/RedshiftTargetTestSuite.kt @@ -29,4 +29,4 @@ public class RedshiftTargetTestSuite( return RedshiftTargetTestSuite(name, tests) } } -} \ No newline at end of file +} diff --git a/lib/partiql-transpiler/src/test/kotlin/org/partiql/transpiler/test/targets/trino/TrinoTargetTestSuite.kt b/lib/partiql-transpiler/src/test/kotlin/org/partiql/transpiler/test/targets/trino/TrinoTargetTestSuite.kt index b0a98c701d..efe709ea61 100644 --- a/lib/partiql-transpiler/src/test/kotlin/org/partiql/transpiler/test/targets/trino/TrinoTargetTestSuite.kt +++ b/lib/partiql-transpiler/src/test/kotlin/org/partiql/transpiler/test/targets/trino/TrinoTargetTestSuite.kt @@ -29,4 +29,4 @@ public class TrinoTargetTestSuite( return TrinoTargetTestSuite(name, tests) } } -} \ No newline at end of file +} diff --git a/partiql-planner/src/main/kotlin/org/partiql/planner/transforms/RexConverter.kt b/partiql-planner/src/main/kotlin/org/partiql/planner/transforms/RexConverter.kt index d92b6b7b90..ac9976666b 100644 --- a/partiql-planner/src/main/kotlin/org/partiql/planner/transforms/RexConverter.kt +++ b/partiql-planner/src/main/kotlin/org/partiql/planner/transforms/RexConverter.kt @@ -238,7 +238,7 @@ internal object RexConverter { // arg val arg0 = visitExpr(node.value, ctx) - var call = when(val targetType = node.type) { + var call = when (val targetType = node.type) { is Type.NullType -> call("is_null", arg0) is Type.Missing -> call("is_missing", arg0) is Type.Bool -> call("is_bool", arg0)