snowflakedb / snowflakedb/snowpark-python

SNOW-1006168: Snowpark function `array_agg` converts data types to string

Open
#1,199 2 comments 3 reactions 1 assignee View on GitHub

@sfc-gh-ashahi is already working on this.

Since Mar 13, 2024.

bug feature needs triage
Dominant language
Python
Stars
341
Forks
155
Avg merge
4d 16h
Merged PRs (30d)
27

Description

Please answer these questions before submitting your issue. Thanks!

  1. What version of Python are you using?

    Snowsight Python notebook with snowflake-snowpark-python 1.11.1

  2. What operating system and processor architecture are you using?

    Snowsight Python notebook with snowflake-snowpark-python 1.11.1

  3. What are the component versions in the environment (pip freeze)?

    Snowsight Python notebook with snowflake-snowpark-python 1.11.1

  4. What did you do?

I used the function array_agg and a column of big ints.

import snowflake.snowpark as snowpark
from snowflake.snowpark.functions import col, array_agg

def main(session: snowpark.Session): 
   df = session.create_dataframe([[1], [2], [3], [1]], schema=["a"])
   print("Initial dtypes:", df.dtypes)
   df = df.select(array_agg("a", False).alias("result"))
   print("After array_agg dtypes:", df.dtypes) 
   return df
  1. What did you expect to see?

    I hoped to get a single row and a column with dtype array<bigint>. Instead I got array<string>.

The PY output when runing the code above is:

Initial dtypes: [('A', 'bigint')]
After array_agg dtypes: [('RESULT', 'array<string>')]

Why array<string>, this is crazy, but here is my number! as string? 🎤

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.