コード例 #1
0
 @Override
 protected String prettyPrint(int lpad) {
   String leftPadding = StringUtils.repeat(' ', lpad);
   ArrayList<String> fieldsSql = Lists.newArrayList();
   for (StructField f : fields_) fieldsSql.add(f.prettyPrint(lpad + 2));
   return String.format(
       "%sSTRUCT<\n%s\n%s>", leftPadding, Joiner.on(",\n").join(fieldsSql), leftPadding);
 }
コード例 #2
0
 @Override
 public void toThrift(TColumnType container) {
   TTypeNode node = new TTypeNode();
   container.types.add(node);
   Preconditions.checkNotNull(fields_);
   Preconditions.checkNotNull(!fields_.isEmpty());
   node.setType(TTypeNodeType.STRUCT);
   node.setStruct_fields(new ArrayList<TStructField>());
   for (StructField field : fields_) {
     field.toThrift(container, node);
   }
 }
コード例 #3
0
 public void addField(StructField field) {
   field.setPosition(fields_.size());
   fields_.add(field);
   fieldMap_.put(field.getName().toLowerCase(), field);
 }
コード例 #4
0
 @Override
 public String toSql() {
   ArrayList<String> fieldsSql = Lists.newArrayList();
   for (StructField f : fields_) fieldsSql.add(f.toSql());
   return String.format("STRUCT<%s>", Joiner.on(",").join(fieldsSql));
 }