congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
OrcReader.getFooter
Code IndexAdd Tabnine to your IDE (free)

How to use
getFooter
method
in
io.prestosql.orc.OrcReader

Best Java code snippets using io.prestosql.orc.OrcReader.getFooter (Showing top 8 results out of 315)

origin: prestosql/presto

private static Optional<OrcFileMetadata> getOrcFileMetadata(OrcReader reader)
{
  return Optional.ofNullable(reader.getFooter().getUserMetadata().get(OrcFileMetadata.KEY))
      .map(slice -> METADATA_CODEC.fromJson(slice.getBytes()));
}
origin: prestosql/presto

private List<ColumnInfo> getColumnInfo(OrcReader reader)
{
  Optional<OrcFileMetadata> metadata = getOrcFileMetadata(reader);
  if (metadata.isPresent()) {
    return getColumnInfoFromOrcUserMetadata(metadata.get());
  }
  // support for legacy files without metadata
  return getColumnInfoFromOrcColumnTypes(reader.getColumnNames(), reader.getFooter().getTypes());
}
origin: prestosql/presto

public void doIntegration(TestingOrcDataSource orcDataSource, DataSize maxMergeDistance, DataSize maxReadSize, DataSize tinyStripeThreshold)
    throws IOException
{
  OrcReader orcReader = new OrcReader(orcDataSource, ORC, maxMergeDistance, maxReadSize, tinyStripeThreshold, new DataSize(1, Unit.MEGABYTE));
  // 1 for reading file footer
  assertEquals(orcDataSource.getReadCount(), 1);
  List<StripeInformation> stripes = orcReader.getFooter().getStripes();
  // Sanity check number of stripes. This can be three or higher because of orc writer low memory mode.
  assertGreaterThanOrEqual(stripes.size(), 3);
  //verify wrapped by CachingOrcReader
  assertInstanceOf(wrapWithCacheIfTinyStripes(orcDataSource, stripes, maxMergeDistance, tinyStripeThreshold), CachingOrcDataSource.class);
  OrcRecordReader orcRecordReader = orcReader.createRecordReader(
      ImmutableMap.of(0, VARCHAR),
      (numberOfRows, statisticsByColumnIndex) -> true,
      HIVE_STORAGE_TIME_ZONE,
      newSimpleAggregatedMemoryContext(),
      INITIAL_BATCH_SIZE);
  int positionCount = 0;
  while (true) {
    int batchSize = orcRecordReader.nextBatch();
    if (batchSize <= 0) {
      break;
    }
    Block block = orcRecordReader.readBlock(VARCHAR, 0);
    positionCount += block.getPositionCount();
  }
  assertEquals(positionCount, POSITION_COUNT);
}
origin: io.prestosql/presto-orc

public void doIntegration(TestingOrcDataSource orcDataSource, DataSize maxMergeDistance, DataSize maxReadSize, DataSize tinyStripeThreshold)
    throws IOException
{
  OrcReader orcReader = new OrcReader(orcDataSource, ORC, maxMergeDistance, maxReadSize, tinyStripeThreshold, new DataSize(1, Unit.MEGABYTE));
  // 1 for reading file footer
  assertEquals(orcDataSource.getReadCount(), 1);
  List<StripeInformation> stripes = orcReader.getFooter().getStripes();
  // Sanity check number of stripes. This can be three or higher because of orc writer low memory mode.
  assertGreaterThanOrEqual(stripes.size(), 3);
  //verify wrapped by CachingOrcReader
  assertInstanceOf(wrapWithCacheIfTinyStripes(orcDataSource, stripes, maxMergeDistance, tinyStripeThreshold), CachingOrcDataSource.class);
  OrcRecordReader orcRecordReader = orcReader.createRecordReader(
      ImmutableMap.of(0, VARCHAR),
      (numberOfRows, statisticsByColumnIndex) -> true,
      HIVE_STORAGE_TIME_ZONE,
      newSimpleAggregatedMemoryContext(),
      INITIAL_BATCH_SIZE);
  int positionCount = 0;
  while (true) {
    int batchSize = orcRecordReader.nextBatch();
    if (batchSize <= 0) {
      break;
    }
    Block block = orcRecordReader.readBlock(VARCHAR, 0);
    positionCount += block.getPositionCount();
  }
  assertEquals(positionCount, POSITION_COUNT);
}
origin: io.prestosql/presto-orc

@Test
public void testReadUserMetadata()
    throws Exception
{
  try (TempFile tempFile = new TempFile()) {
    Map<String, String> metadata = ImmutableMap.of(
        "a", "ala",
        "b", "ma",
        "c", "kota");
    createFileWithOnlyUserMetadata(tempFile.getFile(), metadata);
    OrcDataSource orcDataSource = new FileOrcDataSource(tempFile.getFile(), new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE), true);
    OrcReader orcReader = new OrcReader(orcDataSource, ORC, new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE));
    Footer footer = orcReader.getFooter();
    Map<String, String> readMetadata = Maps.transformValues(footer.getUserMetadata(), Slice::toStringAscii);
    assertEquals(readMetadata, metadata);
  }
}
origin: prestosql/presto

@Test
public void testReadUserMetadata()
    throws Exception
{
  try (TempFile tempFile = new TempFile()) {
    Map<String, String> metadata = ImmutableMap.of(
        "a", "ala",
        "b", "ma",
        "c", "kota");
    createFileWithOnlyUserMetadata(tempFile.getFile(), metadata);
    OrcDataSource orcDataSource = new FileOrcDataSource(tempFile.getFile(), new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE), true);
    OrcReader orcReader = new OrcReader(orcDataSource, ORC, new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE), new DataSize(1, MEGABYTE));
    Footer footer = orcReader.getFooter();
    Map<String, String> readMetadata = Maps.transformValues(footer.getUserMetadata(), Slice::toStringAscii);
    assertEquals(readMetadata, metadata);
  }
}
origin: io.prestosql/presto-orc

Footer footer = new OrcReader(orcDataSource, ORC, dataSize, dataSize, dataSize, dataSize).getFooter();
origin: prestosql/presto

Footer footer = new OrcReader(orcDataSource, ORC, dataSize, dataSize, dataSize, dataSize).getFooter();
io.prestosql.orcOrcReadergetFooter

Popular methods of OrcReader

  • <init>
  • createRecordReader
  • getColumnNames
  • checkOrcVersion
    Check to see if this ORC file is from a future version and if so, warn the user that we may not be a
  • isValidHeaderMagic
    Does the file start with the ORC magic bytes?
  • validateFile
  • validateWrite
  • wrapWithCacheIfTiny

Popular in Java

  • Reactive rest calls using spring rest template
  • compareTo (BigDecimal)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getResourceAsStream (ClassLoader)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • Menu (java.awt)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now