From e5c7ded2227eef97f024b93af2b949cc2cddbe93 Mon Sep 17 00:00:00 2001 From: Neha Nene Date: Tue, 22 Mar 2022 20:29:31 -0500 Subject: [PATCH] fix: add to_hex for bigquery hash (#400) --- data_validation/result_handlers/text.py | 11 ----------- third_party/ibis/ibis_addon/operations.py | 2 +- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/data_validation/result_handlers/text.py b/data_validation/result_handlers/text.py index 9e3a2bf5e..73735ffb1 100644 --- a/data_validation/result_handlers/text.py +++ b/data_validation/result_handlers/text.py @@ -23,7 +23,6 @@ """ from data_validation import consts -import pandas as pd class TextResultHandler(object): @@ -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": diff --git a/third_party/ibis/ibis_addon/operations.py b/third_party/ibis/ibis_addon/operations.py index 1795c0dd5..4db34e103 100644 --- a/third_party/ibis/ibis_addon/operations.py +++ b/third_party/ibis/ibis_addon/operations.py @@ -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: