Commit Graph

25 Commits

Author SHA1 Message Date
AdRiley
7327df88c3
Complete migration to Dialect/Feature flags + SQLServer support for Datetime (#11527)
* Supports_Sort_Digits_As_Numbers

* case_insensitive_ordering

* Case_Insensitive_Ordering

* Case_Insensitive_Ordering

* Enable tests

* Case_Insensitive_Non_Ascii

* Order_By_Unicode_Normalization_By_Default

* Allows_Mixed_Type_Comparisons

* Supports_Unicode_Normalization

* NaN_Non_Comparable

* Distinct_Returns_First_Row_From_Group_If_Ordered

* Datetime support

* refactor

* refactor

* Refactor

* Move remaining flags

* Cleanup

* sbt javafmtAll

* Fix

* Fix tests

* Code review changes

* More date_diff month tests

* Fix sowflake

* Fix snowflake tests

Bypassing failing test.
2024-11-20 10:41:49 +00:00
AdRiley
676a7d4256
SQLServer enable filter (#11471)
* checkpoint

* Passing by.integer.comparisons

* More passing tests

* by empty text

* Add flag

* 2 more green

* Back to 6 red

* 5 red

* 2 red

* 1 red

* Green

* Refactor

* refactor

* Refactor

* refactor

* Refactor

* clean up

* Green

* Refactor

* Cleanup

* Refactor

* Clean up

* Cleanup

* Clean up

* Fix tests

* Fix

* Fix

* Code review

* Refactor

* Code review changes

* Add literals

* Code review changes

* Code review changes

* Checkpoint

* checkpoint

* checkpoint

* Cleanup

* Refactor

* Refactor

* refactor

* Fix type name

* Fix
2024-11-07 15:42:55 +00:00
AdRiley
1b6a1f990b
Enable SQLServer Sort Feature and associated tests (#11379)
* Auto-commit work in progress before clean build on 2024-10-15 12:59:18

* checkpoint

* Clean

* Cleaner

* cleaner

* Cleaner

* Green

* stash

* stash

* Fix sort

* Sub 300 failures

* More passing tests

* Auto-commit work in progress before clean build on 2024-10-22 09:00:41

* SQLServer green 265

* remove dead code

* Add doc

* Add generate_column

* Refactor

* refactor

* Refactor

* Refactor

* Add  is_operation_supported_fn

* Fix

* Fix

* Fix

* Code review changes

* Code review feedback

* typos

* Add comment
2024-10-25 13:16:52 +03:00
Radosław Waśko
d75e20c1d2
Save Database connection as data link, SQL Server data link support (#11343)
- Closes #11294
2024-10-17 09:06:57 +00:00
Radosław Waśko
244effde0c
Enable audit logs for Snowflake backend (#11306)
- Closes #11292
- Tries to fix #11300
2024-10-14 14:30:42 +00:00
AdRiley
03369b9273
Refactor Dialect_Flag (#11273)
* Add property flags

* Update post initial design review

* Add more tests

* Fix tests

* Remove .LCK

* Fix
2024-10-14 10:32:19 +03:00
AdRiley
d0f0770ef4
Add DB_Table feature flags (#11163)
* Refactor

* Fix

* More fixes

* Fixes

* Fix

* Fix imports

* Fix

* Fix

* Fix Test

* Fix

* Fix

* is_feature_supported API

* Add SQLServer Tests

* SQLServer Select_columns functional

* SQLServer Filter functional

* Aggregate

* order feature

* Remove old order flag

* Join

* Union

* Distinct

* Text_cleanse

* Remove Nothing tests

* add_row_number and integration

* Make_table_from

* Feature flag failing tests

* Column_operations

* Set

* date_time off

* Conversion

* More flags

* Merge

* Expressions

* TakeDrop

* Missing

* Cross_join

* More flags

* Temporaily disable

* Fix merge issue

* Update other dbs

* Code review changes

* Code review changes

* Code revoew changes

* Fix

* Fix

* Fix

* Fix

* Fix

* Code review fix

* Typo

* Code review changes

* Casing

* Add comments

* Add comments

* Update

* Fix

* Fix imports
2024-10-07 16:05:09 +01:00
GregoryTravis
f409cb8aac
fix test (#11049)
Repairs a test not run in CI
2024-09-11 16:34:07 +01:00
GregoryTravis
2adb8bb86d
Use NUMBER(38, 12) as default range for Snowflake DECIMALs (#10971) 2024-09-09 18:31:09 +00:00
GregoryTravis
8260a9587f
Column-level lexically-scoped CTE expressions (#10826)
This implements `DB_Column.with`, which uses `WITH ... AS` SQL clauses to remove duplicates in the generated SQL.

After a discussion with @radeusgd, we concluded that we will probably want a more complete CTE implementation, so this one is useful for now to deal with big queries (like `round`).

# Important Notes
Still to do in this PR:

- [x] Rename `with` to `let` (or something similar)
- [x] tests
- [x] documentation
- [x] remove `State` hack by moving query generation into a class and using a `Ref` field for scoping

Results on `round_float`:

| --- | SQL length in characters (unprettified) | SQL length in lines (prettified) |
| --- | --- | --- |
| Without CTEs | 13193 | 851 |
| With CTEs | 3644 | 187 |

Compare the SQL:

[without-ctes.sql.txt](https://github.com/user-attachments/files/16629356/without-ctes.sql.txt)
[with-ctes.sql.txt](https://github.com/user-attachments/files/16629357/with-ctes.sql.txt)

Update, with name shortening:

| --- | SQL length in characters (unprettified) | SQL length in lines (prettified) |
| --- | --- | --- |
| Without CTEs | 13193 | 853 |
| With CTEs | 2427 | 176 |

[without-cte.txt](https://github.com/user-attachments/files/16694328/without-cte.txt)
[with-cte.txt](https://github.com/user-attachments/files/16694327/with-cte.txt)
2024-08-28 18:23:51 +00:00
Radosław Waśko
80922dcd01
First/Last support in Snowflake, and partially in SQLite (#10841)
- Closes #10411
- Also a similar technique allowed to add partial support for SQLite as well.
- Only `include_nothing=True` case is still not supported as the technique used for Snowflake did not port well to SQLite and I did not find yet a satisfactory workaround (it is doable, but too ugly to justify it for now IMHO).
2024-08-28 10:00:07 +00:00
Radosław Waśko
09137f7088
Fix Count_Distinct in Snowflake (#10818)
- Closes #10611
2024-08-16 12:43:19 +00:00
AdRiley
9fc6af12c5
Clean up Text option from read and query (#10790)
* Revert

* from

* Fix

* fix

* Last few details

* Fix

* Fix test

* Fix

* Cleanup

* Fix error message

* fix

* Fix

* Improve error message
2024-08-13 13:25:21 +03:00
Radosław Waśko
3fd14642d9
Fix upload/delete transactions in Snowflake backend (#10738)
Fixes #10609 by rewriting all our upload-related operations to rely on `DDL_Transaction` - an abstraction that handles 'transactionality' of `CREATE TABLE` statements dependent on if a given backend allows DDLs within transactions or not (if not it emulates transactionality by creating the tables outside of transaction and then dropping them on rollback).
2024-08-06 08:14:44 +00:00
Radosław Waśko
ba8ae4502c
Fix date_diff in Snowflake (#10672)
- Closes #10438
- The results are again aligned across backends.
2024-07-25 16:16:33 +00:00
Radosław Waśko
3536a18efd
Initial template for the Extra Tests workflow (#10636)
- Closes #10618
- adjusts some edge case tests in Snowflake
2024-07-24 07:33:51 +00:00
Radosław Waśko
ba56f8e89b
Snowflake Dialect - pt. 7 (#10612)
- Closes #9486
- All tests are succeeding or marked pending
- Created follow up tickets for things that still need to be addressed, including:
- Fixing upload / table update #10609
- Fixing `Count_Distinct` on Boolean columns #10611
- Running the tests on CI is not part of this PR - to be addressed separately
2024-07-23 06:58:11 +00:00
Radosław Waśko
7fd8701690
Snowflake Dialect pt. 6 - Union, Distinct and other improvements (#10576)
- Part of #9486
- Fixes `Table.union`, `merge` and `distinct` tests
- Replaces `distinct_on` in `Context` that was actually a Postgres specific addition leaking into the base with a more abstract `Context_Extension` mechanism.
- This allows us to implement the Snowflake-specific `DISTINCT` using `QUALIFY`.
2024-07-19 16:04:00 +00:00
Radosław Waśko
a30b0c60eb
Snowflake Dialect pt. 5 (#10528)
- Related to #9486
- Batching of expression tests
- Fixing arithmetic by simplifying `%` and `/` operations
- Trying to share some more tables, sometimes improving performance sometimes not really
- Adding sorting and other fixes to tests to make them pass: Missing_Values_Spec, Filter_Spec, Map_Spec
- Fixing warnings related to materialization of Decimal->Integer, thus fixing Join_Spec.
2024-07-16 09:38:57 +00:00
Radosław Waśko
632355f85b
Snowflake Dialect pt. 4 - reading a column of small integers as Integer type, other type mapping tests (#10518)
- Related to #9486
- Ensures that even though an integer column in Snowflake is represented by `Decimal` type, if the values are small enough, they are materialized as `Integer`.
- If the values are larger, they are still read in as `Decimal`.
- Adds tests for some other `Decimal` edge cases (various precisions and scales), and for `Float`.
2024-07-11 20:14:46 +00:00
Radosław Waśko
48c17845a7
Fixing Database tests and Snowflake Dialect - part 3 out of ... (#10458)
- Related to #9486
- Fixes types in literal tables that are used throughout the tests
- Tries to makes testing faster by disabling some edge cases, trying batching some queries, re-using the main connection and trying to re-use tables more
- Implements date/time type mapping and operations for Snowflake
- Updates type mapping to correctly reflect what Snowflake does
- Disables warnings for Integer->Decimal coercion as that's too annoying and implicitly understood in Snowflake
- Allows to select a Decimal column with `..By_Type ..Integer` (only in Snowflake backend) because the Decimal column there is its 'de-facto' Integer column replacement.
2024-07-10 13:21:30 +00:00
James Dunkerley
4b3e4ae15e
Rename Map to Dictionary and Set to Hashset. (#10474)
- Rename `Map` to `Dictionary`.
- Rename `Set` to `Hashset`.
- Add a deprecated place holder for the static method of `Map`.
2024-07-09 09:12:23 +00:00
James Dunkerley
4c0647ea29
Stop publishing First/Last as constructors and use auto-scoping for take and drop. (#10467)
- Removes `First` and `Last` from the `Standard.Base` exports.
- Enable auto-scoping for all `Index_Sub_Range` and `Text_Sub_Range`.
- Update all use of those methods to use auto-scoping.
2024-07-08 10:26:30 +00:00
Radosław Waśko
db4f7ab3b5
Fixing Database tests and Snowflake Dialect - part 2 out of ... (#10319)
- Part of #9486
- Fixing our tests to not rely on deterministic ordering of created Tables in Database backends
- Before, SQLite and Postgres used to mostly return rows in the order they were inserted in, but Snowflake does not.
- Fixing various parts of Snowflake dialect.
2024-06-27 14:54:00 +00:00
Radosław Waśko
3a4784c226
Initial separation of Snowflake_Dialect from Postgres_Dialect (#10266)
- Part of #9486
- Building on top of initial work by @jdunkerley and finishing it
- Reverted the changes to the Postgres_Dialect from last Snowflake work and split the Snowflake_Dialect into a separate module.
- Moved from `rounding_decimal_places_not_allowed_for_floats` to `supports_float_round_decimal_places` (as too confusing).
- Added Snowflake_Dialect type.
- Extracted `Snowflake_Spec` into separate `Snowflake_Tests`
- It imports the common tests from `Table_Tests`.
- Some initial adaptations to make the snowflake dialect not-crash.
- Adding `Internals_Access` proxy to allow external implementations to access our internal data structures without directly exposing them to users. Users should not use these.
- Adding profiling of SQL to check performance.
2024-06-13 16:12:20 +00:00