File tree Expand file tree Collapse file tree 3 files changed +8
-3
lines changed
es6/sql-bridge/src/test/scala/app/softnetwork/elastic/sql
bridge/src/test/scala/app/softnetwork/elastic/sql
src/main/scala/app/softnetwork/elastic/sql/query Expand file tree Collapse file tree 3 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -3436,7 +3436,7 @@ class SQLQuerySpec extends AnyFlatSpec with Matchers {
34363436 | "aggs": {
34373437 | "avg_popularity": {
34383438 | "avg": {
3439- | "field": "blogs. popularity"
3439+ | "field": "popularity"
34403440 | }
34413441 | },
34423442 | "nested_comments": {
Original file line number Diff line number Diff line change @@ -3436,7 +3436,7 @@ class SQLQuerySpec extends AnyFlatSpec with Matchers {
34363436 | "aggs": {
34373437 | "avg_popularity": {
34383438 | "avg": {
3439- | "field": "blogs. popularity"
3439+ | "field": "popularity"
34403440 | }
34413441 | },
34423442 | "nested_comments": {
Original file line number Diff line number Diff line change @@ -148,7 +148,12 @@ case class From(tables: Seq[Table]) extends Updateable {
148148 .flatten
149149
150150 lazy val tableAliases : Map [String , String ] = tables
151- .flatMap((table : Table ) => table.tableAlias.map(alias => table.name -> alias.alias))
151+ .flatMap((table : Table ) =>
152+ table.tableAlias match {
153+ case Some (alias) if alias.alias.nonEmpty => Some (table.name -> alias.alias)
154+ case _ => Some (table.name -> table.name)
155+ }
156+ )
152157 .toMap ++ unnestAliases.map(unnest => unnest._2._1 -> unnest._1)
153158
154159 lazy val unnestAliases : Map [String , (String , Option [Limit ])] = unnests
You can’t perform that action at this time.
0 commit comments