Skip to content

Snowflake offline store, feature inference doesn't work for VARCHAR types. #2412

Closed

Description

@tonyqiu2020

Expected Behavior

When using Snowflake offline store, feature inference should consider VARCHAR columns in snowflake as str.

Current Behavior

When using Snowflake offline store, feature inference considers VARCHAR type columns in snowflake as object in pandas dataframe, and therefore cause UNKNOWN error.

https://github.com/feast-dev/feast/blob/master/sdk/python/feast/infra/offline_stores/snowflake_source.py#L196-L207

"object": ValueType.UNKNOWN,

Steps to reproduce

Specifications

  • Version: 0.18.0+
  • Platform: mac os
  • Subsystem:

Possible Solution

I would suggest changing ValueType.UNKNOWN to ValueType.STRING since pandas dtype object is str or mixed. And typically we just need it as string

https://github.com/feast-dev/feast/blob/master/sdk/python/feast/type_map.py#L532

Activity

  1. self-assigned this
    on Mar 23, 2022
  2. kevjumba commented on Mar 23, 2022

    @kevjumba
    Collaborator

    Hi Tony! Can you add a specific example of this not working? Have you encountered this because the way feature inference works is we capture the columns of a snowflake table and convert it to pandas dataframe as a single row.
    The snowflake documentation states here very clearly that a VARCHAR datatype converts to str which is handled by the type map as a ValueType.STRING.
    https://docs.snowflake.com/en/user-guide/python-connector-pandas.html

    Also string datatypes in Snowflake have been working for Feast in the past.

  3. tonyqiu2020 commented on Mar 23, 2022

    @tonyqiu2020
    Author

    I think it is general any varchar or str in snowflake

    create table test_table (
      name varchar (100),  -- variable string column
      preferences string, -- column used to store JSON type of data
      created_at timestamp
      )
    
    insert into test_table
    values ( 'test', 'str_test', '2020-04-04 16:57:53.653');
    

    And if we run code like this part
    https://github.com/feast-dev/feast/blob/master/sdk/python/feast/infra/offline_stores/snowflake_source.py#L196-L207

    I got [('NAME', 'object'), ('PREFERENCES', 'object'), ('CREATED_AT', 'datetime64[ns]')]

  4. felixwang9817 commented on Apr 16, 2022

    @felixwang9817
    Collaborator

    @tonyqiu2020 pretty sure #2558 resolves this! Feel free to reopen if I'm mistaken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions