Uploaded image for project: 'Beam'
  1. Beam
  2. BEAM-3238

[SQL] Add builder to BeamRecordSqlType

Details

    • Improvement
    • Status: Resolved
    • P2
    • Resolution: Fixed
    • None
    • 2.3.0
    • dsl-sql
    • None

    Description

      Currently it's hard to match field names with types when constructing a BeamRecordSqlType, like here:

      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)
      );
      

      It would be much more readable to have a builder, along these lines:

      BeamRecordSqlType.builder()
        .withField("f_int", Types.INTEGER)
        .withStringField("f_str")
        .build();
      

      Attachments

        Activity

          People

            kedin Anton Kedin
            kedin Anton Kedin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: