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

Failed to select with datetime conditions #373

Closed
DifferentialOrange opened this issue Sep 20, 2023 · 0 comments · Fixed by #423
Closed

Failed to select with datetime conditions #373

DifferentialOrange opened this issue Sep 20, 2023 · 0 comments · Fixed by #423
Assignees
Labels
2sp bug Something isn't working teamE

Comments

@DifferentialOrange
Copy link
Member

Simple reproducer is as follows.

  1. Extend playground space format.
--- a/doc/playground.lua
+++ b/doc/playground.lua
@@ -66,6 +66,7 @@ box.once('customers', function()
             {name = 'bucket_id', type = 'unsigned'},
             {name = 'name', type = 'string'},
             {name = 'age', type = 'number'},
+            {name = 'date', type = 'datetime', is_nullable = true},
         }
     })
     box.space.customers:create_index('primary_index', {
  1. Run the updated playground.
./doc/playground.lua
  1. Try to select with datetime condition
tarantool> dt = require('datetime').parse('2022-01-01T00:00:00Z')
---
...

tarantool> crud.select('customers', {{'==', 'date', dt}}, {first = 1})
---
- null
- line: 183
  class_name: SelectError
  err: '...velopment/github/tarantool/crud/crud/compare/filters.lua:636: [string "library"]:4:
    malformed number near ''01T00'''
  file: '...ment/github/tarantool/crud/crud/common/sharding/init.lua'
  stack: "stack traceback:\n\t...ment/github/tarantool/crud/crud/common/sharding/init.lua:183:
    in function <...ment/github/tarantool/crud/crud/common/sharding/init.lua:168>\n\t[C]:
    in function 'xpcall'\n\t.../github/tarantool/crud/.rocks/share/tarantool/errors.lua:145:
    in function <.../github/tarantool/crud/.rocks/share/tarantool/errors.lua:139>\n\t[C]:
    in function 'pcall'\n\tbuiltin/box/console.lua:415: in function 'eval'\n\tbuiltin/box/console.lua:750:
    in function 'repl'\n\tbuiltin/box/console.lua:801: in function 'start'\n\t./doc/playground.lua:150:
    in main chunk"
  str: 'SelectError: ...velopment/github/tarantool/crud/crud/compare/filters.lua:636:
    [string "library"]:4: malformed number near ''01T00'''
...

As a follow up, we also may verify other extended types like decimal, uuid and interval.

@DifferentialOrange DifferentialOrange added bug Something isn't working 2sp labels Sep 20, 2023
@DifferentialOrange DifferentialOrange self-assigned this Mar 11, 2024
DifferentialOrange added a commit that referenced this issue Mar 11, 2024
Before this patch, datetime conditions were supported only in iterators,
but not filters. (Filter is any non-indexed condition or condition
for any non-iterating index. Any condition index expect for the first
one is non-iterating.) This patch introduce datetime comparison support
to filter codegen library, similar to uuid one.

Closes #373
DifferentialOrange added a commit that referenced this issue Mar 11, 2024
Before this patch, datetime conditions were supported only in iterators,
but not filters. (Filter is any non-indexed condition or condition
for any non-iterating index. Any condition index expect for the first
one is non-iterating.) This patch introduce datetime comparison support
to filter codegen library, similar to uuid one.

Closes #373
DifferentialOrange added a commit that referenced this issue Mar 11, 2024
Before this patch, datetime conditions were supported only in iterators,
but not filters. (Filter is any non-indexed condition or condition
for any non-iterating index. Any condition index expect for the first
one is non-iterating.) This patch introduce datetime comparison support
to filter codegen library, similar to uuid one.

Closes #373
DifferentialOrange added a commit that referenced this issue Mar 12, 2024
Before this patch, datetime conditions were supported only in iterators,
but not filters. (Filter is any non-indexed condition or condition
for any non-iterating index. Any condition index expect for the first
one is non-iterating.) This patch introduce datetime comparison support
to filter codegen library, similar to uuid one.

Closes #373
DifferentialOrange added a commit that referenced this issue Mar 12, 2024
Before this patch, datetime conditions were supported only in iterators,
but not filters. (Filter is any non-indexed condition or condition
for any non-iterating index. Any condition index expect for the first
one is non-iterating.) This patch introduce datetime comparison support
to filter codegen library, similar to uuid one.

Part of #373
DifferentialOrange added a commit that referenced this issue Mar 12, 2024
Module uses cdata string cast for decimal filters. Later they are
compared to decimal objects and casted back, so everything already works
fine.

Part of #373
DifferentialOrange added a commit that referenced this issue Mar 12, 2024
Before this patch, datetime conditions were supported only in iterators,
but not filters. (Filter is any non-indexed condition or condition
for any non-iterating index. Any condition index expect for the first
one is non-iterating.) This patch introduce datetime comparison support
to filter codegen library, similar to uuid one.

Part of #373
DifferentialOrange added a commit that referenced this issue Mar 12, 2024
Before this patch, decimals were cast to numbers in filters through
`tostring` in codegen. This patch fixes this precision loss.

Part of #373
DifferentialOrange added a commit that referenced this issue Mar 12, 2024
Before this patch, datetime conditions were supported only in iterators,
but not filters. (Filter is any non-indexed condition or condition
for any non-iterating index. Any condition index expect for the first
one is non-iterating.) This patch introduce datetime comparison support
to filter codegen library, similar to uuid one.

Part of #373
DifferentialOrange added a commit that referenced this issue Mar 12, 2024
Before this patch, decimals were cast to numbers in filters through
`tostring` in codegen. This patch fixes this precision loss.

Part of #373
DifferentialOrange added a commit that referenced this issue Mar 12, 2024
Before this patch, returning any errors from storages for merger
operations (`crud.select`, `crud.pairs`, `readview:select`,
`readview:pairs`) had resulted in non-informative
"Invalid merge source 0x556bb6885a00" errors. This patch fixes the issue
by replacing error return with error throw.

Part of #373
DifferentialOrange added a commit that referenced this issue Mar 12, 2024
As for Tarantool 3.0 and older, datetime intervals are
not comparable [1]. They are also don't supported in indexes. This patch
explicitly forbids to use them in conditions.
1. tarantool/tarantool#7659

Closes #373
DifferentialOrange added a commit that referenced this issue Mar 13, 2024
Before this patch, returning any errors from storages for merger
operations (`crud.select`, `crud.pairs`, `readview:select`,
`readview:pairs`) had resulted in non-informative
"Invalid merge source 0x556bb6885a00" errors. This patch fixes the issue
by replacing error return with error throw.

Part of #373
DifferentialOrange added a commit that referenced this issue Mar 13, 2024
As for Tarantool 3.0 and older, datetime intervals are
not comparable [1]. They are also don't supported in indexes. This patch
explicitly forbids to use them in conditions.
1. tarantool/tarantool#7659

Closes #373
DifferentialOrange added a commit that referenced this issue Mar 13, 2024
Before this patch, datetime conditions were supported only in iterators,
but not filters. (Any non-indexed condition or condition for any
non-iterating index is a filter. Any condition index except for
the first one is non-iterating.) This patch introduce datetime
comparison support to filter codegen library, similar to uuid one.

Part of #373
DifferentialOrange added a commit that referenced this issue Mar 13, 2024
Before this patch, decimals were cast to numbers in filters through
`tostring` in codegen. This patch fixes this precision loss.

Part of #373
DifferentialOrange added a commit that referenced this issue Mar 13, 2024
Before this patch, returning any errors from storages for merger
operations (`crud.select`, `crud.pairs`, `readview:select`,
`readview:pairs`) had resulted in non-informative
"Invalid merge source 0x556bb6885a00" errors. This patch fixes the issue
by replacing error return with error throw.

Part of #373
DifferentialOrange added a commit that referenced this issue Mar 13, 2024
As for Tarantool 3.0 and older, datetime intervals are
not comparable [1]. They are also don't supported in indexes. This patch
explicitly forbids to use them in conditions.
1. tarantool/tarantool#7659

Closes #373
DifferentialOrange added a commit that referenced this issue Mar 14, 2024
Before this patch, datetime conditions were supported only in iterators,
but not filters. (Any non-indexed condition or condition for any
non-iterating index is a filter. Any condition index except for
the first one is non-iterating.) This patch introduce datetime
comparison support to filter codegen library, similar to uuid one.

Part of #373
DifferentialOrange added a commit that referenced this issue Mar 14, 2024
Before this patch, decimals were cast to numbers in filters through
`tostring` in codegen. This patch fixes this precision loss.

Part of #373
DifferentialOrange added a commit that referenced this issue Mar 14, 2024
Before this patch, returning any errors from storages for merger
operations (`crud.select`, `crud.pairs`, `readview:select`,
`readview:pairs`) had resulted in non-informative
"Invalid merge source 0x556bb6885a00" errors. This patch fixes the issue
by replacing error return with error throw.

Part of #373
DifferentialOrange added a commit that referenced this issue Mar 14, 2024
As for Tarantool 3.0 and older, datetime intervals are
not comparable [1]. They are also don't supported in indexes. This patch
explicitly forbids to use them in conditions.
1. tarantool/tarantool#7659

Closes #373
DifferentialOrange added a commit that referenced this issue Mar 14, 2024
Before this patch, datetime conditions were supported only in iterators,
but not filters. (Any non-indexed condition or condition for any
non-iterating index is a filter. Any condition index except for
the first one is non-iterating.) This patch introduce datetime
comparison support to filter codegen library, similar to uuid one.

Part of #373
DifferentialOrange added a commit that referenced this issue Mar 14, 2024
Before this patch, decimals were cast to numbers in filters through
`tostring` in codegen. This patch fixes this precision loss.

Part of #373
DifferentialOrange added a commit that referenced this issue Mar 14, 2024
Before this patch, returning any errors from storages for merger
operations (`crud.select`, `crud.pairs`, `readview:select`,
`readview:pairs`) had resulted in non-informative
"Invalid merge source 0x556bb6885a00" errors. This patch fixes the issue
by replacing error return with error throw.

Part of #373
DifferentialOrange added a commit that referenced this issue Mar 14, 2024
As for Tarantool 3.0 and older, datetime intervals are
not comparable [1]. They are also don't supported in indexes. This patch
explicitly forbids to use them in conditions.
1. tarantool/tarantool#7659

Closes #373
DifferentialOrange added a commit that referenced this issue Apr 3, 2024
Overview

  This release introduces roles for Tarantool 3 configuration (supported
  for versions 3.0.2, 3.1.0 and newer).

Added
* Asynchronous bootstrap support for storages (#412).
* Tarantool 3 roles for setting up crud routers and storages (#415).
* Ability to configure crud through Tarantool 3 roles
  configuration (#415).

Changed
* Explicitly forbid datetime interval conditions (#373).
* Storage initialization is now asynchronous by default for
  Tarantool 3.0+ (#412).
* Additionally check backoff error on storage info fetch (#427).

Fixed
* Working with datetime conditions in case of non-indexed fields or
  non-iterating indexes (#373).
* Precision loss for decimal conditions in case of non-indexed fields or
  non-iterating indexes (#373).
* Passing errors from storages for merger operations (`crud.select`,
  `crud.pairs`, `readview:select`, `readview:pairs`) (#423).
* Working with `nil` operand conditions in case of non-indexed fields or
  non-iterating indexes (#422).
DifferentialOrange added a commit that referenced this issue Apr 4, 2024
Overview

  This release introduces roles for Tarantool 3 configuration (supported
  for versions 3.0.2, 3.1.0 and newer).

Added
* Asynchronous bootstrap support for storages (#412).
* Tarantool 3 roles for setting up crud routers and storages (#415).
* Ability to configure crud through Tarantool 3 roles
  configuration (#415).

Changed
* Explicitly forbid datetime interval conditions (#373).
* Storage initialization is now asynchronous by default for
  Tarantool 3.0+ (#412).
* Additionally check backoff error on storage info fetch (#427).

Fixed
* Working with datetime conditions in case of non-indexed fields or
  non-iterating indexes (#373).
* Precision loss for decimal conditions in case of non-indexed fields or
  non-iterating indexes (#373).
* Passing errors from storages for merger operations (`crud.select`,
  `crud.pairs`, `readview:select`, `readview:pairs`) (#423).
* Working with `nil` operand conditions in case of non-indexed fields or
  non-iterating indexes (#422).
DifferentialOrange added a commit that referenced this issue May 20, 2024
Overview

  This release introduces roles for Tarantool 3 configuration (supported
  for versions 3.0.2, 3.1.0 and newer).

Added
* Asynchronous bootstrap support for storages (#412).
* Tarantool 3 roles for setting up crud routers and storages (#415).
* Ability to configure crud through Tarantool 3 roles
  configuration (#415).

Changed
* Explicitly forbid datetime interval conditions (#373).
* Storage initialization is now asynchronous by default for
  Tarantool 3.0+ (#412).
* Additionally check backoff error on storage info fetch (#427).

Fixed
* Working with datetime conditions in case of non-indexed fields or
  non-iterating indexes (#373).
* Precision loss for decimal conditions in case of non-indexed fields or
  non-iterating indexes (#373).
* Passing errors from storages for merger operations (`crud.select`,
  `crud.pairs`, `readview:select`, `readview:pairs`) (#423).
* Working with `nil` operand conditions in case of non-indexed fields or
  non-iterating indexes (#422).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2sp bug Something isn't working teamE
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants