当前位置: 首页>>代码示例>>Java>>正文


Java LobReaderCache.qualify方法代码示例

本文整理汇总了Java中com.cloudera.sqoop.io.LobReaderCache.qualify方法的典型用法代码示例。如果您正苦于以下问题:Java LobReaderCache.qualify方法的具体用法?Java LobReaderCache.qualify怎么用?Java LobReaderCache.qualify使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.cloudera.sqoop.io.LobReaderCache的用法示例。


在下文中一共展示了LobReaderCache.qualify方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDataStream

import com.cloudera.sqoop.io.LobReaderCache; //导入方法依赖的package包/类
/**
 * Get access to the LOB data itself.
 * This method returns a lazy reader of the LOB data, accessing the
 * filesystem for external LOB storage as necessary.
 * @param conf the Configuration used to access the filesystem
 * @param basePath the base directory where the table records are
 * stored.
 * @return an object that lazily streams the record to the client.
 * @throws IOException if it could not read the LOB from external storage.
 */
public ACCESSORTYPE getDataStream(Configuration conf, Path basePath)
    throws IOException {
  if (isExternal()) {
    // Read from external storage.
    Path pathToRead = LobReaderCache.qualify(
        new Path(basePath, fileName), conf);
    LOG.debug("Retreving data stream from external path: " + pathToRead);
    if (lobReader != null) {
      // We already have a reader open to a LobFile. Is it the correct file?
      if (!pathToRead.equals(lobReader.getPath())) {
        // No. Close this.lobReader and get the correct one.
        LOG.debug("Releasing previous external reader for "
            + lobReader.getPath());
        LobReaderCache.getCache().recycle(lobReader);
        lobReader = LobReaderCache.getCache().get(pathToRead, conf);
      }
    } else {
      lobReader = LobReaderCache.getCache().get(pathToRead, conf);
    }

    // We now have a LobFile.Reader associated with the correct file. Get to
    // the correct offset and return an InputStream/Reader to the user.
    if (lobReader.tell() != offset) {
      LOG.debug("Seeking to record start offset " + offset);
      lobReader.seek(offset);
    }

    if (!lobReader.next()) {
      throw new IOException("Could not locate record at " + pathToRead
          + ":" + offset);
    }

    return getExternalSource(lobReader);
  } else {
    // This data is already materialized in memory; wrap it and return.
    return getInternalSource(realData);
  }
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:49,代码来源:LobRef.java

示例2: V0Writer

import com.cloudera.sqoop.io.LobReaderCache; //导入方法依赖的package包/类
/**
 * Creates a LobFile Writer for file format version 0.
 * @param p the path to create.
 * @param conf the configuration to use to interact with the filesystem.
 * @param isCharData true if this is for CLOBs, false for BLOBs.
 * @param codecName the compression codec to use (or null for none).
 * @param entriesPerSegment the number of index entries per IndexSegment.
 */
V0Writer(Path p, Configuration conf, boolean isCharData,
    String codecName, int entriesPerSegment) throws IOException {

  this.path = LobReaderCache.qualify(p, conf);
  this.conf = conf;
  this.isCharData = isCharData;
  this.header = new LobFileHeader();
  this.indexSegments = new LinkedList<IndexSegment>();
  this.indexTable = new IndexTable();
  this.maxEntriesPerSegment = entriesPerSegment;

  this.codecName = codecName;
  if (this.codecName != null) {
    this.codec = CodecMap.getCodec(codecName, conf);
    if (null != this.codec) {
      this.compressor = codec.createCompressor();
    }
  }

  init();
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:30,代码来源:LobFile.java

示例3: V0Reader

import com.cloudera.sqoop.io.LobReaderCache; //导入方法依赖的package包/类
V0Reader(Path path, Configuration conf, LobFileHeader header,
    DataInputStream dis, FSDataInputStream stream, long fileLen)
    throws IOException {
  this.path = LobReaderCache.qualify(path, conf);
  this.conf = conf;
  this.header = header;
  this.dataIn = dis;
  this.underlyingInput = stream;
  this.isAligned = false;
  this.tmpRsmBuf = new byte[RecordStartMark.START_MARK_LENGTH];
  this.fileLen = fileLen;
  LOG.debug("Opening LobFile path: " + path);
  openCodec();
  openIndex();
}
 
开发者ID:aliyun,项目名称:aliyun-maxcompute-data-collectors,代码行数:16,代码来源:LobFile.java


注:本文中的com.cloudera.sqoop.io.LobReaderCache.qualify方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。