Skip to content

Fix tests pass #7

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

Merged
merged 10 commits into from
Aug 25, 2021
Merged

Fix tests pass #7

merged 10 commits into from
Aug 25, 2021

Conversation

markwongsk
Copy link

@markwongsk markwongsk commented Aug 23, 2021

  1. Fixed most ParserError that had empty string args to make them compile.
  2. Fixed tests that used value_quoted
  3. Fixed some Like tests.

There are two tests that were ignored because I think they caught real back-compat issues. Don can you verify this f2f1056b6db4da5bd899acae47f0d681c4de02a4? There's another test for snowflake that I changed. I would like more eyes on this too: e0e929d3243c4a683f8b5b70ac6fecda52e19c93

@markwongsk markwongsk requested a review from donhcd August 23, 2021 10:06
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
for c in self.0.chars() {
if c == '"' {
write!(f, "\"\"")?;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, I think there's an issue here that warehouses have different ways of escaping some characters? for instance I think some escape " as "" and others escape " as \".

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this is still fine here though? are you pretty sure about this case?

eventually we should get in tests for all the cases that triggered the modifications added in this fork. I have a file with a bunch of them... I'd thought I had committed it but I guess not. https://gist.github.com/donhcd/31de459c6cfe763dce44f78a2246b172

anyways if you feel good about this let's try it out and we'll make sure we don't have any regressions before we move qwill to use an updated sha

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So line 68 used to have the escape_single_quote_string, which is why I'm reintroducing it here. This was why the test was failing (because the formatting for Value used to have this, which is what the below test is checking for and failing). I want to reintroduce this invocation, and also introduce the parallel for double-quoted strings, which is a feature that was introduced by us.

In order to handle the various quote-escaping mechanisms, I think SingleQuotedString and DoubleQuotedString will need to have another field which denotes the quote char, so that formatting will know how to format it out. I think that should come after the regression is fixed.

@@ -25,7 +25,7 @@ use sqlparser::tokenizer::*;

#[test]
fn test_snowflake_create_table() {
let sql = "CREATE TABLE _my_$table (am00unt number)";
let sql = "CREATE TABLE _my_$table (am00unt NUMERIC)";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, snowflake does have number type so I guess this seems like a test case that we could ignore for now and then unignore once we add in number support

fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
for c in self.0.chars() {
if c == '"' {
write!(f, "\"\"")?;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this is still fine here though? are you pretty sure about this case?

eventually we should get in tests for all the cases that triggered the modifications added in this fork. I have a file with a bunch of them... I'd thought I had committed it but I guess not. https://gist.github.com/donhcd/31de459c6cfe763dce44f78a2246b172

anyways if you feel good about this let's try it out and we'll make sure we don't have any regressions before we move qwill to use an updated sha

@markwongsk markwongsk merged commit 75d4f63 into don/hacking Aug 25, 2021
@markwongsk markwongsk deleted the mark/fix-tests-passes branch August 25, 2021 17:14
donhcd added a commit that referenced this pull request Jan 13, 2023
* cargo fmt

* add json index for snowflake, bq

* add flatten

* add snowflake dateparts

* useful parsing errors

* parse decimals without 0 prefix

* snowflake: within group

* snowflake: json bracket syntax

* snowflake: join where

* snowflake: ilike

* snowflake: handle like ... escape ...

* snowflake: try_cast

* snowflake: qualify

* snowflake: handle pivot

* snowflake: allow idents to start with $

* snowflake: fix parsing for position

* snowflake: minus set operator

* snowflake json: cleanup/fix bracket and dot notation

* snowflake: number

* snowflake: string literal parse esc quotes

* snowflake: nested exprs can be lists

* join constraints are not required

* smarter number literal parsing with state machine for scientific notation

* snowflake: date/time field variants

* rs/pg: AT TIME ZONE

* rs: ignore/respect nulls

* tokenizer: treat zwsp as whitespace

* pg/rs: SIMILAR TO

* rs: allow brackets around idents

* rs: allow str literal date/time parts

* rs: more IS [NOT] *

* pg: add json ops

* add BigQueryDialect

* bq: backtick quoted idents

* bq: be resilient to trailing commas

* bq: be much more flexible with parsing function args

* bq: handle idents using backticks

* bq: handle interval parsing

* bq: parse regex literals (consider merging with snowflake str parsing)

* bq: add in more date/time parts

* bq: allow aliases with backtick quoting

* bq: parse wildcard modifiers except/replace

* bq: named window specs

* bq: IN <expr>

* snowflake: remove special position handling? maybe should remove more

* bq: double quoted string

* bq: typeless structs

* bq: add secret datetime fields

* fixup bq args bs

* snowflake: ignore/respect nulls for window funcs

* Added Unpivot. Fixed some Pivot (#2)

-- Technically, unpivot has some stricter
   expr requirements (eg instead of expr for ident in col_list
   it should be <column> for ident in col_list). I haven't been
   able to navigate to find this stricter definition yet, but
   maybe we want this fix ASAP.

* [SIG-13647] allow idents for limits and offsets (#3)

* Fix compilation issues (#5)

* Use enum to prevent &'static str lifetime issues

-- Could also use `serde(bound(deserialize = "'de: 'static"))`
-- But I think that will need to be applied on all structs
-- that depend on Expr... which I assume will be ubiquitous

* Make WindowSpec serializable

* Fix more static str stuff

* Fixed tests

* Fixed all compilation errors

* Run clippy --fix

* Fixd lint errors

* Fix more lint errors

* Fix remaining lint issues

* Fix tests pass (#7)

* Fixed trivial tests failures

* Fixed more tests

* Ignored backcompat breaks... for now

* More simple tests fixes

* Fixed tests... but not sure whether this is right

* Clippy

* cargo fmt

* Fixed regression #1

* Fixed second regression

* Ignore snowflake numeric failing test

* Added tests for sigma-related parser changes (#8)

* Added regression tests

* Added test for sigma-related parser changes

* Amended comments

* Removed extraneous println

* Fixed build errors part 1

* Manual cargo fmt because it's hanging on my machine

* When you fail at %s

Co-authored-by: Mark Wong Siang Kai <markwongsk@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants