Issues with TimeStamp when used for RDS that is backed by PostgreSQL
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 35/100
Piste de recherche
Commencez par la DateTimeParseException à TypeConverter.java:123 et suivez la façon dont ExecutionResult.java:132 convertit les champs d’horodatage renvoyés. Reproduisez la valeur PostgreSQL/RDS avec deux chiffres fractionnaires, puis ajoutez un test de régression pour l’analyse ; la prise en charge demandée d’Instant et de java.sql.Timestamp doit être évaluée séparément avant de considérer le travail comme terminé.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
I created an integration test that uses version 2.0.0 of the ads-data-api-client-library and writes and then retrieves data to a table with a timestamp column..
When retrieving a timestamp value that has millis mod 10 = 0, e.g. 2022-04-06 22:58:48.990 (or as displayed on the RDS query tool in the Aws console 2022-04-06 22:58:48.99), an exception is thrown, like so:
java.time.format.DateTimeParseException: Text '2022-04-06 22:58:48.99' could not be parsed, unparsed text found at index 19
0 = {StackTraceElement@6106} "java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2049)"
1 = {StackTraceElement@6107} "java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1874)"
2 = {StackTraceElement@6108} "com.amazon.rdsdata.client.TypeConverter.fromField(TypeConverter.java:123)"
3 = {StackTraceElement@6109} "com.amazon.rdsdata.client.ExecutionResult$Row.getValue(ExecutionResult.java:132)"
It appears that the parsing format does not properly deal with a date time string that doesn't have the 3rd digit to the right of the decimal place.
I have worked around this by adding one millisecond to date time values for which datetimevalue.toEpochMillis % 10 == 0,
e.g.
fun Instant.asRDSLocalDateTime() : LocalDateTime {
// Kuldge to deal with RDS formatting and parsing - date time values that don't have 3 digits of milli seconds , e.g. 2022-04-06 23:12:00.12 fail to parse due to RDS Client
// example exception: java.time.format.DateTimeParseException: Text '2022-04-06 22:58:48.99' could not be parsed, unparsed text found at index 19
var truncated = this.truncatedTo(ChronoUnit.MILLIS)
if (truncated.toEpochMilli() % 10L == 0L) {
truncated= truncated.plusMillis(1L)
}
return LocalDateTime.ofInstant(truncated,ZoneOffset.UTC)
}
Ever since I did that, I no longer get exceptions.
Should be simple to fix, just change the format string.
While you are in there, could you add support for Instants? Coverting back and forth to LocalDateTime is tedious.
And, while your at it, it would be easier to use the rds-data-api-client-library-java if it supported the java.sql types, e.g. TimeStamp. It would result in less boilerplate.
Thanks
- Langage dominant
- Java
- Étoiles
- 21
- Forks
- 5
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de awslabs/rds-data-api-client-library-java
-
Difficulté 3/5 1-2 jours Accessibilité débutants 45/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 45/100
awslabs/rds-data-api-client-library-java#11 · 2 commentaires ·
-
aws x-ray compatabilityOuverte
Difficulté 3/5 1-2 jours Accessibilité débutants 30/100
awslabs/rds-data-api-client-library-java#6 · 1 réaction ·
-
Missing dependenciesOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 35/100
awslabs/rds-data-api-client-library-java#5 · 4 commentaires ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 48/100
awslabs/rds-data-api-client-library-java#3 · 1 commentaire ·
Toutes les issues de awslabs/rds-data-api-client-library-java
Issues similaires
-
hermes-queue
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100
chrisalunlloyd2-sudo/mindpalace#337 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
ucsb-cs156/proj-frontiers#844 ·
-
Update spring-ldap to 4.0.7Ouvertetype: dependency-upgrade
Difficulté 1/5 Moins d'une heure Accessibilité débutants 76/100
spring-projects/spring-security#20057 ·
Les mainteneurs répondent en général sous 1 jour
-
Spark benchmarks crash with `[INVALID_DRIVER_MEMORY]` on JVMs whose default heap is below Spark's ~450 MB minimumPeut-être pris @sendaoYan l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 79/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
moquette-io/moquette#980 ·