From b54ada7c86d517e82040e2be3ce0d90421da2dcf Mon Sep 17 00:00:00 2001 From: Benjamin Gaidioz Date: Thu, 14 Nov 2024 10:26:41 +0100 Subject: [PATCH] RD-14937: t.* not parsed in SqlCompilerService (#529) --- .../TestSqlCompilerServiceAirports.scala | 16 ++++++++++++++++ .../com/rawlabs/sql/parser/grammar/PsqlParser.g4 | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/sql-compiler/src/test/scala/com/rawlabs/sql/compiler/TestSqlCompilerServiceAirports.scala b/sql-compiler/src/test/scala/com/rawlabs/sql/compiler/TestSqlCompilerServiceAirports.scala index e181395ae..b0e2f44db 100644 --- a/sql-compiler/src/test/scala/com/rawlabs/sql/compiler/TestSqlCompilerServiceAirports.scala +++ b/sql-compiler/src/test/scala/com/rawlabs/sql/compiler/TestSqlCompilerServiceAirports.scala @@ -1210,4 +1210,20 @@ class TestSqlCompilerServiceAirports ) assert(baos.toString() === """[{"r":{"a":"1","b":"tralala"}}]""") } + + test("SELECT a.* FROM example.airports a ORDER BY airport_id LIMIT 1") { t => + val baos = new ByteArrayOutputStream() + assert( + compilerService.execute( + t.q, + asCsv(), + None, + baos + ) == ExecutionSuccess(true) + ) + assert(baos.toString() === """airport_id,name,city,country,iata_faa,icao,latitude,longitude,altitude,timezone,dst,tz + |1,Goroka,Goroka,Papua New Guinea,GKA,AYGA,-6.081689,145.391881,5282.000,10,U,Pacific/Port_Moresby + |""".stripMargin) + + } } diff --git a/sql-parser/src/main/java/com/rawlabs/sql/parser/grammar/PsqlParser.g4 b/sql-parser/src/main/java/com/rawlabs/sql/parser/grammar/PsqlParser.g4 index 959314775..209eadff1 100644 --- a/sql-parser/src/main/java/com/rawlabs/sql/parser/grammar/PsqlParser.g4 +++ b/sql-parser/src/main/java/com/rawlabs/sql/parser/grammar/PsqlParser.g4 @@ -103,7 +103,7 @@ proj: idnt (DOT idnt)+ #p | idnt DOT {notifyErrorListeners("Missing identifier after '.'");} #missingIdenProj ; -idnt: (WORD | STRING_IDENTIFIER_START (STRING_IDENTIFIER_CONTENT | STRING_ESCAPE)* STRING_IDENTIFIER_END? | non_reserved_keyword); +idnt: (WORD | STRING_IDENTIFIER_START (STRING_IDENTIFIER_CONTENT | STRING_ESCAPE)* STRING_IDENTIFIER_END? | non_reserved_keyword | STAR); literal: STRING_LITERAL_START STRING_LITERAL_CONTENT* STRING_LITERAL_END #stringLiteral