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

DataStore SQLiteModelFieldTypeConverter DateTime and Time value format logics breaks amplify-flutter #1736

Closed
1 task done
HuiSF opened this issue May 13, 2022 · 2 comments
Assignees
Labels
bug Something isn't working datastore DataStore category/plugins

Comments

@HuiSF
Copy link
Member

HuiSF commented May 13, 2022

Before opening, please confirm:

Language and Async Model

Java

Amplify Categories

DataStore

Gradle script dependencies

// Put output below this line

Environment information

# Put output below this line


Please include any relevant guides or documentation you're referencing

No response

Describe the bug

Since amplify-android version 1.34.0, a new change has been introduced to SQLiteModelFieldTypeConverter.java to ensure unified DateTime, and Time string formats to ensure correct sorting when query sorting by these values.

We've identified this new changes breaks query by AWSTime field functionality in amplify-flutter.

  1. Originally amplify-android directly writes amplify-flutter passed Time values in String type into SQLite
  2. Now amplify-android reformats the values in String type as well
  3. The new format of the Time value in amplify-android is different from amplify-flutter

Under this condition, when query data using amplify-flutter, it returns empty result, e.g.

Query model with awsTimeField values as 00:00:00

Amplify.DataStore.query(
  ModelWithAWSTimeField.class,
  where: ModelWithAWSTimeField.AWSTIMEFIELD.eq(
    TemporalTime(DateTime.fromMillisecondsSinceEpoch(0)),
  ),
);

With the new format, 00:00:00 is written in SQLite as 00:00:000000000Z. The format of the value of the query predicate, however, is handled by Temporal.Time#format, which doesn't format value into the format as what in the DB tables. therefore DB query returns empty result.

Summary

  • The newly add formatting logic is standalone and Temporal.Time#format has a different formatter
  • amplify-android should probably not reformat amplify-flutter passed string value

Reproduction steps (if applicable)

No response

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


amplifyconfiguration.json

No response

GraphQL Schema

// Put your schema below this line

Additional information and screenshots

No response

@poojamat poojamat added datastore DataStore category/plugins bug Something isn't working labels May 13, 2022
@poojamat poojamat assigned poojamat and mikepschneider and unassigned poojamat Jul 6, 2022
@poojamat
Copy link
Contributor

poojamat commented Jul 6, 2022

Fixed with the commit:57a48ed

@poojamat poojamat closed this as completed Jul 6, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jul 6, 2022

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working datastore DataStore category/plugins
Projects
None yet
Development

No branches or pull requests

4 participants