简体   繁体   English

分组数据集中的 Bigquery 非空(地理点)

[英]Bigquery non-null(geographypoint) in grouped dataset

I need to pick non-null(geographypoint) from my grouped dataset.我需要从我的分组数据集中选择非空(地理点)。 The max function gives the following error.最大 function 给出以下错误。

MAX is not defined for arguments of type GEOGRAPHY at [65:11] MAX 未在 [65:11] 处为 GEOGRAPHY 类型的 arguments 定义

Consider the sample data:考虑示例数据:

╔════════════════════╦══════════════════════════════╗
║id                  ║Point                         ║
╠════════════════════╬══════════════════════════════╣             
║1                   ║POINT(-79.3123031 43.6839641) ║       
║1                   ║null                          ║      
╚════════════════════╩══════════════════════════════╝

I need to pick out the non null value from the grouped data.我需要从分组数据中挑选出非 null 值。 For numeric/string values, we can use max Is there a way to tackle this for Geography data in bigquery?对于数字/字符串值,我们可以使用max有没有办法在 bigquery 中为地理数据解决这个问题?

I need to pick out the non null value from the grouped data我需要从分组数据中挑选出非 null 值

Consider below approach考虑以下方法

select id, any_value(point) point
from data
where not point is null
group by id

MAX is not meaningful for spatial types because they are not simple values. MAX 对于空间类型没有意义,因为它们不是简单的值。 I think you need to use the Geography functions and either我认为您需要使用Geography 函数,或者

  • Extract a simple datatype (using a function like ST_X, or ST_AREA for example), and then you could use a MAX meaningfully to find for example the MAX longitude or the MAX area提取一个简单的数据类型(例如使用 function,例如 ST_X 或 ST_AREA),然后您可以有意义地使用 MAX 来查找例如 MAX 经度或 MAX 区域
  • Use a function like ST_BOUNDARY if you're looking for something like a spatial boundary from multiple GEOGRAPHY values如果您要从多个 GEOGRAPHY 值中寻找空间边界之类的东西,请使用 function 之类的 ST_BOUNDARY

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 bigQuery 中仅返回非空键/值 - Returning only non-null key/value in bigQuery 如何在 Kusto 中查询具有 null 和非空值的分组不同记录? - How to query for grouped distinct records that both have null and non-null values in Kusto? select 最后一个非空值和 append 到另一列 BigQuery/PYTHON - select last non-null value and append it to another column BigQuery/PYTHON 获取多个分区中的下一个(或上一个)非空值 - Get the next (or previous) non-null value in multiple partitioned 错误:必须返回非空值,因为返回类型“从不”不允许 null - Error: A non-null value must be returned since the return type 'Never' doesn't allow null 未处理的异常:PlatformException(空错误,主机平台为非空返回值返回 null 值。,null,空) - Unhandled Exception: PlatformException(null-error, Host platform returned null value for non-null return value., null, null) FirebaseCloudMessaging: PlatformException (PlatformException(null-error, Host platform returned null value for non-null return value., null, null)) - FirebaseCloudMessaging : PlatformException (PlatformException(null-error, Host platform returned null value for non-null return value., null, null)) 必须返回非空值,因为返回类型“UserCredentialPlatform”不允许空值 - A non-null value must be returned since the return type 'UserCredentialPlatform' doesn't allow null NgRx 在创建效果时抛出 'TypeError: undefined is not a non-null object' - NgRx throws 'TypeError: undefined is not a non-null object' when creating effect 根据跨多个列的第一个可用非空值连接两个表 - Join two tables based on first available non-null value across multiple columns
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM