Skip to content

Commit

Permalink
If every type of an expression is the same return that type as a result
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecKazakova committed May 30, 2023
1 parent c22e6df commit d6f7c08
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ fun TypeResolver.encapsulatingType(
nullableIfAny: Boolean,
vararg typeOrder: DialectType,
): IntermediateType {
val types = exprList.map { resolvedType(it) }
val types = exprList.map { resolvedType(it) }.distinct()
if (types.size == 1) return types[0]

val sqlTypes = types.map { it.dialectType }

if (PrimitiveType.ARGUMENT in sqlTypes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ INSERT INTO dates VALUES (?, ?, ?, ?, ?);

SELECT * FROM dates LIMIT 1;
}

selectMaxTimestamp:
SELECT max(timestamp) FROM dates LIMIT 1;

0 comments on commit d6f7c08

Please sign in to comment.