You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Andrey Mashenkov (Jira)" <ji...@apache.org> on 2022/11/08 12:38:00 UTC
[jira] [Updated] (IGNITE-18015) Column's type mismatch error when inserting data into columns with custom precision
[ https://issues.apache.org/jira/browse/IGNITE-18015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrey Mashenkov updated IGNITE-18015:
--------------------------------------
Summary: Column's type mismatch error when inserting data into columns with custom precision (was: Column's type mismatch error when inserting data into temporal columns with custom precision)
> Column's type mismatch error when inserting data into columns with custom precision
> -----------------------------------------------------------------------------------
>
> Key: IGNITE-18015
> URL: https://issues.apache.org/jira/browse/IGNITE-18015
> Project: Ignite
> Issue Type: Bug
> Components: sql
> Reporter: Pavel Tupitsyn
> Assignee: Andrey Mashenkov
> Priority: Major
> Labels: ignite-3
> Fix For: 3.0.0-beta2
>
>
> It is not possible to insert data into a column with custom precision:
> {code}
> Column's type mismatch [column=Column [... expectedType=TemporalNativeType [name=NativeTypeSpec [name=DATETIME, fixed=true], precision=4], actualType=TemporalNativeType [name=NativeTypeSpec [name=DATETIME, fixed=true], precision=6], val=2022-01-02T03:04]
> {code}
> Caused by the fact that *NativeTypes.fromObject* always uses default precision.
> *Reproducer:*
> {code:java}
> TableDefinition tblDef = SchemaBuilders.tableBuilder("PUB", "TEMP").columns(
> SchemaBuilders.column("key", ColumnType.INT32).build(),
> SchemaBuilders.column("time", ColumnType.time(3)).asNullable(true).build(),
> SchemaBuilders.column("datetime", ColumnType.datetime(4)).asNullable(true).build(),
> SchemaBuilders.column("timestamp", ColumnType.timestamp(5)).asNullable(true).build()
> ).withPrimaryKey("key").build();
> var node = startedNodes.get(0);
> ((TableManager) node.tables()).createTableAsync(tblDef.name(), tblCh ->
> SchemaConfigurationConverter.convert(tblDef, tblCh).changeReplicas(1).changePartitions(10)
> ).join();
> var table = client().tables().table("TEMP");
> var view = table.recordView();
> var tuple = Tuple.create().set("key", 1)
> .set("time", LocalTime.of(1, 2))
> .set("datetime", LocalDateTime.of(2022, 1, 2, 3, 4))
> .set("timestamp", Instant.ofEpochSecond(123));
> view.upsert(null, tuple);
> {code}
> The same is valid for var-length types.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)