ISSUE-2103 Handle trailing and trailing statement comments#2108
ISSUE-2103 Handle trailing and trailing statement comments#2108spatel11 wants to merge 3 commits into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
/gcbrun |
kolina
left a comment
There was a problem hiding this comment.
A bunch of tests needs fixing https://gist.github.com/kolina/62e278293d983de308b0e3d5949101a2
| @@ -1,16 +1,44 @@ | |||
| import { dataform } from "df/protos/ts"; | |||
|
|
|||
| export function concatenateQueries(statements: string[], modifier?: (mod: string) => string) { | |||
There was a problem hiding this comment.
I think this logic will need to be made more complicated because there can be multiple comments in one statement https://docs.cloud.google.com/bigquery/docs/reference/standard-sql/lexical#comments.
You may have something like:
SELECT a
-- my comment
FROM table
To fix your specific issue, we'd need to find the last comment in SQL statement and check if there are any new lines in the statement after it.
| } | ||
| return code || comment; | ||
| }) | ||
| .join("\n"); |
There was a problem hiding this comment.
Having 2 new lines makes sense here for better readability
This PR fixes an issue with trailing comments in (at least) pre_operations blocks. It adds tests for the existing task.concatenateQueries function, and some example definitions in the integration tests.
Should fix: #2103
While preserving fix for: #1231