10000 AQL insert query fails to concatenate string an counter value · Issue #3849 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

AQL insert query fails to concatenate string an counter value #3849

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
5 tasks done
Simran-B opened this issue Nov 30, 2017 · 3 comments
Closed
5 tasks done

AQL insert query fails to concatenate string an counter value #3849

Simran-B opened this issue Nov 30, 2017 · 3 comments
Assignees
Labels
1 Question 2 Solved Resolution 3 AQL Query language related

Comments

@Simran-B
Copy link
Contributor
Simran-B commented Nov 30, 2017

my environment running ArangoDB

I'm using the latest ArangoDB of the respective release series:

  • 3.2.8

Mode:

  • Single-Server

Storage-Engine:

  • mmfiles

On this operating system:

  • Windows, version: 10

this is an AQL-related issue:

I'm issuing AQL via:

  • web interface with this browser: Chrome 62.0.3202.94 running on this OS: Windows 10

I've run db._explain("<my aql query>") and it didn't shed more light on this.
The AQL query in question is:

FOR i IN 1..3
INSERT {title: CONCAT("Foo" + i), _key: TO_STRING(i)} INTO test RETURN NEW

The issue can be reproduced using this dataset:
A blank collection "test"

These are the steps to reproduce:

  1. open the browser on http://127.0.0.1:8529
  2. log in as root
  3. use database [x] _system
  4. paste query and run

The following problem occurs:
It does not concatenate the title string like "Foo" + number, but instead, it becomes "number" only.

[
  {
    "_key": "1",
    "_id": "test/1",
    "_rev": "_W-yM97m---",
    "title": "1"
  },
  {
    "_key": "2",
    "_id": "test/2",
    "_rev": "_W-yM97m--_",
    "title": "2"
  },
  {
    "_key": "3",
    "_id": "test/3",
    "_rev": "_W-yM97m--A",
    "title": "3"
  }
]

The execution plan looks fine however:

Execution plan:
 Id   NodeType            Est.   Comment
  1   SingletonNode          1   * ROOT
  2   CalculationNode        1     - LET #2 = 1 .. 3   /* range */   /* simple expression */
  3   EnumerateListNode      3     - FOR i IN #2   /* list iteration */
  4   CalculationNode        3       - LET #4 = { "title" : CONCAT(("Foo" + i)), "_key" : TO_STRING(i) }   /* simple expression */
  5   InsertNode             3       - INSERT #4 IN test
  6   ReturnNode             3       - RETURN $NEW

Indexes used:
 none

Optimization rules applied:
 Id   RuleName
  1   remove-data-modification-out-variables

Write query options:
 Option                   Value
 ignoreErrors             false
 waitForSync              false
 nullMeansRemove          false
 mergeObjects             true
 ignoreDocumentNotFound   false
 readCompleteInput        false
 useIsRestore             false
 consultAqlWriteFilter    false
@Simran-B Simran-B added 1 Bug 3 AQL Query language related labels Nov 30, 2017
@jsteemann
Copy link
Contributor

Shouldn't it be CONCAT("Foo", i) instead of CONCAT("Foo" + i)?

@jsteemann
Copy link
Contributor

Then it will work just fine. The "+" operator will not concatenate strings in AQL. It is an arithmetic operator.

@Simran-B
Copy link
Contributor Author

Yeah, sorry for that stupid mistake.

@Simran-B Simran-B added 1 Question 2 Solved Resolution and removed 1 Bug labels Nov 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 Question 2 Solved Resolution 3C6D 3 AQL Query language related
Projects
None yet
Development

No branches or pull requests

2 participants
0