GeezerVison is showing github.com — Assignment of (boolean) custom attributes are cast to strings when done from `console` · Issue #859 · ArcadeData/arcadedb
Assignment of (boolean) custom attributes are cast to strings when done from console #859DescriptionArcadeDB Version: v23.1.2 (build 9dbe3ce/1675373316135/main)
JDK Version: openjdk 11.0.18 2023-01-17
OS: MacOS 12.6
Custom attributes of type boolean (and probably other types too) assigned to properties (and probably types too) from the console are converted to string. From studio / http it works as expected.
Expected behavior
Custom attribute assigned is of type boolean
Actual behavior
Custom attribute assigned is of type string
Steps to reproduce
From console:
CREATE DOCUMENT TYPE doc;
CREATE PROPERTY doc.prop STRING;
ALTER PROPERTY doc.prop CUSTOM test = true;
Activitylvca commented on Feb 13, 2023 I've just created this test case and passes:
@Test
public void testCustomPropertyInSchema() throws IOException {
Assertions.assertTrue(console.parse("connect " + DB_NAME));
Assertions.assertTrue(console.parse("CREATE DOCUMENT TYPE doc;"));
Assertions.assertTrue(console.parse("CREATE PROPERTY doc.prop STRING;"));
Assertions.assertTrue(console.parse("ALTER PROPERTY doc.prop CUSTOM test = true;"));
Assertions.assertEquals(true, ((EmbeddedDatabase) console.getDatabase()).getSchema().getType("doc").getProperty("prop").getCustomValue("test"));
}gramian commented on Feb 13, 2023 CollaboratorAuthor More actions @lvca Weird. When I run:
SELECT properties.custom.test[0].type() FROM schema:types;
from the studio or console I get:
Is maybe "true" (string) implicitliy converted to true (boolean) in your test? lvca commented on Feb 13, 2023 Modified to include your query and it returns a boolean:
@Test
public void testCustomPropertyInSchema() throws IOException {
Assertions.assertTrue(console.parse("connect " + DB_NAME));
Assertions.assertTrue(console.parse("CREATE DOCUMENT TYPE doc;"));
Assertions.assertTrue(console.parse("CREATE PROPERTY doc.prop STRING;"));
Assertions.assertTrue(console.parse("ALTER PROPERTY doc.prop CUSTOM test = true;"));
Assertions.assertEquals(true, ((EmbeddedDatabase) console.getDatabase()).getSchema().getType("doc").getProperty("prop").getCustomValue("test"));
Assertions.assertEquals(Type.BOOLEAN.name().toUpperCase(),
((EmbeddedDatabase) console.getDatabase()).query("sql", "SELECT properties.custom.test[0].type() as type FROM schema:types").next()
.getProperty("type"));
}
Are you using a local or remote connection? gramian commented on Feb 13, 2023 CollaboratorAuthor More actions I am using a local connection. gramian commented on Feb 13, 2023 CollaboratorAuthor More actions @lvca Your test uses query while studio and console use both command. Could this make the difference? lvca commented on Feb 14, 2023 Tested with command and works. Since you mentioned Studio, it could be the HTTP layer or the RemoteDatabase itself. I'm checking this out. lvca commented on Feb 14, 2023 Also from remote works. I've added those new tests to the suite. gramian commented on Feb 14, 2023 CollaboratorAuthor More actions @lvca Can you also not manually reproduce this in the console? gramian commented on Feb 14, 2023 CollaboratorAuthor More actions Maybe (Hopefully) this resolved itself in the current snapshot, I only tested in 23.1.2. I will try to get the current repo head to work. gramian commented on Feb 15, 2023 CollaboratorAuthor More actions It works for me too now. Great!
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|