Skip to content

GIVEN is not greedy enough #49

@zane

Description

@zane

Overview

GIVEN expressions are not greedy enough. model GIVEN x, y is interpreted as (model GIVEN x), y. Should be (model GIVEN x, y).

Reproduction steps

Execute a query that computes the probability of an event given two variables using commas to separate the variables. For example (column / variable names can be changed):

SELECT
  PROBABILITY OF x 
  UNDER model 
  GIVEN y, z AS prob
FROM data

Expected results

A table with one column, prob, is returned. In other words, the query is interpreted as follows:

SELECT
  (PROBABILITY OF x 
  UNDER model 
  GIVEN y, z AS prob)
FROM data

Actual results

A table with two columns are returned, one with the result of PROBABILITY OF x UNDER model GIVEN y, and the column data.z renamed to prob. In other words, the query is interpreted as follows:

SELECT
  (PROBABILITY OF x 
  UNDER model 
  GIVEN y), (z AS prob)
FROM data

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions