You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/05/04 03:52:04 UTC

[jira] [Commented] (BEAM-2151) Type mapping inconsistent in BeamSqlRow & BeamSqlRowCoder

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

ASF GitHub Bot commented on BEAM-2151:
--------------------------------------

GitHub user xumingming opened a pull request:

    https://github.com/apache/beam/pull/2886

    [BEAM-2151]Fix inconsistent mapping for SQL FLOAT

    This pull request is mainly to fix the SQL FLOAT mapping, previously it is mapped to Float in `BeamSQLRow`, but mapped to `Double` in `BeamSQLRowCoder`, now we consistently map SQL FLOAT to java Float.
    
    When try to unit test this, found another bug in BeamSQLRow: the VARCHAR field is not encode/decoded correctly(mainly because OUTTER Context vs NESTED Context), so fixed this bug at the same time.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/xumingming/beam BEAM-2151

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/beam/pull/2886.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2886
    
----
commit 02ffb848cf536cf631696f68051fecded2907931
Author: James Xu <xu...@gmail.com>
Date:   2017-05-04T03:44:14Z

    Fix inconsistent mapping for SQL FLOAT

----


> Type mapping inconsistent in BeamSqlRow & BeamSqlRowCoder
> ---------------------------------------------------------
>
>                 Key: BEAM-2151
>                 URL: https://issues.apache.org/jira/browse/BEAM-2151
>             Project: Beam
>          Issue Type: Bug
>          Components: dsl-sql
>            Reporter: James Xu
>            Assignee: James Xu
>            Priority: Blocker
>
> In BeamSqlRow, sql FLOAT is mapping to java Float:
> {code:java}
>     case FLOAT:
>       if (!(fieldValue instanceof Float)) {
>         throw new InvalidFieldException(
>             String.format("[%s] doesn't match type [%s]", fieldValue, fieldType));
>       }
>       break;
> {code}
> but in BeamSqlRowCoder, sql FLOAT is treated as java Double:
> {code:java}
>       case DOUBLE:
>       case FLOAT:
>         doubleCoder.encode(value.getDouble(idx), outStream, nested);
>         break;
> {code}
> Let's mapping sql FLOAT consistently to java Float?



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)