【问题标题】:Data type mismatch when creating pipe创建管道时数据类型不匹配
【发布时间】:2021-09-02 11:09:33
【问题描述】:

我正在创建一个雪管,它将数据从 S3 存储桶加载到表中。我的表包含一列数据类型为 GEOGRAPHY。

创建雪管时,我收到以下错误消息:“SQL 编译错误:表达式类型与列数据类型不匹配,应为 GEOGRAPHY,但为列 GEO_LOCATION 获得了 VARCHAR(16777216)

为什么假定传入列的类型是 VARCHAR(16777216)?我如何改变这个假设?因为我知道我的输入列的格式是正确的。

【问题讨论】:

  • 请使用产生此错误的 create 语句更新您的问题

标签: snowflake-cloud-data-platform type-mismatch snowflake-sql


【解决方案1】:

在你的雪管定义中尝试这样的事情:

TO_GEOGRAPHY()

【讨论】:

    【解决方案2】:

    目前,雪管在加载地理数据时需要转换。这是问题的重现:

    create or replace stage mystage;
    create or replace table test ( a geography );
    insert into test values ('POINT(-122.35 37.55)' );
    copy into @mystage from test;
    truncate table test;
    
    copy into test from @mystage; -- works
    truncate table test;
    
    create or replace pipe test_pipe as -- fails with expecting GEOGRAPHY but got VARCHAR(16777216) for column A
    copy into test from @mystage;
    

    如果你应用转换,它应该可以工作:

    create or replace pipe test_pipe as -- works
    copy into test from (select to_GEOGRAPHY($1) from @mystage);
    
    alter pipe test_pipe refresh;
    
    select * from test;
    

    这是一个已知问题,将来会修复。

    【讨论】:

      猜你喜欢
      • 2021-12-07
      • 1970-01-01
      • 1970-01-01
      • 2021-11-20
      • 2021-02-19
      • 1970-01-01
      • 2020-08-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多