true, tags: ["udfs"], } create or replace function ${self()}( byte_count int64, cost_category string ) returns float64 as ( case cost_category when "computing" then safe_divide(byte_count, pow(1024, 4)) * 6.25 when "active_logical_storage" then safe_divide(byte_count, pow(1024, 3)) * 0.000031507 * 24 when "longterm_logical_storage" then safe_divide(byte_count, pow(1024, 3)) * 0.000021918 * 24 when "active_physical_storage" then safe_divide(byte_count, pow(1024, 3)) * 0.000054795 * 24 when "longterm_physical_storage" then safe_divide(byte_count, pow(1024, 3)) * 0.000027397 * 24 else error(format("Unsupported cost category: %s", cost_category)) end ) options ( description = "バイト数とコストカテゴリからBigQuery利用コストの概算をUSDで返す。東京リージョンの公開単価を使用し、無料枠、契約割引、税、丸め、為替 換算は考慮しない。ストレージはGiB-hour単価を24倍した1日分" );