Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ name: Release
on:
workflow_dispatch:
push:
branches:
- 'main'
# - '*' # matches every branch that doesn't contain a '/'
# - '*/*' # matches every branch containing a single '/'
# - '**' # matches every branch
# - '!main' # excludes main
tags:
- 'v*'

permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ThisBuild / organization := "app.softnetwork"

name := "softclient4es"

ThisBuild / version := "0.19.0"
ThisBuild / version := "0.19.1"

ThisBuild / scalaVersion := scala213

Expand Down
4 changes: 2 additions & 2 deletions demo/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ services:
networks:
- elastic-demo
healthcheck:
test: ["CMD-SHELL", "bash -c 'echo > /dev/tcp/localhost/32010'"]
test: ["CMD-SHELL", "bash -c '>/dev/tcp/localhost/32010'"]
interval: 5s
timeout: 3s
start_period: 15s
Expand Down Expand Up @@ -170,7 +170,7 @@ services:
networks:
- elastic-demo
healthcheck:
test: ["CMD-SHELL", "bash -c 'echo > /dev/tcp/localhost/32010'"]
test: ["CMD-SHELL", "bash -c '>/dev/tcp/localhost/32010'"]
interval: 5s
timeout: 3s
start_period: 15s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,15 @@ trait FromParser {
}
}

def table: PackratParser[Table] = identifierRegex ~ alias.? ~ rep(join) ^^ { case i ~ a ~ js =>
Table(i, a, js)
}
// Optional quoted schema prefix: "schema". (ignored — Elasticsearch has no schema concept)
// Only quoted schemas are stripped; unquoted dots are part of ES index names (e.g. logs-2025.03)
private def quotedSchemaPrefix: PackratParser[String] =
("\"" ~> """([^"\\]|\\.)*""".r <~ "\"") <~ "."

def table: PackratParser[Table] =
opt(quotedSchemaPrefix) ~ identifierRegex ~ alias.? ~ rep(join) ^^ { case _ ~ i ~ a ~ js =>
Table(i, a, js)
}

def from: PackratParser[From] = From.regex ~ rep1sep(table, separator) ^^ { case _ ~ tables =>
From(tables)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,58 @@ class ParserSpec extends AnyFlatSpec with Matchers {
.getOrElse("") shouldBe whereFiltersAccordingToScope
}

// ── Schema-qualified table names (Issue #57) ────────────────────────────────

it should "parse schema-qualified table name with quoted schema" in {
val sql = """SELECT * FROM "default".ecommerce"""
val result = Parser(sql)
result.isRight shouldBe true
val stmt = result.toOption.get
stmt match {
case ss: SingleSearch =>
ss.from.mainTable.name shouldBe "ecommerce"
ss.sources shouldBe Seq("ecommerce")
case _ => fail("Expected SingleSearch")
}
}

it should "preserve dots in unquoted table names (ES index names can contain dots)" in {
val sql = "SELECT * FROM myschema.ecommerce"
val result = Parser(sql)
result.isRight shouldBe true
val stmt = result.toOption.get
stmt match {
case ss: SingleSearch =>
ss.from.mainTable.name shouldBe "myschema.ecommerce"
case _ => fail("Expected SingleSearch")
}
}

it should "parse schema-qualified table name with alias" in {
val sql = """SELECT e.field FROM "default".ecommerce AS e"""
val result = Parser(sql)
result.isRight shouldBe true
val stmt = result.toOption.get
stmt match {
case ss: SingleSearch =>
ss.from.mainTable.name shouldBe "ecommerce"
ss.from.mainTable.tableAlias.map(_.alias) shouldBe Some("e")
case _ => fail("Expected SingleSearch")
}
}

it should "still parse table name without schema prefix" in {
val sql = "SELECT * FROM ecommerce"
val result = Parser(sql)
result.isRight shouldBe true
val stmt = result.toOption.get
stmt match {
case ss: SingleSearch =>
ss.from.mainTable.name shouldBe "ecommerce"
case _ => fail("Expected SingleSearch")
}
}

// --- DDL ---

behavior of "Parser DDL with Table Statements"
Expand Down
Loading