Skip to content

Negative min in synth_column_integer/numeric requires workarounds #7

@jabortell

Description

@jabortell

It appears that synth_column_integer() and synth_column_numeric() require some workarounds when using a negative min value. For example, this results in a SQL syntax error:

{{ synth_column_numeric(name="x", min=-1, max=1) }}

What happens is that min is compiled right next to another minus sign, resulting in a SQL comment:

    floor(
    (random() * (6--1) + -1)
 )
 as x

Specifying the min value as "(-1)" or " -1" gets around this.

Looks like the fix would be in the synth_distribution_continuous_uniform() macro, to add spaces around the - in {{max}}-{{min}}:

Image

Happy to submit a PR if that sounds right.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No 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