Exemple #1
0
from tests.query.joins.join_structures import (
    clickhouse_assignees_node,
    clickhouse_events_node,
    clickhouse_groups_node,
    events_groups_join,
)

TEST_CASES = [
    pytest.param(
        CompositeQuery(
            from_clause=events_groups_join(
                clickhouse_events_node([
                    SelectedExpression(
                        "_snuba_group_id",
                        Column("_snuba_group_id", None, "group_id"),
                    ),
                ]),
                clickhouse_groups_node([
                    SelectedExpression("_snuba_id",
                                       Column("_snuba_id", None, "id"))
                ], ),
            ),
            selected_columns=[],
        ),
        {"gr": JoinModifier.ANY},
        id="Simple two table query with no reference. Semi join",
    ),
    pytest.param(
        CompositeQuery(
            from_clause=events_groups_join(
                clickhouse_events_node([
                    SelectedExpression(
Exemple #2
0
    join_type=JoinType.INNER,
)

TEST_CASES = [
    pytest.param(
        CompositeQuery(
            from_clause=BASIC_JOIN,
            selected_columns=[],
        ),
        CompositeQuery(
            from_clause=events_groups_join(
                events_node([
                    SelectedExpression(
                        "_snuba_group_id",
                        Column("_snuba_group_id", None, "group_id"),
                    ),
                ]),
                groups_node([
                    SelectedExpression("_snuba_id",
                                       Column("_snuba_id", None, "id"))
                ], ),
            ),
            selected_columns=[],
        ),
        id="Basic join",
    ),
    pytest.param(
        CompositeQuery(
            from_clause=BASIC_JOIN,
            selected_columns=[
                SelectedExpression(
                    "count_ev_id",
Exemple #3
0
 from_clause=events_groups_join(
     clickhouse_events_node(
         [
             SelectedExpression(
                 "_snuba_group_id",
                 Column("_snuba_group_id", None, "group_id"),
             ),
         ],
         binary_condition(
             BooleanFunctions.AND,
             binary_condition(
                 BooleanFunctions.AND,
                 binary_condition(
                     ConditionFunctions.GTE,
                     Column(None, None, "timestamp"),
                     Literal(None, datetime(2020, 8, 1)),
                 ),
                 binary_condition(
                     ConditionFunctions.LT,
                     Column(None, None, "timestamp"),
                     Literal(None, datetime(2020, 9, 1)),
                 ),
             ),
             binary_condition(
                 ConditionFunctions.EQ,
                 build_mapping_expr(
                     "tags[asd]",
                     None,
                     "tags",
                     Literal(None, "asd"),
                 ),
                 Literal(None, "sdf"),
             ),
         ),
         [Column("_snuba_group_id", None, "group_id")],
     ),
     clickhouse_groups_node([
         SelectedExpression("_snuba_id",
                            Column("_snuba_id", None, "id"))
     ], ),
 ),