8000 Fail to query DataFrame with Decimal with sum, treated as string · Issue #323 · chdb-io/chdb · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jovezhong opened this issue Apr 16 8000 , 2025 · 1 comment
Open

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

jovezhong opened this issue Apr 16, 2025 · 1 comment

Comments

@jovezhong
Copy link

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.

@jovezhong
Copy link
Author

Sorry I cannot share the sample data. I encountered such issue while writing this blog https://www.linkedin.com/pulse/lets-overkill-use-mcp-chdb-understand-your-costco-spending-jove-zhong-afrwc Workaround is to define the item amount as Float32, not Decimal32(2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0