Snowflake将拼花中的布尔值解释为NULL?

问题描述

镶木地板条目示例(所有条目的is_active_entity为真)

{
 "is_active_entity": true,"is_removed": false
}

表明所有值都为NULL的查询

select  $1:IS_ACTIVE_ENTITY::boolean,count(*) from @practitioner_delta_stage/part-00000-49224c02-150b-493b-8036-54ab30a8ff40-c000.snappy.parquet group by $1:IS_ACTIVE_ENTITY::boolean ;

输出只有一组为NULL

$1:IS_ACTIVE_ENTITY::BOOLEAN    COUNT(*)
    NULL                                            4930277

我不知道我要去哪里哪里,Spark在镶木地板中编写了正确的架构,如示例所示,但雪花将其视为NULL。

我该如何解决

解决方法

文件中的列被引用。因此,"is_active_entity""IS_ACTIVE_ENTITY"

不同

请尝试以下查询:

select $1:is_active_entity::boolean,count(*) from @practitioner_delta_stage/part-00000-49224c02-150b-493b-8036-54ab30a8ff40-c000.snappy.parquet group by $1:IS_ACTIVE_ENTITY::boolean ;

更多信息:https://docs.snowflake.com/en/sql-reference/identifiers-syntax.html#:~:text=The%20identifier%20is%20case%2Dsensitive