Skip to content

Commit 89db9b5

Browse files
authored
Merge pull request #56 from SOFTNETWORK-APP/fix/sortAggregations
- Issue #50 - Issue #51 - Issue #52 - Issue #53 - Issue #55
2 parents a0b9d0b + 824dc2c commit 89db9b5

38 files changed

Lines changed: 1783 additions & 39 deletions

File tree

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ Download the self-contained fat JAR for your Elasticsearch version:
172172

173173
| Elasticsearch Version | Artifact |
174174
|-----------------------|----------------------------------------|
175-
| ES 6.x | `softclient4es6-jdbc-driver-0.1.1.jar` |
176-
| ES 7.x | `softclient4es7-jdbc-driver-0.1.1.jar` |
177-
| ES 8.x | `softclient4es8-jdbc-driver-0.1.1.jar` |
178-
| ES 9.x | `softclient4es9-jdbc-driver-0.1.1.jar` |
175+
| ES 6.x | `softclient4es6-jdbc-driver-0.1.3.jar` |
176+
| ES 7.x | `softclient4es7-jdbc-driver-0.1.3.jar` |
177+
| ES 8.x | `softclient4es8-jdbc-driver-0.1.3.jar` |
178+
| ES 9.x | `softclient4es9-jdbc-driver-0.1.3.jar` |
179179

180180
```text
181181
JDBC URL: jdbc:elastic://localhost:9200
@@ -190,20 +190,20 @@ Driver class: app.softnetwork.elastic.jdbc.ElasticDriver
190190
<dependency>
191191
<groupId>app.softnetwork.elastic</groupId>
192192
<artifactId>softclient4es8-jdbc-driver</artifactId>
193-
<version>0.1.1</version>
193+
<version>0.1.3</version>
194194
</dependency>
195195
```
196196

197197
**Gradle:**
198198

199199
```groovy
200-
implementation 'app.softnetwork.elastic:softclient4es8-jdbc-driver:0.1.1'
200+
implementation 'app.softnetwork.elastic:softclient4es8-jdbc-driver:0.1.3'
201201
```
202202

203203
**sbt:**
204204

205205
```scala
206-
libraryDependencies += "app.softnetwork.elastic" % "softclient4es8-jdbc-driver" % "0.1.1"
206+
libraryDependencies += "app.softnetwork.elastic" % "softclient4es8-jdbc-driver" % "0.1.3"
207207
```
208208

209209
The JDBC driver JARs are Scala-version-independent (no `_2.12` or `_2.13` suffix) and include all required dependencies.
@@ -231,11 +231,11 @@ For programmatic access, add SoftClient4ES to your project.
231231
resolvers += "Softnetwork" at "https://softnetwork.jfrog.io/artifactory/releases/"
232232

233233
// Choose your Elasticsearch version
234-
libraryDependencies += "app.softnetwork.elastic" %% "softclient4es8-java-client" % "0.18.0"
234+
libraryDependencies += "app.softnetwork.elastic" %% "softclient4es8-java-client" % "0.19.0"
235235
// Add the community extensions for materialized views (optional)
236-
libraryDependencies += "app.softnetwork.elastic" %% "softclient4es-community-extensions" % "0.1.1"
236+
libraryDependencies += "app.softnetwork.elastic" %% "softclient4es-community-extensions" % "0.1.3"
237237
// Add the JDBC driver if you want to use it from Scala (optional)
238-
libraryDependencies += "app.softnetwork.elastic" %% "softclient4es-jdbc-driver" % "0.1.1"
238+
libraryDependencies += "app.softnetwork.elastic" %% "softclient4es-jdbc-driver" % "0.1.3"
239239
```
240240

241241
```scala

bridge/src/main/scala/app/softnetwork/elastic/sql/bridge/ElasticAggregation.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ object ElasticAggregation {
111111
bucketsDirection
112112
.get(identifier.identifierName)
113113
.orElse(bucketsDirection.get(identifier.aliasOrName))
114+
.orElse(fieldAlias.flatMap(a => bucketsDirection.get(a.alias)))
114115

115116
val field = fieldAlias match {
116117
case Some(alias) => alias.alias
@@ -131,15 +132,16 @@ object ElasticAggregation {
131132
val aggName = {
132133
if (fieldAlias.isDefined)
133134
field
134-
else if (distinct)
135-
s"${aggType}_distinct_${sourceField.replace(".", "_")}"
136135
else {
137136
aggType match {
137+
case COUNT if sourceField == "*" =>
138+
if (distinct) "count_distinct_all" else "count_all"
139+
case _ if distinct =>
140+
s"${aggType}_distinct_${sourceField.replace(".", "_")}"
138141
case th: WindowFunction =>
139142
s"${th.window.sql.toLowerCase}_${sourceField.replace(".", "_")}"
140143
case _ =>
141144
s"${aggType}_${sourceField.replace(".", "_")}"
142-
143145
}
144146
}
145147
}

0 commit comments

Comments
 (0)