Package org.apache.hadoop.zebra.tfile.Utils

Examples of org.apache.hadoop.zebra.tfile.Utils.Version


      if (!path.getFileSystem(conf).exists(pathSchema)) {
        throw new IOException("BT Schema file doesn't exist: " + pathSchema);
      }
      // read schema file
      FSDataInputStream in = path.getFileSystem(conf).open(pathSchema);
      version = new Version(in);
      // verify compatibility against SCHEMA_VERSION
      if (!version.compatibleWith(SCHEMA_VERSION)) {
        new IOException("Incompatible versions, expecting: " + SCHEMA_VERSION
            + "; found in file: " + version);
      }
      comparator = WritableUtils.readString(in);
      String logicalStr = WritableUtils.readString(in);
      try {
        logical = new Schema(logicalStr);
      }
      catch (Exception e) {
        ;
        throw new IOException("Schema build failed :" + e.getMessage());
      }
      storage = WritableUtils.readString(in);
      try {
        partition = new Partition(logicalStr, storage, comparator);
      }
      catch (Exception e) {
        throw new IOException("Partition constructor failed :" + e.getMessage());
      }
      cgschemas = partition.getCGSchemas();
      int numCGs = WritableUtils.readVInt(in);
      physical = new Schema[numCGs];
      cgDeletedFlags = new boolean[physical.length];
      TableSchemaParser parser;
      String cgschemastr;
      try {
        for (int nx = 0; nx < numCGs; nx++) {
          cgschemastr = WritableUtils.readString(in);
          parser = new TableSchemaParser(new StringReader(cgschemastr));
          physical[nx] = parser.RecordSchema(null);
        }
      }
      catch (Exception e) {
        throw new IOException("parser.RecordSchema failed :" + e.getMessage());
      }
      sorted = WritableUtils.readVInt(in) == 1 ? true : false;
      if (deletedCGs == null)
        setCGDeletedFlags(path, conf);
      else {
        for (String deletedCG : deletedCGs)
        {
          for (int i = 0; i < cgschemas.length; i++)
          {
            if (cgschemas[i].getName().equals(deletedCG))
              cgDeletedFlags[i] = true;
          }
        }
      }
      if (version.compareTo(new Version((short)1, (short)0)) > 0)
      {
        int numSortColumns = WritableUtils.readVInt(in);
        if (numSortColumns > 0)
        {
          String[] sortColumnStr = new String[numSortColumns];
View Full Code Here


      if (!path.getFileSystem(conf).exists(pathSchema)) {
        throw new IOException("BT Schema file doesn't exist: " + pathSchema);
      }
      // read schema file
      FSDataInputStream in = path.getFileSystem(conf).open(pathSchema);
      Version version = new Version(in);
      // verify compatibility against SCHEMA_VERSION
      if (!version.compatibleWith(SCHEMA_VERSION)) {
        new IOException("Incompatible versions, expecting: " + SCHEMA_VERSION
            + "; found in file: " + version);
      }
     
      // read comparator
View Full Code Here

      this.comparator = makeComparator(strComparator);
    }

    // ctor for reads
    public TFileMeta(DataInput in) throws IOException {
      version = new Version(in);
      if (!version.compatibleWith(TFile.API_VERSION)) {
        throw new RuntimeException("Incompatible TFile fileVersion.");
      }
      recordCount = Utils.readVLong(in);
      strComparator = Utils.readString(in);
View Full Code Here

      this.comparator = makeComparator(strComparator);
    }

    // ctor for reads
    public TFileMeta(DataInput in) throws IOException {
      version = new Version(in);
      if (!version.compatibleWith(TFile.API_VERSION)) {
        throw new RuntimeException("Incompatible TFile fileVersion.");
      }
      recordCount = Utils.readVLong(in);
      strComparator = Utils.readString(in);
View Full Code Here

     outSchema.close();
   }

public  void read(FileSystem fs, Path parent) throws IOException, ParseException {
     FSDataInputStream in = fs.open(makeFilePath(parent));
     version = new Version(in);
     // verify compatibility against SCHEMA_VERSION
     if (!version.compatibleWith(SCHEMA_VERSION)) {
       new IOException("Incompatible versions, expecting: " + SCHEMA_VERSION
            + "; found in file: " + version);
     }    
View Full Code Here

      // move the cursor to the beginning of the tail, containing: offset to the
      // meta block index, version and magic
      fin.seek(fileLength - Magic.size() - Version.size() - Long.SIZE
          / Byte.SIZE);
      long offsetIndexMeta = fin.readLong();
      version = new Version(fin);
      Magic.readAndVerify(fin);

      if (!version.compatibleWith(BCFile.API_VERSION)) {
        throw new RuntimeException("Incompatible BCFile fileBCFileVersion.");
      }
View Full Code Here

      if (!path.getFileSystem(conf).exists(pathSchema)) {
        throw new IOException("BT Schema file doesn't exist: " + pathSchema);
      }
      // read schema file
      FSDataInputStream in = path.getFileSystem(conf).open(pathSchema);
      version = new Version(in);
      // verify compatibility against SCHEMA_VERSION
      if (!version.compatibleWith(SCHEMA_VERSION)) {
        new IOException("Incompatible versions, expecting: " + SCHEMA_VERSION
            + "; found in file: " + version);
      }
      comparator = WritableUtils.readString(in);
      String logicalStr = WritableUtils.readString(in);
      try {
        logical = new Schema(logicalStr);
      }
      catch (Exception e) {
        ;
        throw new IOException("Schema build failed :" + e.getMessage());
      }
      storage = WritableUtils.readString(in);
      try {
        partition = new Partition(logicalStr, storage, comparator);
      }
      catch (Exception e) {
        throw new IOException("Partition constructor failed :" + e.getMessage());
      }
      cgschemas = partition.getCGSchemas();
      int numCGs = WritableUtils.readVInt(in);
      physical = new Schema[numCGs];
      cgDeletedFlags = new boolean[physical.length];
      TableSchemaParser parser;
      String cgschemastr;
      try {
        for (int nx = 0; nx < numCGs; nx++) {
          cgschemastr = WritableUtils.readString(in);
          parser = new TableSchemaParser(new StringReader(cgschemastr));
          physical[nx] = parser.RecordSchema(null);
        }
      }
      catch (Exception e) {
        throw new IOException("parser.RecordSchema failed :" + e.getMessage());
      }
      sorted = WritableUtils.readVInt(in) == 1 ? true : false;
      if (deletedCGs == null)
        setCGDeletedFlags(path, conf);
      else {
        for (String deletedCG : deletedCGs)
        {
          for (int i = 0; i < cgschemas.length; i++)
          {
            if (cgschemas[i].getName().equals(deletedCG))
              cgDeletedFlags[i] = true;
          }
        }
      }
      if (version.compareTo(new Version((short)1, (short)0)) > 0)
      {
        int numSortColumns = WritableUtils.readVInt(in);
        if (numSortColumns > 0)
        {
          String[] sortColumnStr = new String[numSortColumns];
View Full Code Here

      if (!path.getFileSystem(conf).exists(pathSchema)) {
        throw new IOException("BT Schema file doesn't exist: " + pathSchema);
      }
      // read schema file
      FSDataInputStream in = path.getFileSystem(conf).open(pathSchema);
      Version version = new Version(in);
      // verify compatibility against SCHEMA_VERSION
      if (!version.compatibleWith(SCHEMA_VERSION)) {
        new IOException("Incompatible versions, expecting: " + SCHEMA_VERSION
            + "; found in file: " + version);
      }
     
      // read comparator
View Full Code Here

     outSchema.close();
   }

public  void read(FileSystem fs, Path parent) throws IOException, ParseException {
     FSDataInputStream in = fs.open(makeFilePath(parent));
    version = new Version(in);
     // verify compatibility against SCHEMA_VERSION
     if (!version.compatibleWith(SCHEMA_VERSION)) {
       new IOException("Incompatible versions, expecting: " + SCHEMA_VERSION
            + "; found in file: " + version);
     }    
View Full Code Here

      if (!path.getFileSystem(conf).exists(pathSchema)) {
        throw new IOException("BT Schema file doesn't exist: " + pathSchema);
      }
      // read schema file
      FSDataInputStream in = path.getFileSystem(conf).open(pathSchema);
      version = new Version(in);
      // verify compatibility against SCHEMA_VERSION
      if (!version.compatibleWith(SCHEMA_VERSION)) {
        new IOException("Incompatible versions, expecting: " + SCHEMA_VERSION
            + "; found in file: " + version);
      }
      comparator = WritableUtils.readString(in);
      String logicalStr = WritableUtils.readString(in);
      try {
        logical = new Schema(logicalStr);
      }
      catch (Exception e) {
        ;
        throw new IOException("Schema build failed :" + e.getMessage());
      }
      storage = WritableUtils.readString(in);
      try {
        partition = new Partition(logicalStr, storage, comparator);
      }
      catch (Exception e) {
        throw new IOException("Partition constructor failed :" + e.getMessage());
      }
      cgschemas = partition.getCGSchemas();
      int numCGs = WritableUtils.readVInt(in);
      physical = new Schema[numCGs];
      cgDeletedFlags = new boolean[physical.length];
      TableSchemaParser parser;
      String cgschemastr;
     
      try {
        for (int nx = 0; nx < numCGs; nx++) {
          cgschemastr = WritableUtils.readString(in);
          parser = new TableSchemaParser(new StringReader(cgschemastr));
          physical[nx] = parser.RecordSchema(null);
        }
      }
      catch (Exception e) {
        throw new IOException("parser.RecordSchema failed :" + e.getMessage());
      }
     
      sorted = WritableUtils.readVInt(in) == 1 ? true : false;
      if (deletedCGs == null)
        setCGDeletedFlags(path, conf);
      else {
        for (String deletedCG : deletedCGs)
        {
          for (int i = 0; i < cgschemas.length; i++)
          {
            if (cgschemas[i].getName().equals(deletedCG))
              cgDeletedFlags[i] = true;
          }
        }
      }
     
      if (version.compareTo(new Version((short)1, (short)0)) > 0)
      {
        int numSortColumns = WritableUtils.readVInt(in);
        if (numSortColumns > 0)
        {
          String[] sortColumnStr = new String[numSortColumns];
View Full Code Here

TOP

Related Classes of org.apache.hadoop.zebra.tfile.Utils.Version

Copyright © 2018 www.massapicom. 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.