Created
April 19, 2021 18:12
-
-
Save leighmcculloch/01226c1f122511f43438d0522b89fc06 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
transaction_hash, | |
time_bounds, | |
split(regexp_replace(time_bounds, '(^[\\[\\(])|([\\]\\)]$)', ''), ',')[OFFSET(0)] as tbmin, | |
split(regexp_replace(time_bounds, '(^[\\[\\(])|([\\]\\)]$)', ''), ',')[OFFSET(1)] as tbmax, | |
FROM `crypto-stellar.crypto_stellar.history_transactions` | |
WHERE time_bounds IS NOT NULL | |
AND ( | |
( | |
(char_length(split(regexp_replace(time_bounds, '(^[\\[\\(])|([\\]\\)]$)', ''), ',')[OFFSET(0)]) > 18) | |
AND | |
(split(regexp_replace(time_bounds, '(^[\\[\\(])|([\\]\\)]$)', ''), ',')[OFFSET(0)] != "9223372036854775807") | |
) | |
OR | |
( | |
(char_length(split(regexp_replace(time_bounds, '(^[\\[\\(])|([\\]\\)]$)', ''), ',')[OFFSET(1)]) > 18) | |
AND | |
(split(regexp_replace(time_bounds, '(^[\\[\\(])|([\\]\\)]$)', ''), ',')[OFFSET(1)] != "9223372036854775807") | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This query is a little indirect. It finds transactions with time bounds where either the min or max have more than 18 characters and the value is not the value of int64 max. Time bounds are stored as strings and big query does not support uint64 so casting it to an int64 would probably wrap the value into negative space or error. Int 64 max is 19 characters, so more than 18 characters gets us close and the only transactions I could find today was int64 max which is why I excluded that explicitly.