Skip to content

Comparisons with schema:types properties inside if are incorrect #986

Closed

Description

@gramian

ArcadeDB Version: 23.2.1 (build e8f512f/1677638572021/main)

JDK Version: openjdk 11.0.18 2023-01-17

OS: MacOS 12.6

When using comparison against the name property of schema:types inside a (conditional) expression, wrong logical results are returned.

Expected behavior

'doc' true true true true

Actual behavior

'doc' true false false false

Steps to reproduce

CREATE DOCUMENT TYPE doc;
SELECT name, (name = 'doc'),
             if( (name = 'doc'), true, false),
             if( (name IN ['doc','XXX']), true, false),
             ifnull( (name = 'doc'), null)
FROM schema:types

Activity

  1. changed the title [-]Comparisons with `schema:type` properties inside `if` are incorrect[/-] [+]Comparisons with `schema:types` properties inside `if` are incorrect[/+] on Mar 31, 2023
  2. added a commit that references this issue on Mar 31, 2023
  3. lvca commented on Mar 31, 2023

    @lvca
    Member

    Trying to reproduce this without success:

      @Test
      public void testIfWithSchemaResult() throws IOException {
        Assertions.assertTrue(console.parse("connect " + URL));
        Assertions.assertTrue(console.parse("CREATE DOCUMENT TYPE doc;"));
        Assertions.assertTrue(console.parse("CREATE PROPERTY doc.prop STRING;"));
    
        Assertions.assertTrue(console.parse("INSERT INTO doc set name = 'doc'"));
    
        final ResultSet resultSet = console.getDatabase().command("sql",
            "SELECT name, (name = 'doc') as name2, if( (name = 'doc'), true, false) as name3, if( (name IN ['doc','XXX']), true, false) as name4, ifnull( (name = 'doc'), null) as name5 FROM schema:types");
    
        Assertions.assertTrue(resultSet.hasNext());
    
        final Result result = resultSet.next();
    
        Assertions.assertEquals("doc", result.getProperty("name"));
        Assertions.assertTrue((boolean) result.getProperty("name2"));
        Assertions.assertTrue((boolean) result.getProperty("name3"));
        Assertions.assertTrue((boolean) result.getProperty("name4"));
        Assertions.assertTrue((boolean) result.getProperty("name5"));
      }
  4. self-assigned this
    on Mar 31, 2023
  5. added this to the 23.3.1 milestone on Mar 31, 2023
  6. gramian commented on Mar 31, 2023

    @gramian
    CollaboratorAuthor

    I found this using 23.2.1 in Studio. I just tested the repo head with Studio and Console and it works.
    Sorry, I should have also tested right away on the current head.

  7. lvca commented on Mar 31, 2023

    @lvca
    Member

    Np, the test case now is in our test suite so we'll avoid any regression on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions