From 95b03f9dc1a0ed7cb47fdf72cc2368c677edfd40 Mon Sep 17 00:00:00 2001 From: Eric Duong Date: Thu, 2 May 2024 21:30:02 -0400 Subject: [PATCH] chore(data-warehouse): remove explicit integer handling on data warehouse connected tables (#22055) * remove explicit integer handling * update snapshot * Update query snapshots * Update query snapshots --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- posthog/hogql/transforms/property_types.py | 4 ---- .../transforms/test/__snapshots__/test_property_types.ambr | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/posthog/hogql/transforms/property_types.py b/posthog/hogql/transforms/property_types.py index 4a4f98be80094..58c8539533acd 100644 --- a/posthog/hogql/transforms/property_types.py +++ b/posthog/hogql/transforms/property_types.py @@ -5,8 +5,6 @@ from posthog.hogql.database.models import ( DateTimeDatabaseField, BooleanDatabaseField, - IntegerDatabaseField, - FloatDatabaseField, ) from posthog.hogql.escape_sql import escape_hogql_identifier from posthog.hogql.visitor import CloningVisitor, TraversingVisitor @@ -152,8 +150,6 @@ def visit_field(self, node: ast.Field): field_type = node.type.table_type.lazy_join.join_table.fields.get(str(field), None) prop_type = "String" - if isinstance(field_type, IntegerDatabaseField) or isinstance(field_type, FloatDatabaseField): - prop_type = "Float" if isinstance(field_type, DateTimeDatabaseField): prop_type = "DateTime" if isinstance(field_type, BooleanDatabaseField): diff --git a/posthog/hogql/transforms/test/__snapshots__/test_property_types.ambr b/posthog/hogql/transforms/test/__snapshots__/test_property_types.ambr index f302f8c4bfa2c..56759a0407de8 100644 --- a/posthog/hogql/transforms/test/__snapshots__/test_property_types.ambr +++ b/posthog/hogql/transforms/test/__snapshots__/test_property_types.ambr @@ -2,7 +2,7 @@ # name: TestPropertyTypes.test_data_warehouse_person_property_types ''' - SELECT persons__extended_properties.string_prop AS string_prop, accurateCastOrNull(persons__extended_properties.int_prop, %(hogql_val_6)s) AS int_prop, transform(persons__extended_properties.bool_prop, %(hogql_val_7)s, %(hogql_val_8)s, NULL) AS bool_prop + SELECT persons__extended_properties.string_prop AS string_prop, persons__extended_properties.int_prop AS int_prop, transform(persons__extended_properties.bool_prop, %(hogql_val_6)s, %(hogql_val_7)s, NULL) AS bool_prop FROM ( SELECT argMax(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(person.properties, %(hogql_val_0)s), ''), 'null'), '^"|"$', ''), person.version) AS persons___properties___email, person.id AS id FROM person