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

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

xumingming commented on issue #4168: [BEAM-3238][SQL] Add 
BeamRecordSqlTypeBuilder
URL: https://github.com/apache/beam/pull/4168#issuecomment-346831152
 
 
   I like this idea!
   
   One minor comment: Can we put the `BeamRecordSqlTypeBuilder` inside 
`BeamRecordSqlType`? it will keep the surface api of 
`org.apache.beam.sdk.extensions.sql` cleaner.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> [SQL] Add builder to BeamRecordSqlType
> --------------------------------------
>
>                 Key: BEAM-3238
>                 URL: https://issues.apache.org/jira/browse/BEAM-3238
>             Project: Beam
>          Issue Type: Improvement
>          Components: dsl-sql
>            Reporter: Anton Kedin
>            Assignee: Anton Kedin
>
> Currently it's hard to match field names with types when constructing a 
> BeamRecordSqlType, like 
> [here|https://github.com/apache/beam/blob/39e66e953b0f8e16435acb038cad364acf2b3a57/sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/integrationtest/BeamSqlBuiltinFunctionsIntegrationTestBase.java#L64-L71]:
> {code:java}
> BeamRecordSqlType type = BeamRecordSqlType.create(
>     Arrays.asList("ts", "c_tinyint", "c_smallint",
>         "c_integer", "c_bigint", "c_float", "c_double", "c_decimal",
>         "c_tinyint_max", "c_smallint_max", "c_integer_max", "c_bigint_max"),
>     Arrays.asList(Types.DATE, Types.TINYINT, Types.SMALLINT,
>         Types.INTEGER, Types.BIGINT, Types.FLOAT, Types.DOUBLE, Types.DECIMAL,
>         Types.TINYINT, Types.SMALLINT, Types.INTEGER, Types.BIGINT)
> );
> {code}
> It would be much more readable to have a builder, along these lines:
> {code:java}
> BeamRecordSqlType.builder()
>   .withField("f_int", Types.INTEGER)
>   .withStringField("f_str")
>   .build();
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to