Traces of lists Jzsef Marton Budapest University of Technology and - - PowerPoint PPT Presentation

traces of lists
SMART_READER_LITE
LIVE PREVIEW

Traces of lists Jzsef Marton Budapest University of Technology and - - PowerPoint PPT Presentation

Traces of lists Jzsef Marton Budapest University of Technology and Economics 2017-05-10, oCIM2@London Jzsef Marton - Traces of lists 1 CIR-2017-220 Specify order of list elements in list constructing functions collect( expr ) -


slide-1
SLIDE 1

2017-05-10, oCIM2@London József Marton - Traces of lists 1

Traces of lists

József Marton Budapest University of Technology and Economics

slide-2
SLIDE 2

2017-05-10, oCIM2@London József Marton - Traces of lists 2

Specify order of list elements in list constructing functions

  • collect( expr ) - aggregates expr into a list
  • rder of elements not specified, input ordering?? (if any) #165
  • what if collecting more lists with different ordering?

List comprehensions? #190, #202

extend syntax

  • For the current syntax:

UNWIND range(1, 10) as i // 1st query step RETURN collect(i ORDER BY i ASC) AS l // 2nd query step

  • For CIP2017-04-13 syntax

UNWIND range(1, 10) as i // 1st query step RETURN collect OF i ORDER BY i ASC AS l // 2nd query step

CIR-2017-220

slide-3
SLIDE 3

2017-05-10, oCIM2@London József Marton - Traces of lists 3

Resultset ordering between query steps

  • Does ordering matter in subsequent query steps?

MATCH (n) WITH n O R D E R b y n . v a l u e OPTIONAL MATCH (n)-->(m) RETURN n, m

  • Another example for collecting list in #165
  • If it matters,

pros: intuitive, currently(*) this is the way to set order for collect *: see CIR-2017-220

cons: poses difficulties(*) for parallel query evaluation *: performance loss

CIR TODO

slide-4
SLIDE 4

2017-05-10, oCIM2@London József Marton - Traces of lists 4

OPTIONAL UNWIND

  • Given four persons and the languages they command

CREATE (:Demo {name: 'Alice', languages: ['en', 'de', 'gr'] }) , (:Demo {name: 'Bob', languages: ['en', 'de'] }) , (:Demo {name: 'Cecil', languages: [] }) , (:Demo {name: 'Dennis' })

CIR-2017-234

MATCH (n:Demo) UNWIND n.languages AS lang RETURN n.name, lang

╒════════╤══════╕ │"n.name"│"lang"│ ╞════════╪══════╡ │"Alice" │"en" │ ├────────┼──────┤ │"Alice" │"de" │ ├────────┼──────┤ │"Alice" │"gr" │ ├────────┼──────┤ │"Bob" │"en" │ ├────────┼──────┤ │"Bob" │"de" │ └────────┴──────┘ ╒════════╤══════╕ │"n.name"│"lang"│ ╞════════╪══════╡ │"Alice" │"en" │ ├────────┼──────┤ │"Alice" │"de" │ ├────────┼──────┤ │"Alice" │"gr" │ ├────────┼──────┤ │"Bob" │"en" │ ├────────┼──────┤ │"Bob" │"de" │ ├────────┼──────┤ │"Cecil" │NULL │ ├────────┼──────┤ To be decided --> │"Dennis"│NULL │ └────────┴──────┘

MATCH (n:Demo) OPTIONAL UNWIND n.languages AS lang RETURN n.name, lang

slide-5
SLIDE 5

2017-05-10, oCIM2@London József Marton - Traces of lists 5

That‘s all

  • 1. Specify order of list elements in list constructing

functions

  • 2. Resultset ordering between query steps
  • 3. OPTIONAL UNWIND

Content presented here are a collection of current Cypher Improvement Requests (CIR), problems and ideas. They might change if/when they are built in the openCypher language.