插入值插入错误

时间:2019-04-21 20:54:17

标签: google-bigquery

我要插入多行数据,每行有两个记录列。

第一行正确插入(以及只有一行),但是所有后续行都有一个不正确的值(sell.min)。它恰好是第一条记录的第一列。

查询


INSERT INTO market_data.daily (date, locationId, typeId, typeName, sell, buy, totalVolume) VALUES 
("""2019-04-21""", 60003760, 18837, """Corpum C-Type Energized Explosive Membrane""", 
  (6550027.0, 3.999999993E7, 1.44241181091E7, 8428558.23879, 7456719.34645, 14.0, -1.0), 
  (1006502.65, 1555047.05, 1258968.26415, 247301.248151, 1555047.04377, 13.0, -1.0), 
-1.0), 
("""2019-04-21""", 60003760, 33281, """Capital Drone Durability Enhancer I""", 
  (5.199989895E7, 5.1999999E7, 5.1999973063E7, 57.7494660851, 5.199989895E7, 3.0, -1.0), 
  (5000000.02, 4.199999091E7, 3.05050486484E7, 1.47204376114E7, 4.1999990902E7, 7.0, -1.0),
  -1.0), 
("""2019-04-21""", 60003760, 49979, """'Absolute' Injection Augmentor""", 
  (3000000.0, 9.999999999E7, 6.37555555511E7, 4.87653907276E7, 3000000.0, 3.0, -1.0), 
  (10.01, 10.01, 10.01, 0.01, 10.01, 1.0, -1.0), 
-1.0), 
("""2019-04-21""", 60003760, 18839, """Centum C-Type Energized Explosive Membrane""", 
  (3999999.84, 2.999999996E7, 1.8556233027E7, 6729883.37456, 3999999.84057, 15.0, -1.0), 
  (1006989.98, 3500001.98, 1791680.30288, 936471.377223, 3500001.98, 10.0, -1.0), 
-1.0), 
("""2019-04-21""", 60003760, 14262, """Dark Blood Stasis Webifier""", 
  (1.1069999996E7, 2.4523999696E7, 1.35810174441E7, 3.26196555149E7, 1.10699999963E7, 18.0, -1.0), 
  (97842.98, 1.0179234021E7, 8.88308106524E7, 2.47111060358E7, 1.01792340196E7, 24.0, -1.0),
-1.0);

表架构


date    STRING  REQUIRED    
locationId  INTEGER REQUIRED    
typeId  INTEGER REQUIRED    
typeName    STRING  REQUIRED    
sell    RECORD  REQUIRED    
sell. min   NUMERIC REQUIRED    
sell. max   NUMERIC REQUIRED    
sell. average   NUMERIC REQUIRED    
sell. stdDev    NUMERIC REQUIRED    
sell. percentile    NUMERIC REQUIRED    
sell. orderCount    NUMERIC REQUIRED    
sell. volume    NUMERIC NULLABLE    
buy RECORD  REQUIRED    
buy. min    NUMERIC REQUIRED    
buy. max    NUMERIC REQUIRED    
buy. average    NUMERIC REQUIRED    
buy. stdDev NUMERIC REQUIRED    
buy. percentile NUMERIC REQUIRED    
buy. orderCount NUMERIC REQUIRED    
buy. volume NUMERIC NULLABLE    
totalVolume NUMERIC NULLABLE

Result

Picture of result

据我所知,除第一个以外的

sell.min值是与查询中其他任何内容都不相关的低值。它们并不总是整数。

从Web UI或Java API执行查询时会发生这种情况。

1 个答案:

答案 0 :(得分:1)

在下面改用

#standardSQL
INSERT INTO market_data.daily (date, locationId, typeId, typeName, sell, buy, totalVolume) VALUES 
("""2019-04-21""", 60003760, 18837, """Corpum C-Type Energized Explosive Membrane""", 
  STRUCT<min NUMERIC, max NUMERIC, average NUMERIC, stdDev NUMERIC, percentile NUMERIC, orderCount NUMERIC, volume  NUMERIC>(6550027.0, 3.999999993E7, 1.44241181091E7, 8428558.23879, 7456719.34645, 14.0, -1.0), 
  STRUCT<min NUMERIC, max NUMERIC, average NUMERIC, stdDev NUMERIC, percentile NUMERIC, orderCount NUMERIC, volume  NUMERIC>(1006502.65, 1555047.05, 1258968.26415, 247301.248151, 1555047.04377, 13.0, -1.0), 
-1.0), 
("""2019-04-21""", 60003760, 33281, """Capital Drone Durability Enhancer I""", 
  STRUCT<min NUMERIC, max NUMERIC, average NUMERIC, stdDev NUMERIC, percentile NUMERIC, orderCount NUMERIC, volume  NUMERIC>(5.199989895E7, 5.1999999E7, 5.1999973063E7, 57.7494660851, 5.199989895E7, 3.0, -1.0), 
  STRUCT<min NUMERIC, max NUMERIC, average NUMERIC, stdDev NUMERIC, percentile NUMERIC, orderCount NUMERIC, volume  NUMERIC>(5000000.02, 4.199999091E7, 3.05050486484E7, 1.47204376114E7, 4.1999990902E7, 7.0, -1.0),
  -1.0), 
("""2019-04-21""", 60003760, 49979, """'Absolute' Injection Augmentor""", 
  STRUCT<min NUMERIC, max NUMERIC, average NUMERIC, stdDev NUMERIC, percentile NUMERIC, orderCount NUMERIC, volume  NUMERIC>(3000000.0, 9.999999999E7, 6.37555555511E7, 4.87653907276E7, 3000000.0, 3.0, -1.0), 
  STRUCT<min NUMERIC, max NUMERIC, average NUMERIC, stdDev NUMERIC, percentile NUMERIC, orderCount NUMERIC, volume  NUMERIC>(10.01, 10.01, 10.01, 0.01, 10.01, 1.0, -1.0), 
-1.0), 
("""2019-04-21""", 60003760, 18839, """Centum C-Type Energized Explosive Membrane""", 
  STRUCT<min NUMERIC, max NUMERIC, average NUMERIC, stdDev NUMERIC, percentile NUMERIC, orderCount NUMERIC, volume  NUMERIC>(3999999.84, 2.999999996E7, 1.8556233027E7, 6729883.37456, 3999999.84057, 15.0, -1.0), 
  STRUCT<min NUMERIC, max NUMERIC, average NUMERIC, stdDev NUMERIC, percentile NUMERIC, orderCount NUMERIC, volume  NUMERIC>(1006989.98, 3500001.98, 1791680.30288, 936471.377223, 3500001.98, 10.0, -1.0), 
-1.0), 
("""2019-04-21""", 60003760, 14262, """Dark Blood Stasis Webifier""", 
  STRUCT<min NUMERIC, max NUMERIC, average NUMERIC, stdDev NUMERIC, percentile NUMERIC, orderCount NUMERIC, volume  NUMERIC>(1.1069999996E7, 2.4523999696E7, 1.35810174441E7, 3.26196555149E7, 1.10699999963E7, 18.0, -1.0), 
  STRUCT<min NUMERIC, max NUMERIC, average NUMERIC, stdDev NUMERIC, percentile NUMERIC, orderCount NUMERIC, volume  NUMERIC>(97842.98, 1.0179234021E7, 8.88308106524E7, 2.47111060358E7, 1.01792340196E7, 24.0, -1.0),
-1.0);   

这是快速且“肮脏”的技巧,可让您继续插入

您可以看到-在这里-我刚刚添加了显式字段定义

STRUCT<min NUMERIC, max NUMERIC, average NUMERIC, stdDev NUMERIC, percentile NUMERIC, orderCount NUMERIC, volume  NUMERIC>