LoginSignup
1

More than 5 years have passed since last update.

bq query --max_rows(--n)に指定できる最大値

Posted at

調査経緯

Cloud ShellやVMインスタンスからbq queryでBigQueryに接続してクエリ発行したとき、「--max_rows=行数」または「--n=行数」で指定できる最大値が日本語の公式リファレンスに記載されていなかった。

bq コマンドライン ツール リファレンス

推測

bq query --helpでオプションを確認したところ以下のようになっていたので、integerの最大値と推測する。
キャプチャ1_bqヘルプ_トリミング後.png

integerの最大値は「2147483647」なので、
「bq query --max_rows=2147483647 "実行したいクエリ"」で正常終了、
「bq query --max_rows=2147483648 "実行したいクエリ"」で異常終了すれば、推測通り。

結果

--max_rows=2147483647の場合
キャプチャ1_bq実行_正常_トリミング_隠し.png

正常終了。

--max_rows=2147483648の場合
キャプチャ1_bq実行_異常_トリミング_隠し.png

異常終了。BigQuery error in query operation: Value out of rangeが表示された。

以上から、「--max_rows(--n)」に指定できる最大値は「2147483647」と判明。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1