-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feat/pd/report-when-player-state-is-error
- Loading branch information
Showing
16 changed files
with
135 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -246,15 +246,6 @@ def create_data_warehouse_table_with_usage(self): | |
field_name="events", | ||
configuration={"experiments_optimized": True, "experiments_timestamp_key": "ds"}, | ||
) | ||
|
||
DataWarehouseJoin.objects.create( | ||
team=self.team, | ||
source_table_name=table_name, | ||
source_table_key="userid", | ||
joining_table_name="persons", | ||
joining_table_key="properties.$user_id", | ||
field_name="person", | ||
) | ||
return table_name | ||
|
||
@freeze_time("2020-01-01T12:00:00Z") | ||
|
@@ -869,8 +860,9 @@ def test_query_runner_with_data_warehouse_series_no_end_date_and_nested_id(self) | |
|
||
_create_person( | ||
team=self.team, | ||
distinct_ids=["internal_test_1"], | ||
properties={"email": "[email protected]", "$user_id": "internal_test_1"}, | ||
uuid="018f14b8-6cf3-7ffd-80bb-5ef1a9e4d328", | ||
distinct_ids=["018f14b8-6cf3-7ffd-80bb-5ef1a9e4d328", "internal_test_1"], | ||
properties={"email": "[email protected]"}, | ||
) | ||
|
||
_create_event( | ||
|
@@ -946,7 +938,7 @@ def test_query_runner_with_data_warehouse_series_no_end_date_and_nested_id(self) | |
) | ||
|
||
# Assert the expected join condition in the clickhouse SQL | ||
expected_join_condition = f"and(equals(events.team_id, {query_runner.count_query_runner.team.id}), equals(event, %(hogql_val_12)s), greaterOrEquals(timestamp, assumeNotNull(parseDateTime64BestEffortOrNull(%(hogql_val_13)s, 6, %(hogql_val_14)s))), lessOrEquals(timestamp, assumeNotNull(parseDateTime64BestEffortOrNull(%(hogql_val_15)s, 6, %(hogql_val_16)s))))) AS e__events ON" | ||
expected_join_condition = f"and(equals(events.team_id, {query_runner.count_query_runner.team.id}), equals(event, %(hogql_val_11)s), greaterOrEquals(timestamp, assumeNotNull(parseDateTime64BestEffortOrNull(%(hogql_val_12)s, 6, %(hogql_val_13)s))), lessOrEquals(timestamp, assumeNotNull(parseDateTime64BestEffortOrNull(%(hogql_val_14)s, 6, %(hogql_val_15)s))))) AS e__events ON" | ||
self.assertIn( | ||
expected_join_condition, | ||
str(response.clickhouse), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Print compatibility table | ||
from django.core.management.base import BaseCommand | ||
|
||
|
||
class Command(BaseCommand): | ||
help = "Print a Hog/HogQL STL compatibility table" | ||
|
||
def handle(self, *args, **options): | ||
from posthog.hogql.functions.mapping import HOGQL_CLICKHOUSE_FUNCTIONS, HOGQL_COMPARISON_MAPPING | ||
|
||
hogql_functions = set(HOGQL_COMPARISON_MAPPING.keys()).union(set(HOGQL_CLICKHOUSE_FUNCTIONS.keys())) | ||
|
||
from hogvm.python.stl import STL | ||
from hogvm.python.stl.bytecode import BYTECODE_STL | ||
|
||
hog_functions = set(STL.keys()).union(set(BYTECODE_STL.keys())) | ||
|
||
hogql_functions = { | ||
fn | ||
if fn not in {f.lower() for f in hog_functions} | ||
else next((f for f in hog_functions if f.lower() == fn), fn) | ||
for fn in hogql_functions | ||
} | ||
|
||
all_functions = sorted(hog_functions.union(hogql_functions)) | ||
max_length = max(len(fn) for fn in all_functions) | ||
|
||
for fn in all_functions: | ||
print( # noqa: T201 | ||
fn.ljust(max_length), | ||
"HogQL" if fn in hogql_functions else " ", | ||
"Hog" if fn in hog_functions else " ", | ||
) |