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

ISO 8601 duration panics when fractional part present #1819

Open
toptobes opened this issue Jan 9, 2025 · 6 comments
Open

ISO 8601 duration panics when fractional part present #1819

toptobes opened this issue Jan 9, 2025 · 6 comments
Assignees

Comments

@toptobes
Copy link

toptobes commented Jan 9, 2025

When inserting a duration such as '1ns', the Data API returns the following duration: 'PT0.000000001S'

However, if you try to turn around and insert that duration back into the Data API, it starts shaking and crying in the corner:

> await table.insertOne({ text: '1', int: 1, duration: 'PT0.000000001S' })
Uncaught:
DataAPIResponseError: Only values that are supported by the column data type can be included when inserting a document into a table.

The table default_keyspace.test_table defines the columns: text(text), int(int), ..., duration(duration), ....
The command included the following columns that had invalid values: duration: Error trying to convert to targetCQLType `DURATION` from value.class `java.lang.String`, value "PT0.000000001S". Root cause: Invalid String value for type `DURATION`; problem: Unable to convert 'PT0.000000001S' to a duration.

Resend the command using only supported column values.
@toptobes
Copy link
Author

toptobes commented Jan 9, 2025

Also, the error message for max # of nanoseconds is incorrect:

The total number of nanoseconds must be less or equal to 2147483647

This should be Long.MAX_VALUE instead.

@hemidactylus
Copy link
Contributor

(to the first point, we had discussed the matter in a meeting on Nov 12 (api+client teams) and it was remarked that the fix for the fractional seconds in the ISO format was going to extend beyond just the API code so it would not be a quick thing. Meanwhile, the suggested route is to always use C* format in writes and always expect ISO format in reads. Ref.)

@amorton
Copy link
Contributor

amorton commented Jan 13, 2025

@toptobes can you please include the full error object in the ticket please

@amorton
Copy link
Contributor

amorton commented Jan 13, 2025

However, if you try to turn around and insert that duration back into the Data API, it starts shaking and crying in the corner:

@toptobes This is NOT a good bug report, can you please try explain clearly:

  • The request you sent
  • The response you got back
  • The expected response

@amorton
Copy link
Contributor

amorton commented Jan 13, 2025

Over to @tatu-at-datastax for checking for duplicate

@tatu-at-datastax
Copy link
Contributor

I think I understand the problem wrt call, codec failure (although ideally request/response would be included).

This seems like a duplicate of #1626.

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

No branches or pull requests

4 participants