From 32723032564209792df2c9f7c9cee29430cf6dbc Mon Sep 17 00:00:00 2001 From: Jan Sigrist <158459324+jansigi@users.noreply.github.com> Date: Fri, 12 Apr 2024 11:42:50 +0200 Subject: [PATCH 1/4] DOPE-163: created kotlin_ci.yml --- .github/workflows/kotlin_ci.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/kotlin_ci.yml diff --git a/.github/workflows/kotlin_ci.yml b/.github/workflows/kotlin_ci.yml new file mode 100644 index 00000000..43c5c035 --- /dev/null +++ b/.github/workflows/kotlin_ci.yml @@ -0,0 +1,26 @@ +name: Kotlin CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + cache: gradle + - name: Build with Gradle + run: ./gradlew build + - name: Run tests + run: ./gradlew test + - name: Run ktlint + run: ./gradlew ktlintCheck From bb2b3c5ebe38597eae74469ce50f27bcd03da9f2 Mon Sep 17 00:00:00 2001 From: Jan Sigrist <158459324+jansigi@users.noreply.github.com> Date: Fri, 12 Apr 2024 11:48:12 +0200 Subject: [PATCH 2/4] DOPE-163: grant execute permissions for gradlew --- .github/workflows/kotlin_ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/kotlin_ci.yml b/.github/workflows/kotlin_ci.yml index 43c5c035..f116dae5 100644 --- a/.github/workflows/kotlin_ci.yml +++ b/.github/workflows/kotlin_ci.yml @@ -18,6 +18,8 @@ jobs: java-version: '17' distribution: 'adopt' cache: gradle + - name: Grant execute permission for gradlew + run: chmod +x gradlew - name: Build with Gradle run: ./gradlew build - name: Run tests From 1fec059eb0260d69ed4426b1b6ebafdecb9679c8 Mon Sep 17 00:00:00 2001 From: Jan Sigrist <158459324+jansigi@users.noreply.github.com> Date: Mon, 15 Apr 2024 14:04:13 +0200 Subject: [PATCH 3/4] DOPE-163: run ktlint bevore tests --- .github/workflows/kotlin_ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/kotlin_ci.yml b/.github/workflows/kotlin_ci.yml index f116dae5..8c2d4688 100644 --- a/.github/workflows/kotlin_ci.yml +++ b/.github/workflows/kotlin_ci.yml @@ -22,7 +22,7 @@ jobs: run: chmod +x gradlew - name: Build with Gradle run: ./gradlew build - - name: Run tests - run: ./gradlew test - name: Run ktlint run: ./gradlew ktlintCheck + - name: Run tests + run: ./gradlew test From cc4c101554c839230eb8feb311d916ff61866579 Mon Sep 17 00:00:00 2001 From: Jan Sigrist Date: Fri, 19 Apr 2024 08:59:45 +0200 Subject: [PATCH 4/4] DOPE-196: moved asterisk out of AsteriskExpression to use it in CountAsteriskExpression --- .../ergon/dope/resolvable/expression/AsteriskExpression.kt | 7 ++++--- .../expression/unaliased/aggregator/CountExpression.kt | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/core/src/main/kotlin/ch/ergon/dope/resolvable/expression/AsteriskExpression.kt b/core/src/main/kotlin/ch/ergon/dope/resolvable/expression/AsteriskExpression.kt index 268754c8..1249b692 100644 --- a/core/src/main/kotlin/ch/ergon/dope/resolvable/expression/AsteriskExpression.kt +++ b/core/src/main/kotlin/ch/ergon/dope/resolvable/expression/AsteriskExpression.kt @@ -4,19 +4,20 @@ import ch.ergon.dope.resolvable.fromable.AliasedBucket import ch.ergon.dope.resolvable.fromable.Bucket import ch.ergon.dope.resolvable.fromable.UnaliasedBucket +const val ASTERISK_STRING = "*" + class AsteriskExpression : Expression { - private val asterisk = "*" private val queryString: String constructor(bucket: Bucket) { queryString = when (bucket) { is AliasedBucket -> bucket.alias is UnaliasedBucket -> bucket.name - } + ".$asterisk" + } + ".$ASTERISK_STRING" } constructor() { - queryString = asterisk + queryString = ASTERISK_STRING } override fun toQueryString(): String = queryString diff --git a/core/src/main/kotlin/ch/ergon/dope/resolvable/expression/unaliased/aggregator/CountExpression.kt b/core/src/main/kotlin/ch/ergon/dope/resolvable/expression/unaliased/aggregator/CountExpression.kt index 22798b4a..8026fd5c 100644 --- a/core/src/main/kotlin/ch/ergon/dope/resolvable/expression/unaliased/aggregator/CountExpression.kt +++ b/core/src/main/kotlin/ch/ergon/dope/resolvable/expression/unaliased/aggregator/CountExpression.kt @@ -1,6 +1,6 @@ package ch.ergon.dope.resolvable.expression.unaliased.aggregator -import ch.ergon.dope.resolvable.expression.AsteriskExpression +import ch.ergon.dope.resolvable.expression.ASTERISK_STRING import ch.ergon.dope.resolvable.expression.unaliased.type.Field import ch.ergon.dope.resolvable.formatToQueryStringWithBrackets import ch.ergon.dope.validtype.ValidType @@ -12,7 +12,7 @@ class CountExpression( } class CountAsteriskExpression : AggregateExpression { - override fun toQueryString(): String = formatToQueryStringWithBrackets("COUNT", AsteriskExpression()) + override fun toQueryString(): String = "COUNT($ASTERISK_STRING)" } fun count(field: Field) = CountExpression(field)