Github user srdo commented on a diff in the pull request:

    https://github.com/apache/storm/pull/2443#discussion_r155321576
  
    --- Diff: 
sql/storm-sql-core/src/jvm/org/apache/storm/sql/compiler/CompilerUtil.java ---
    @@ -89,16 +95,31 @@ public TableBuilderInfo field(String name, RelDataType 
type) {
           return this;
         }
     
    +    public TableBuilderInfo field(String name, SqlTypeName type, 
ColumnConstraint constraint) {
    +      interpretConstraint(constraint, fields.size());
    +      return field(name, typeFactory.createSqlType(type));
    +    }
    +
    +    public TableBuilderInfo field(String name, RelDataType type, 
ColumnConstraint constraint) {
    +      interpretConstraint(constraint, fields.size());
    +      fields.add(new FieldType(name, type));
    +      return this;
    +    }
    +
         public TableBuilderInfo field(String name, SqlDataTypeSpec type, 
ColumnConstraint constraint) {
           RelDataType dataType = type.deriveType(typeFactory);
    +      interpretConstraint(constraint, fields.size());
    +      fields.add(new FieldType(name, dataType));
    +      return this;
    +    }
    +
    +    private void interpretConstraint(ColumnConstraint constraint, int 
fieldIdx) {
           if (constraint instanceof ColumnConstraint.PrimaryKey) {
             ColumnConstraint.PrimaryKey pk = (ColumnConstraint.PrimaryKey) 
constraint;
             Preconditions.checkState(primaryKey == -1, "There are more than 
one primary key in the table");
    --- End diff --
    
    Nit: There are -> There is


---

Reply via email to