Skip to content

Fail to query DataFrame with Decimal with sum, treated as string #323

@jovezhong

Description

@jovezhong

Please make sure that the version you're using is still supported (you can find the list here).

You have to provide the following information whenever possible.

Describe what's wrong

A clear and concise description of what works not as it is supposed to.

A link to reproducer in https://fiddle.clickhouse.com/.

Does it reproduce on the most recent release?

The list of releases

Enable crash reporting

Change "enabled" to true in "send_crash_reports" section in config.xml:

<send_crash_reports>
        <!-- Changing <enabled> to true allows sending crash reports to -->
        <!-- the ClickHouse core developers team via Sentry https://sentry.io -->
        <enabled>false</enabled>

How to reproduce

  • Which ClickHouse server version to use
    chdb 3.1.2
  • Which interface to use, if it matters
    Python
  • Non-default settings, if any
  • CREATE TABLE statements for all tables involved
items=chdb.query("select * from file('costco_details.csv','CSV','ts_str String, total_amount Decimal32(2), warehouse String,item_name String,item_code String,item_amount Decimal32(2),item_note String,subtotal Decimal32(2),tax Decimal32(2),payment_method String, total_items_sold Int8, savings Decimal32(2)') settings input_format_csv_skip_first_lines = 1",output_format="DataFrame")

chdb.query("select parseDateTimeBestEffort(ts_str,3,'UTC') as ts, count(),sum(item_amount) from Python(items) group by 1",output_format="DataFrame")
  • Sample data for all these tables, use clickhouse-obfuscator if necessary
  • Queries to run that lead to an unexpected result

Expected behavior

A clear and concise description of what you expected to happen.
column in Decimal can be aggregated with sum

Error message and/or stacktrace

If applicable, add screenshots to help explain your problem.

Error
File "/Users/jove/Dev/marimo_notebooks/.venv/lib/python3.13/site-packages/chdb/init.py", line 103, in query
res = conn.query(sql, output_format)
RuntimeError: Code: 43. DB::Exception: Illegal type String of argument for aggregate function sum. (ILLEGAL_TYPE_OF_ARGUMENT)

Image

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions