-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
171 additions
and
560 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 5 additions & 4 deletions
9
partiql-eval/src/main/kotlin/org/partiql/eval/internal/Aggregation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
package org.partiql.eval.internal | ||
|
||
interface Aggregation { | ||
|
||
public fun getKey(): String | ||
/** | ||
* | ||
*/ | ||
internal fun interface Aggregation { | ||
|
||
/** | ||
* Instantiates a stateful accumulator for this aggregation function. | ||
* | ||
* @return | ||
*/ | ||
public fun accumulator(): Accumulator | ||
fun accumulator(): Accumulator | ||
} |
12 changes: 12 additions & 0 deletions
12
partiql-eval/src/main/kotlin/org/partiql/eval/internal/Routines.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.partiql.eval.internal | ||
|
||
import org.partiql.spi.fn.Agg | ||
|
||
internal class Routines( | ||
private val functions: Map<String, Fn>, | ||
private val aggregations: Map<String, Aggregation>, | ||
) { | ||
|
||
|
||
|
||
} |
13 changes: 13 additions & 0 deletions
13
partiql-eval/src/main/kotlin/org/partiql/eval/internal/SqlAggregations.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.partiql.eval.internal | ||
|
||
internal class SqlAggregations private constructor(private val map: Map<String, Aggregation>) { | ||
|
||
fun get(specific: String): Aggregation? = map[specific] | ||
|
||
companion object { | ||
|
||
|
||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
157 changes: 32 additions & 125 deletions
157
partiql-eval/src/main/kotlin/org/partiql/eval/internal/routines/AggMax.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,162 +1,69 @@ | ||
// ktlint-disable filename | ||
@file:Suppress("ClassName") | ||
@file:Suppress("ClassName", "unused") | ||
|
||
package org.partiql.eval.internal.routines | ||
|
||
import org.partiql.spi.connector.sql.builtins.internal.AccumulatorMax | ||
import org.partiql.spi.fn.Agg | ||
import org.partiql.spi.fn.AggSignature | ||
import org.partiql.spi.fn.FnParameter | ||
import org.partiql.value.PType.Kind.DYNAMIC | ||
import org.partiql.value.PType.Kind.DECIMAL_ARBITRARY | ||
import org.partiql.value.PType.Kind.FLOAT32 | ||
import org.partiql.value.PType.Kind.FLOAT64 | ||
import org.partiql.value.PType.Kind.INT | ||
import org.partiql.value.PType.Kind.SMALLINT | ||
import org.partiql.value.PType.Kind.INT | ||
import org.partiql.value.PType.Kind.BIGINT | ||
import org.partiql.value.PType.Kind.TINYINT | ||
|
||
|
||
internal object Agg_MAX__TINYINT__TINYINT : Aggregation { | ||
|
||
override val signature: AggSignature = AggSignature( | ||
name = "max", | ||
returns = TINYINT, | ||
parameters = listOf( | ||
FnParameter("value", TINYINT), | ||
), | ||
isNullable = true, | ||
isDecomposable = true | ||
) | ||
|
||
override fun accumulator(): Accumulator = AccumulatorMax() | ||
} | ||
|
||
import org.partiql.eval.internal.Aggregation | ||
|
||
internal object Agg_MAX__SMALLINT__SMALLINT : Aggregation { | ||
internal object AGG_MAX__TINYINT__TINYINT : Aggregation { | ||
|
||
override val signature: AggSignature = AggSignature( | ||
name = "max", | ||
returns = SMALLINT, | ||
parameters = listOf( | ||
FnParameter("value", SMALLINT), | ||
), | ||
isNullable = true, | ||
isDecomposable = true | ||
) | ||
override fun getKey(): String = "AGG_MAX__TINYINT___TINYINT" | ||
|
||
override fun accumulator(): Accumulator = AccumulatorMax() | ||
override fun accumulator() = TODO("Accumulator not implemented") | ||
} | ||
|
||
internal object AGG_MAX__SMALLINT__SMALLINT : Aggregation { | ||
|
||
internal object Agg_MAX__INT__INT : Aggregation { | ||
|
||
override val signature: AggSignature = AggSignature( | ||
name = "max", | ||
returns = INT, | ||
parameters = listOf( | ||
FnParameter("value", INT), | ||
), | ||
isNullable = true, | ||
isDecomposable = true | ||
) | ||
override fun getKey(): String = "AGG_MAX__SMALLINT___SMALLINT" | ||
|
||
override fun accumulator(): Accumulator = AccumulatorMax() | ||
override fun accumulator() = TODO("Accumulator not implemented") | ||
} | ||
|
||
internal object AGG_MAX__INT__INT : Aggregation { | ||
|
||
internal object Agg_MAX__BIGINT__BIGINT : Aggregation { | ||
override fun getKey(): String = "AGG_MAX__INT___INT" | ||
|
||
override val signature: AggSignature = AggSignature( | ||
name = "max", | ||
returns = BIGINT, | ||
parameters = listOf( | ||
FnParameter("value", BIGINT), | ||
), | ||
isNullable = true, | ||
isDecomposable = true | ||
) | ||
|
||
override fun accumulator(): Accumulator = AccumulatorMax() | ||
override fun accumulator() = TODO("Accumulator not implemented") | ||
} | ||
|
||
internal object AGG_MAX__BIGINT__BIGINT : Aggregation { | ||
|
||
internal object Agg_MAX__NUMERIC__INT : Aggregation { | ||
|
||
override val signature: AggSignature = AggSignature( | ||
name = "max", | ||
returns = INT, | ||
parameters = listOf( | ||
FnParameter("value", INT), | ||
), | ||
isNullable = true, | ||
isDecomposable = true | ||
) | ||
override fun getKey(): String = "AGG_MAX__BIGINT___BIGINT" | ||
|
||
override fun accumulator(): Accumulator = AccumulatorMax() | ||
override fun accumulator() = TODO("Accumulator not implemented") | ||
} | ||
|
||
internal object AGG_MAX__NUMERIC__INT : Aggregation { | ||
|
||
internal object Agg_MAX__DECIMAL_ARBITRARY__DECIMAL_ARBITRARY : Aggregation { | ||
|
||
override val signature: AggSignature = AggSignature( | ||
name = "max", | ||
returns = DECIMAL_ARBITRARY, | ||
parameters = listOf( | ||
FnParameter("value", DECIMAL_ARBITRARY), | ||
), | ||
isNullable = true, | ||
isDecomposable = true | ||
) | ||
override fun getKey(): String = "AGG_MAX__NUMERIC___NUMERIC" | ||
|
||
override fun accumulator(): Accumulator = AccumulatorMax() | ||
override fun accumulator() = TODO("Accumulator not implemented") | ||
} | ||
|
||
internal object AGG_MAX__DECIMAL__DECIMAL : Aggregation { | ||
|
||
internal object Agg_MAX__FLOAT32__FLOAT32 : Aggregation { | ||
override fun getKey(): String = "AGG_MAX__NUMERIC___NUMERIC" | ||
|
||
override val signature: AggSignature = AggSignature( | ||
name = "max", | ||
returns = FLOAT32, | ||
parameters = listOf( | ||
FnParameter("value", FLOAT32), | ||
), | ||
isNullable = true, | ||
isDecomposable = true | ||
) | ||
|
||
override fun accumulator(): Accumulator = AccumulatorMax() | ||
override fun accumulator() = TODO("Accumulator not implemented") | ||
} | ||
|
||
internal object AGG_MAX__REAL__REAL : Aggregation { | ||
|
||
internal object Agg_MAX__FLOAT64__FLOAT64 : Aggregation { | ||
|
||
override val signature: AggSignature = AggSignature( | ||
name = "max", | ||
returns = FLOAT64, | ||
parameters = listOf( | ||
FnParameter("value", FLOAT64), | ||
), | ||
isNullable = true, | ||
isDecomposable = true | ||
) | ||
override fun getKey(): String = "AGG_MAX__REAL___REAL" | ||
|
||
override fun accumulator(): Accumulator = AccumulatorMax() | ||
override fun accumulator() = TODO("Accumulator not implemented") | ||
} | ||
|
||
internal object AGG_MAX__DOUBLE__DOUBLE : Aggregation { | ||
|
||
override fun getKey(): String = "AGG_MAX__SMALLINT___SMALLINT" | ||
|
||
override fun accumulator() = TODO("Accumulator not implemented") | ||
} | ||
|
||
internal object Agg_MAX__DYNAMIC__DYNAMIC : Aggregation { | ||
internal object AGG_MAX__DYNAMIC__DYNAMIC : Aggregation { | ||
|
||
override val signature: AggSignature = AggSignature( | ||
name = "max", | ||
returns = DYNAMIC, | ||
parameters = listOf( | ||
FnParameter("value", DYNAMIC), | ||
), | ||
isNullable = true, | ||
isDecomposable = true | ||
) | ||
override fun getKey(): String = "AGG_MAX__SMALLINT___SMALLINT" | ||
|
||
override fun accumulator(): Accumulator = AccumulatorMax() | ||
override fun accumulator() = TODO("Accumulator not implemented") | ||
} |
Oops, something went wrong.