Skip to content

Commit

Permalink
Use Released version instead of vendoring zetasql-toolkit
Browse files Browse the repository at this point in the history
  • Loading branch information
hamnis committed May 8, 2024
1 parent c83f069 commit 30d0174
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ lazy val zetasql = crossProject(JVMPlatform)
.settings(
name := "bigquery-zetasql",
libraryDependencies ++= Seq(
"com.google.zetasql.toolkit" % "zetasql-toolkit-bigquery" % "0.4.1",
"com.google.zetasql.toolkit" % "zetasql-toolkit-core" % "0.5.0" exclude("com.google.cloud", "google-cloud-spanner"),
"org.scalameta" %% "munit" % "0.7.29",
"org.typelevel" %% "munit-cats-effect-3" % "1.0.7"
),
Expand Down
20 changes: 3 additions & 17 deletions zetasql/src/main/scala/no/nrk/bigquery/ZetaSql.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,11 @@ import cats.effect.Sync
import com.google.common.collect.ImmutableList
import com.google.zetasql.ZetaSQLFunctions.SignatureArgumentKind
import no.nrk.bigquery.syntax.*
import com.google.zetasql.{
AnalyzerOptions,
FunctionArgumentType,
FunctionSignature,
ParseLocationRange,
Parser,
SimpleColumn,
SimpleTable,
SqlException,
StructType,
TVFRelation,
Type,
TypeFactory
}
import com.google.zetasql.{AnalyzerOptions, FunctionArgumentType, FunctionSignature, LanguageOptions, ParseLocationRange, Parser, SimpleColumn, SimpleTable, SqlException, StructType, TVFRelation, Type, TypeFactory}
import com.google.zetasql.ZetaSQLType.TypeKind
import com.google.zetasql.resolvedast.ResolvedCreateStatementEnums.{CreateMode, CreateScope}
import com.google.zetasql.resolvedast.ResolvedNodes
import com.google.zetasql.toolkit.catalog.basic.BasicCatalogWrapper
import com.google.zetasql.toolkit.options.BigQueryLanguageOptions
import com.google.zetasql.parser.{ASTNodes, ParseTreeVisitor}
import com.google.zetasql.toolkit.catalog.TVFInfo
import com.google.zetasql.toolkit.{AnalysisException, AnalyzedStatement, ZetaSQLToolkitAnalyzer}
Expand All @@ -46,7 +32,7 @@ class ZetaSql[F[_]](implicit F: Sync[F]) {

def parseScript(frag: BQSqlFrag): F[Either[SqlException, ASTNodes.ASTScript]] =
F.interruptible {
val options = BigQueryLanguageOptions.get()
val options = new LanguageOptions().enableMaximumLanguageFeatures()

try
Right(Parser.parseScript(frag.asString, options))
Expand Down Expand Up @@ -174,7 +160,7 @@ class ZetaSql[F[_]](implicit F: Sync[F]) {
val catalog = toCatalog(tables*)
val rendered = frag.asString

val options = BigQueryLanguageOptions.get()
val options = new LanguageOptions().enableMaximumLanguageFeatures()
val analyzerOptions = new AnalyzerOptions
analyzerOptions.setLanguageOptions(options)
analyzerOptions.setPreserveColumnAliases(true)
Expand Down
2 changes: 1 addition & 1 deletion zetasql/src/test/scala/no/nrk/bigquery/ZetaTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class ZetaTest extends munit.CatsEffectSuite {
}

test("parse then build analysis with tvf") {
val query = """select a from `com-example.example.tvftest`(current_date)"""
val query = """select a from `com-example.example.tvftest`(current_date())"""

val expected = tvf.schema.fields.map(_.recursivelyNullable.withoutDescription)

Expand Down

0 comments on commit 30d0174

Please sign in to comment.