Examples of TrevniRuntimeException


Examples of org.apache.trevni.TrevniRuntimeException

        if (values[i] != null)
          values[i].startRow();
      this.column = 0;
      return (D)read(readSchema);
    } catch (IOException e) {
      throw new TrevniRuntimeException(e);
    }
  }
View Full Code Here

Examples of org.apache.trevni.TrevniRuntimeException

          column += arrayWidths[column];
        }
      }
      return value;
    default:
      throw new TrevniRuntimeException("Unknown schema: "+s);
    }
  }
View Full Code Here

Examples of org.apache.trevni.TrevniRuntimeException

      addColumn(path, simpleValueType(s), parent, isArray);
      return;
    }

    if (seen.containsKey(s))                      // catch recursion
      throw new TrevniRuntimeException("Cannot shred recursive schemas: "+s);
    seen.put(s, s);
   
    switch (s.getType()) {
    case MAP:
      path = path == null ? ">" : path+">";
      int start = columns.size();
      ColumnMetaData p = addColumn(path, ValueType.NULL, parent, true);
      addColumn(p(path,"key", ""), ValueType.STRING, p, false);
      columnize(p(path,"value", ""), s.getValueType(), p, false);
      arrayWidths.set(start, columns.size()-start); // fixup with actual width
      break;
    case RECORD:
      for (Field field : s.getFields())           // flatten fields to columns
        columnize(p(path, field.name(), "#"), field.schema(), parent, isArray);
      break;
    case ARRAY:
      path = path == null ? "[]" : path+"[]";
      addArrayColumn(path, s.getElementType(), parent);
      break;
    case UNION:
      for (Schema branch : s.getTypes())          // array per non-null branch
        if (branch.getType() != Schema.Type.NULL)
          addArrayColumn(p(path, branch, "/"), branch, parent);
      break;
    default:
      throw new TrevniRuntimeException("Unknown schema: "+s);
    }
    seen.remove(s);
  }
View Full Code Here

Examples of org.apache.trevni.TrevniRuntimeException

    case BYTES:  return ValueType.BYTES;
    case STRING: return ValueType.STRING;
    case ENUM:   return ValueType.INT;
    case FIXED:  return ValueType.BYTES;
    default:
      throw new TrevniRuntimeException("Unknown schema: "+s);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.