You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Ben Sully (Jira)" <ji...@apache.org> on 2020/11/08 11:47:00 UTC

[jira] [Commented] (ARROW-10329) [Rust][Datafusion] Datafusion queries involving a column name that begins with a number produces unexpected results

    [ https://issues.apache.org/jira/browse/ARROW-10329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17227973#comment-17227973 ] 

Ben Sully commented on ARROW-10329:
-----------------------------------

This behaviour seems consistent with Postgres at least:


{{❯ psql}}
{{psql (12.4)}}
{{Type "help" for help.}}

{{ben=# create table foo ("16_20mph" integer, "21_25mph" integer);}}
{{CREATE TABLE}}
{{ben=# insert into foo values (1, 2), (3, 4);}}
{{INSERT 0 2}}
{{ben=# SELECT 16_20mph, 21_25mph FROM foo;}}
{{ _20mph | _25mph }}
{{--------+--------}}
{{ 16 | 21}}
{{ 16 | 21}}
{{(2 rows)}}

{{ben=# SELECT "16_20mph", "21_25mph" FROM foo;}}
{{ 16_20mph | 21_25mph }}
{{----------+----------}}
{{ 1 | 2}}
{{ 3 | 4}}
{{(2 rows)}}

> [Rust][Datafusion] Datafusion queries involving a column name that begins with a number produces unexpected results
> -------------------------------------------------------------------------------------------------------------------
>
>                 Key: ARROW-10329
>                 URL: https://issues.apache.org/jira/browse/ARROW-10329
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Rust - DataFusion
>            Reporter: Morgan Cassels
>            Priority: Major
>
> This bug can be worked around by wrapping column names in quotes.
> Example:
> {{let query = "SELECT 16_20mph, 21_25mph FROM foo;"}}
> {{let logical_plan = ctx.create_logical_plan(query)?;}}
> {{logical_plan.schema().fields() now has fields: [_20mph, _25mph]}}
> The resulting table produced by this query looks like:
> ||{{_20mph}}||{{_25mph}}||
> |16|21|
> |16|21|
> Every row is identical, where the column value is equal to the initial number that appears in the column name.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)