Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vdk-trino: fix ingesting value with bool type failing #753

Merged
merged 1 commit into from
Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ def _ingest_payload(
)

@staticmethod
def __to_bool(value: str) -> bool:
def __to_bool(value: Any) -> bool:
if isinstance(value, bool):
return value
if value == "true" or value == "True":
return True
if value == "false" or value == "False":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ def run(job_input):
payload=payload, destination_table="test_table"
)

payload_with_types = {
"str_data": "string",
"int_data": 12,
"float_data": 1.2,
"bool_data": True,
"decimal_data": 3.2,
}

job_input.send_object_for_ingestion(
payload=payload_with_types, destination_table="test_table"
)

# this setup:
# a) partial payload (only few columns are included)
# b) includes float data which is NaN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def test_ingest_to_trino(self):
"string 12 1.2 True 3.2\n"
"string 12 1.2 True 3.2\n"
"string 12 1.2 True 3.2\n"
"string 12 1.2 True 3.2\n"
"\n"
"------ -- --- ---- ---\n"
)
Expand Down