2016-07-08 8 views
3

を使用してJSONファイルからデータをインポートする際に、空の文字列( "")をDoubleデータ型に変換しますか?問題を再現する手順はありますか? 1.コマンドを実行しています: ./bq load --source_format = NEWLINE_DELIMITED_JSON --schema = lifeSchema.json dataset_test1.table_test_3 lifeData.json 2.データソースファイルとscemaファイルが添付されています。 3.エラーをスローします。ファイルの位置0から始まる行のJSON解析エラー: ファイル-00000000。値をdoubleに変換できませんでした。フィールド: computed_results_A;値:コマンドラインBQコマンド

期待される出力は?あなたは代わりに何を見ますか? 空文字列をNULLまたは0に変換したい0

使用している製品のバージョンは?どのオペレーティングシステムで?私はMAC OSX YOSEMITEを使用しています

ソースJSON lifeData.json { "スキーマ":{ "ベンダー": "com.bd.snowplow"、 "名": "in_life"、 "形式": "jsonschema 「info_self_currentAge」:45、「info_self_gender」:「バージョン」:「1-0-2」}、「データ」:{「ステップ」:0、「info_userId」:「53493764」、「info_campaignCity」: "info_spouse_currentAge":33、 "info_spouse_retirementAge":0、 "info_self_retirementAge":0、 :0、 "info_spouse_incomeInflation":5、 "info_spouse_lifeExpectancy":0、 "info_finances_sumInsured":0、 "info_finances_expectedReturns":6、 "info_finances_loanAmount":0、 "info_finances_liquidateSavings":true、 "info_finances_savingsAmount":0、 "info_spouse_monthlyIncome" 、 "info_finances_monthlyExpense":0、 "info_fi nis_expenseInflation ":6、" info_finances_expenseReduction ":10、" info_finances_monthlyIncome ":0、" info_finances_incomeInflation ":5、" computed_results_A ":" "calculate_results_B":null、 "computed_results_C":null、 "computed_results_D":null、 "uid_epoch "、" state ":" init "、" campaign_id ":" "、" campaign_link ":" "、tool_version": "20150701-lfi-v1"}、 "hierarchy":{"rootId": "53493764_1466504541604" "refRoot": "events"、 "refTree":["events"、 "in_life"] "94583157-af34-4ecb-8024-b9af7c9e54fa"、 "rootTstamp": "2016-06-21 10:22:24.000" 、 "refParent": "イベント"}}

スキーマJSON lifeSchema.json { "名前": "computed_results_A"、 "タイプ": "フロート"、 "モード": "NULL可能"

}

答えて

2

JSONファイルを1列のCSVファイルとして読み込みます。ファイルがBigQueryのにロードされると

bq load --field_delimiter='|' proj:set.table file.json json:string 

、あなたは完全に自由でJSONをパースするJSON_EXTRACT_SCALARまたはJavaScript UDFを使用することができます。

関連する問題