[
https://issues.apache.org/jira/browse/BEAM-3238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16263746#comment-16263746
]
ASF GitHub Bot commented on BEAM-3238:
--------------------------------------
GitHub user akedin opened a pull request:
https://github.com/apache/beam/pull/4168
[BEAM-3238][SQL] Add BeamRecordSqlTypeBuilder
Follow this checklist to help us incorporate your contribution quickly and
easily:
- [ ] Make sure there is a [JIRA
issue](https://issues.apache.org/jira/projects/BEAM/issues/) filed for the
change (usually before you start working on it). Trivial changes like typos do
not require a JIRA issue. Your pull request should address just this issue,
without pulling in other changes.
- [ ] Each commit in the pull request should have a meaningful subject
line and body.
- [ ] Format the pull request title like `[BEAM-XXX] Fixes bug in
ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA
issue.
- [ ] Write a pull request description that is detailed enough to
understand what the pull request does, how, and why.
- [ ] Run `mvn clean verify` to make sure basic checks pass. A more
thorough check will be performed on your pull request automatically.
- [ ] If this contribution is large, please file an Apache [Individual
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
---
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/akedin/beam sql-record-type-builder
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/beam/pull/4168.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 #4168
----
commit 77769aa46dd9a972526f805f6c476c4039121b29
Author: Anton Kedin <[email protected]>
Date: 2017-11-23T00:04:05Z
[BEAM-3238][SQL] Move Coders to map in BeamRecordSqlType
Improve readability. All coders are supposed to be thread safe and
currently are backed by the static instances.
commit 96c2a67f38c3da501f37797a8f75c23d5baf2ca8
Author: Anton Kedin <[email protected]>
Date: 2017-11-23T03:17:21Z
[BEAM-3238][SQL] Add BeamRecordSqlTypeBuilder
To improve readability of creating BeamRecordSqlTypes.
----
> [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)