Skip to content

Commit

Permalink
fix: keys
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphrass committed Jun 27, 2024
1 parent 6363e03 commit e813558
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions butterfree/configs/db/cassandra_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ def translate(self, schema: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
"integertype": "int",
"longtype": "bigint",
"stringtype": "text",
"arraytype(longtype,true)": "frozen<list<bigint>>",
"arraytype(stringtype,true)": "frozen<list<text>>",
"arraytype(floattype,true)": "frozen<list<float>>",
"arraytype(longtype, true)": "frozen<list<bigint>>",
"arraytype(stringtype, true)": "frozen<list<text>>",
"arraytype(floattype, true)": "frozen<list<float>>",
}
cassandra_schema = []
for features in schema:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pyspark.sql.types import DoubleType, FloatType, LongType, TimestampType
from pyspark.sql.types import DoubleType, FloatType, LongType, TimestampType, ArrayType, StringType
from pytest import fixture

from butterfree.constants import DataType
Expand Down Expand Up @@ -30,6 +30,7 @@ def fs_schema():
{"column_name": "id", "type": LongType(), "primary_key": True},
{"column_name": "timestamp", "type": TimestampType(), "primary_key": True},
{"column_name": "new_feature", "type": FloatType(), "primary_key": False},
{"column_name": "array_feature", "type": ArrayType(StringType(),True), "primary_key": False},
{
"column_name": "feature1__avg_over_1_week_rolling_windows",
"type": FloatType(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ def test_create_table_query(self, fs_schema):
expected_query = [
"CREATE TABLE test.table_name "
"(id LongType, timestamp TimestampType, new_feature FloatType, "
"array_feature ArrayType(StringType(), True), "
"feature1__avg_over_1_week_rolling_windows FloatType, "
"PRIMARY KEY (id, timestamp));"
]

query = cassandra_migration.create_query(fs_schema, "table_name")

assert query, expected_query

0 comments on commit e813558

Please sign in to comment.