Example #1
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);
   }
 }
Example #2
0
 @Override
 public void toThrift(TColumnType container) {
   TTypeNode node = new TTypeNode();
   container.types.add(node);
   switch (type_) {
     case VARCHAR:
     case CHAR:
       {
         node.setType(TTypeNodeType.SCALAR);
         TScalarType scalarType = new TScalarType();
         scalarType.setType(type_.toThrift());
         scalarType.setLen(len_);
         node.setScalar_type(scalarType);
         break;
       }
     case DECIMAL:
       {
         node.setType(TTypeNodeType.SCALAR);
         TScalarType scalarType = new TScalarType();
         scalarType.setType(type_.toThrift());
         scalarType.setScale(scale_);
         scalarType.setPrecision(precision_);
         node.setScalar_type(scalarType);
         break;
       }
     default:
       {
         node.setType(TTypeNodeType.SCALAR);
         TScalarType scalarType = new TScalarType();
         scalarType.setType(type_.toThrift());
         node.setScalar_type(scalarType);
         break;
       }
   }
 }