Documentation

Provenance.Example

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    Dependency graph
    Equations
    Instances For
      Dependency graph
      Equations
      Instances For
        Dependency graph
        Equations
        Instances For
          Dependency graph
          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            Dependency graph
            Equations
            Instances For
              Dependency graph
              Equations
              Instances For
                Dependency graph
                Equations
                Instances For
                  Dependency graph
                  Dependency graph
                  Dependency graph

                  The general (kind-indexed) syntax and its rewriting #

                  The same database, now through AggQuery: aggregation, HAVING, and the rewriting of both into the composite domain String ⊕ ℕ.

                  Equations
                  Instances For
                    Dependency graph
                    Dependency graph
                    Dependency graph
                    Dependency graph
                    Dependency graph
                    Dependency graph
                    Dependency graph
                    Dependency graph
                    Dependency graph
                    Dependency graph
                    Dependency graph
                    Dependency graph

                    A window #

                    SUM(1) OVER (PARTITION BY city) – the size of each city's group, given to every row of that city. A window removes no row and merges none, so the answer has as many rows as the input and every row keeps the annotation it came with: no group is created, so no group-existence factor arises.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      Dependency graph

                      The rows strictly before the current row's peers: a frame that contains neither the row nor its equals, so it can be empty in a world where the row is present. Its token is therefore read in the scalar convention, and the first row of each city aggregates over nothing.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        Dependency graph

                        An aggregate over no row #

                        With a null in the value domain, SUM over no row is NULL, as SQL has it, and not the zero the domain happened to offer. A window is where that becomes reachable on ordinary data: under the frame of the rows strictly before, the first row of each city aggregates over nothing.

                        Equations
                        Instances For
                          Dependency graph
                          Equations
                          Instances For
                            Dependency graph
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              Dependency graph

                              Where the nulls go is the clause's business #

                              Three rows of one city, one of them with a null id. The frame is the same in both queries below – the rows strictly before the current row's peers – and so is the data; only the ORDER BY differs, in where it places the null. The running counts come out different, which is the point: the domain's own order has nothing to say about it, and a frame stated against that order cannot express either reading.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                Dependency graph
                                Equations
                                Instances For
                                  Dependency graph

                                  ORDER BY id ASC NULLS LAST: the null row is counted last.

                                  Equations
                                  Instances For
                                    Dependency graph

                                    ORDER BY id ASC NULLS FIRST: the null row is counted first.

                                    Equations
                                    Instances For
                                      Dependency graph
                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For
                                        Dependency graph
                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          Dependency graph