GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `first` and `last` functions return empty value for non multi-value types · Issue #663 · ArcadeData/arcadedb

first and last functions return empty value for non multi-value types #663

New issue
Copy link
New issue
Copy link
Closed
Closed
first and last functions return empty value for non multi-value types#663
Copy link
Assignees
lvca
Milestone
22.12.1

Description

@gramian
gramian
opened on Dec 8, 2022
Issue body actions

ArcadeDB Version: v22.11.1 (build d3c1dd2/1670448542475/main)

JDK Version: openjdk 11.0.16.1 2022-08-12

OS: MacOS 12.6

The first and last function do not work on non multi-valued fields as described in the docs, where it says just the value is returned. Instead an empty field is returned.

Expected behavior

{"result":[
  {"first(value)":1,"last(value):1},
  {"first(value)":1,"last(value)":3},
  {"first(value)":1,"last(value)":1},
  {"first(value)":1,"last(value)":2}],
"user":"root","version":"22.11.1 (build d3c1dd29bbb5f102090e90b577b9d0ef57a33c2c/1670448542475/main)"}

Actual behavior

{"result":[
  {},
  {"first(value)":1,"last(value)":3},
  {"first(value)":1,"last(value)":1},
  {"first(value)":1,"last(value)":2}],
"user":"root","version":"22.11.1 (build d3c1dd29bbb5f102090e90b577b9d0ef57a33c2c/1670448542475/main)"}

Steps to reproduce

Given a type with single and multi value records:

CREATE DOCUMENT TYPE mytype;
INSERT INTO mytype SET value = 1;
INSERT INTO mytype SET value = [1,2,3];
INSERT INTO mytype SET value = [1];
INSERT INTO mytype SET value = map("a",1,"b",2);

Then querying for first and last of value:

SELECT first(value), last(value) FROM mytype

yields the above results.

Activity

  1. gramian commented on Dec 8, 2022

    @gramian
    gramian
    on Dec 8, 2022
    CollaboratorAuthor
    More actions

    Would changing the return values in:

    arcadedb/engine/src/main/java/com/arcadedb/query/sql/function/coll/SQLFunctionFirst.java

    Line 45 in 39c6a7c

    return null;

    arcadedb/engine/src/main/java/com/arcadedb/query/sql/function/coll/SQLFunctionLast.java

    Line 45 in 39c6a7c

    return null;

    form null to value solve this already?

  2. lvca
    added a commit that references this issue on Dec 12, 2022

    SQL first() and last() functions not fixed with not multivalues

    55a409c
  3. lvca
    added this to the 22.12.1 milestone on Dec 12, 2022
  4. lvca
    self-assigned this
    on Dec 12, 2022
  5. lvca
    added
    bug
    on Dec 12, 2022
  6. lvca
    closed this as completedon Dec 12, 2022
  7. lvca commented on Dec 12, 2022

    @lvca
    lvca
    on Dec 12, 2022
    Member
    More actions

    Thanks, @gramian, I've also added your test cases to the automatic tests now:

    arcadedb/engine/src/test/java/com/arcadedb/query/sql/functions/sql/SQLFunctionsTest.java

    Line 494 in 55a409c

    public void testFirstAndLastFunctionsWithMultipleValues() {

  8. tae898
    added a commit that references this issue on Jun 28, 2026

    SQL first() and last() functions not fixed with not multivalues

    758940c
  9. mergify
    added a commit that references this issue on Jul 19, 2026

    chore(deps): bump io.github.jbellis:jvector from 4.0.0-rc.8-hf1 to 4.…

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

Metadata

Metadata

Assignees

  • @lvca
    lvca

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    • 22.12.1

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.