[ https://issues.apache.org/jira/browse/IGNITE-9951?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16658874#comment-16658874 ]
Stepan Pilschikov commented on IGNITE-9951: ------------------------------------------- [~pavel.petroshenko] checked case with Date, now i'ts works But with timestamp i still can't understand PHP put {code} $client = new Client(); $ENDPOINT = '127.0.0.1:10800'; $client->connect(new ClientConfiguration($ENDPOINT)); $cache = $client->getOrCreateCache("PH_TIMESTAMP")->setKeyType(ObjectType::TIMESTAMP)->setValueType(ObjectType::INTEGER); $cache->put((new Timestamp((DateTime::createFromFormat('Y-m-d H:i:s.u', '2018-10-22 13:35:19.117530'))->getTimestamp() * 1000, 117530)),1); {code} JS get {code} await igniteClient.connect(new IgniteClientConfiguration(ENDPOINT)); cache = (await igniteClient.getOrCreateCache("PH_TIMESTAMP")).setKeyType(ObjectType.PRIMITIVE_TYPE.TIMESTAMP); console.log(JSON.stringify(await cache.get(new Timestamp(new Date('2018-10-22T13:35:19.117530').getTime(), 117530)))); {code} When using timestamp as key i can't get value stored with php client (same python). And in a different way, when i put key timestamp from js i can't get it from php But when i put timestamp key from js i can get it with python As you see i using custom Timestamp object and define time and nano seconds What should i do to get same timestamp in JS or Python? > thin php: Date data type cut nanos > ---------------------------------- > > Key: IGNITE-9951 > URL: https://issues.apache.org/jira/browse/IGNITE-9951 > Project: Ignite > Issue Type: Bug > Components: thin client > Affects Versions: 2.7 > Environment: Ignite 2.7 latest sources > default cache configuration > Python 3.7 > nodejs 10+ > PHP 7.2+ > Ubuntu 17 > Reporter: Stepan Pilschikov > Assignee: Pavel Petroshenko > Priority: Major > Fix For: 2.7 > > > When using PHP data types TIMESTAMP or DATE have problem with getting data > with others clients, main reason that is nano seconds was cutted from php > client side > PHP code > {code} > <?php > require_once '/vendor/autoload.php'; > use Apache\Ignite\Client; > use Apache\Ignite\ClientConfiguration; > use Apache\Ignite\Data\Date; > use Apache\Ignite\Type\ObjectType; > > $client = new Client(); > $ENDPOINT = '127.0.0.1:10800'; > $client->connect(new ClientConfiguration($ENDPOINT)); > $cache = $client->getOrCreateCache("PH_DATE") > ->setKeyType(ObjectType::INTEGER) > ->setValueType(ObjectType::DATE); > $cache->put(1,Date::fromDateTime(DateTime::createFromFormat('Y-m-d > H:i:s.u', '2018-10-19 18:31:13.029726'))); > {code} > JS output > {code} > "2018-10-19T15:31:13.000Z" > {code} > Py code > {code} > from pyignite import Client > from pyignite.datatypes import * > client = Client() > client.connect('127.0.0.1', 10800) > cache = client.get_or_create_cache("PH_DATE") > print(str(cache.get(1, key_hint=IntObject))) > {code} > Py output > {code} > 2018-10-19 18:31:13 > {code} > When im using JS or Python for put looks like > Py > {code} > 2018-10-19 18:31:13.029000 > {code} > JS > {code} > "2018-10-19T15:31:13.029Z" > {code} > Same story with Timestamp when > PHP put > {code} > <?php > require_once '/vendor/autoload.php'; > use Apache\Ignite\Client; > use Apache\Ignite\ClientConfiguration; > use Apache\Ignite\Data\Timestamp; > use Apache\Ignite\Type\ObjectType; > > $client = new Client(); > $ENDPOINT = '127.0.0.1:10800'; > $client->connect(new ClientConfiguration($ENDPOINT)); > try { > $cache = > $client->getOrCreateCache("PH_TIMESTAMP")->setKeyType(ObjectType::INTEGER)->setValueType(ObjectType::TIMESTAMP); > $cache->put(1,(new Timestamp((DateTime::createFromFormat('Y-m-d H:i:s.u', > '2018-10-19 18:31:13.029734'))->getTimestamp() * 1000, 29734))); > } finally { > $client->disconnect(); > } > {code} > Py output > {code} > (datetime.datetime(2018, 10, 19, 18, 31, 13), 29734) > {code} > should look like > {code} > (datetime.datetime(2018, 10, 19, 18, 31, 13, 29000), 29734) > {code} > Or JS > {code} > "2018-10-19T15:31:13.000Z" > {code} > should look like > {code} > "2018-10-19T15:31:13.029Z" > {code} > Also wanna to admit that PHP Method Timestamp::fromDateTime(Data) didn't take > nano seconds from date time (thats why in timestamp initialization i am doing > what i do) -- This message was sent by Atlassian JIRA (v7.6.3#76005)