Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smoketest changes #126

Merged
merged 2 commits into from
Jul 20, 2023
Merged
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
14 changes: 9 additions & 5 deletions testing/src/main/scala/no/nrk/bigquery/testing/BQSmokeTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,12 @@ object BQSmokeTest {
ctesFromUDF ++ ctes.flatten
)
case pUdf @ UDF.Persistent(_, _, Body.Sql(body), _) =>
// todo: verify that this is what we want to do!
val (newUdfBody, ctesFromUDF) = recurse(body)
(
BQSqlFrag.Call(pUdf.copy(body = UDF.Body.Sql(newUdfBody)), newArgs),
BQSqlFrag.Call(
pUdf.copy(body = UDF.Body.Sql(newUdfBody)).convertToTemporary,
newArgs
),
ctesFromUDF ++ ctes.flatten
)
case _ => (BQSqlFrag.Call(udf, newArgs), ctes.flatten)
Expand Down Expand Up @@ -433,7 +435,7 @@ object BQSmokeTest {
val cteName = tempTable(pid)
(
cteName.bqShow,
List(CTE(cteName, bqfr"(select as value ${exampleRow(schema)})"))
List(CTE(cteName, bqfr"(select ${exampleRow(schema)})"))
)
case None =>
(p, Nil)
Expand All @@ -453,7 +455,7 @@ object BQSmokeTest {
List(
CTE(
cteName,
bqfr"(select as value ${exampleRow(fill.tableDef.schema)})"
bqfr"(select ${exampleRow(fill.tableDef.schema)})"
)
)
)
Expand Down Expand Up @@ -513,7 +515,9 @@ object BQSmokeTest {
.map(field => bqfr"${valueForType(field)} as ${Ident(field.name)}")
.mkFragment(bqfr"struct(", bqfr", ", bqfr")")

struct(schema.fields)
schema.fields
.map(field => bqfr"${valueForType(field)} as ${Ident(field.name)}")
.mkFragment(",")
}

// this is a user-wide query cache to speed up development/CI
Expand Down