Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
yliuuuu committed Sep 19, 2023
1 parent fa609c8 commit 5b6675d
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand All @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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} ")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ public class PartiQLTargetTestSuite(
return PartiQLTargetTestSuite(name, tests)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ public class RedshiftTargetTestSuite(
return RedshiftTargetTestSuite(name, tests)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ public class TrinoTargetTestSuite(
return TrinoTargetTestSuite(name, tests)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5b6675d

Please sign in to comment.