Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Tests testAdjustQueryHaving, testQueryAndHaving, and testQueryOrHaving resolve wrong eq function, and testGroupBy03 shows compiler warning #2016

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ interface ISqlExpressionBuilder {
}

/** Checks if this expression is equal to some [other] [EntityID] expression. */
infix fun <T : Comparable<T>, V : T?, E : EntityID<T>?> Expression<in V>.eq(
infix fun <T : Comparable<T>, V : T?, E : EntityID<T>?> Expression<V>.eq(
other: ExpressionWithColumnType<E>
): Op<Boolean> = other eq this

Expand Down Expand Up @@ -377,7 +377,7 @@ interface ISqlExpressionBuilder {
}

/** Checks if this expression is not equal to some [other] [EntityID] expression. */
infix fun <T : Comparable<T>, V : T?, E : EntityID<T>?> Expression<in V>.neq(
infix fun <T : Comparable<T>, V : T?, E : EntityID<T>?> Expression<V>.neq(
other: ExpressionWithColumnType<E>
): Op<Boolean> = other neq this

Expand All @@ -400,7 +400,7 @@ interface ISqlExpressionBuilder {
): LessOp = LessOp(this, other)

/** Checks if this expression is less than some [other] [EntityID] expression. */
infix fun <T : Comparable<T>, V : T?, E : EntityID<T>?> Expression<in V>.less(
infix fun <T : Comparable<T>, V : T?, E : EntityID<T>?> Expression<V>.less(
other: ExpressionWithColumnType<E>
): LessOp = LessOp(this, other)

Expand All @@ -423,7 +423,7 @@ interface ISqlExpressionBuilder {
): LessEqOp = LessEqOp(this, other)

/** Checks if this expression is less than or equal to some [other] [EntityID] expression. */
infix fun <T : Comparable<T>, V : T?, E : EntityID<T>?> Expression<in V>.lessEq(
infix fun <T : Comparable<T>, V : T?, E : EntityID<T>?> Expression<V>.lessEq(
other: ExpressionWithColumnType<E>
): LessEqOp = LessEqOp(this, other)

Expand All @@ -446,7 +446,7 @@ interface ISqlExpressionBuilder {
): GreaterOp = GreaterOp(this, other)

/** Checks if this expression is greater than some [other] [EntityID] expression. */
infix fun <T : Comparable<T>, V : T?, E : EntityID<T>?> Expression<in V>.greater(
infix fun <T : Comparable<T>, V : T?, E : EntityID<T>?> Expression<V>.greater(
other: ExpressionWithColumnType<E>
): GreaterOp = GreaterOp(this, other)

Expand All @@ -469,7 +469,7 @@ interface ISqlExpressionBuilder {
): GreaterEqOp = GreaterEqOp(this, other)

/** Checks if this expression is greater than or equal to some [other] [EntityID] expression. */
infix fun <T : Comparable<T>, V : T?, E : EntityID<T>?> Expression<in V>.greaterEq(
infix fun <T : Comparable<T>, V : T?, E : EntityID<T>?> Expression<V>.greaterEq(
other: ExpressionWithColumnType<E>
): GreaterEqOp = GreaterEqOp(this, other)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class AdjustQueryTests : DatabaseTestsBase() {
fun testAdjustQueryHaving() {
withCitiesAndUsers { cities, users, _ ->
val predicateHaving = Op.build {
DMLTestsData.Users.id.count() eq DMLTestsData.Cities.id.max()
DMLTestsData.Users.id.count().eq<Number, Long, Int>(DMLTestsData.Cities.id.max())
}

val queryAdjusted = (cities innerJoin users)
Expand All @@ -146,7 +146,7 @@ class AdjustQueryTests : DatabaseTestsBase() {
fun testQueryAndHaving() {
withCitiesAndUsers { cities, users, _ ->
val predicateHaving = Op.build {
DMLTestsData.Users.id.count() eq DMLTestsData.Cities.id.max()
DMLTestsData.Users.id.count().eq<Number, Long, Int>(DMLTestsData.Cities.id.max())
}

val queryAdjusted = (cities innerJoin users)
Expand All @@ -172,7 +172,7 @@ class AdjustQueryTests : DatabaseTestsBase() {
fun testQueryOrHaving() {
withCitiesAndUsers { cities, users, _ ->
val predicateHaving = Op.build {
DMLTestsData.Users.id.count() eq DMLTestsData.Cities.id.max()
DMLTestsData.Users.id.count().eq<Number, Long, Int>(DMLTestsData.Cities.id.max())
}

val queryAdjusted = (cities innerJoin users)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class GroupByTests : DatabaseTestsBase() {
val maxExpr = cities.id.max()
val r = (cities innerJoin users).select(cities.name, users.id.count(), maxExpr)
.groupBy(cities.name)
.having { users.id.count().eq(maxExpr) }
.having { users.id.count().eq<Number, Long, Int>(maxExpr) }
.orderBy(cities.name)
.toList()

Expand Down
Loading