Skip to content

Commit

Permalink
fix: add to_hex for bigquery hash (#400)
Browse files Browse the repository at this point in the history
  • Loading branch information
nehanene15 committed Mar 23, 2022
1 parent a597b56 commit e5c7ded
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
11 changes: 0 additions & 11 deletions data_validation/result_handlers/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"""

from data_validation import consts
import pandas as pd


class TextResultHandler(object):
Expand All @@ -36,16 +35,6 @@ def print_formatted_(self, result_df):
Utility for printing formatted results
:param result_df
"""
# the text transformer chokes on bytestring results (e.g. SHA256) this
# dataframe slice is to remove the source and target values
mask = result_df["validation_type"] == consts.ROW_VALIDATION
row_result_df = result_df[mask]
other_result_df = result_df[~mask]
row_result_df["source_agg_value"] = None
row_result_df["target_agg_value"] = None
frames = [row_result_df, other_result_df]
result_df = pd.concat(frames)

if self.format == "text":
print(result_df.to_string(index=False))
elif self.format == "csv":
Expand Down
2 changes: 1 addition & 1 deletion third_party/ibis/ibis_addon/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def format_hashbytes_bigquery(translator, expr):
arg, how = expr.op().args
compiled_arg = translator.translate(arg)
if how == "sha256":
return f"SHA256({compiled_arg})"
return f"TO_HEX(SHA256({compiled_arg}))"
elif how == "farm_fingerprint":
return f"FARM_FINGERPRINT({compiled_arg})"
else:
Expand Down

0 comments on commit e5c7ded

Please sign in to comment.