{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Firehose.Types.OrcSerDe
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Firehose.Types.OrcSerDe where

import qualified Amazonka.Core as Core
import Amazonka.Firehose.Types.OrcCompression
import Amazonka.Firehose.Types.OrcFormatVersion
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | A serializer to use for converting data to the ORC format before storing
-- it in Amazon S3. For more information, see
-- <https://orc.apache.org/docs/ Apache ORC>.
--
-- /See:/ 'newOrcSerDe' smart constructor.
data OrcSerDe = OrcSerDe'
  { -- | The Bloom filter false positive probability (FPP). The lower the FPP,
    -- the bigger the Bloom filter. The default value is 0.05, the minimum is
    -- 0, and the maximum is 1.
    OrcSerDe -> Maybe Double
bloomFilterFalsePositiveProbability :: Prelude.Maybe Prelude.Double,
    -- | Represents the fraction of the total number of non-null rows. To turn
    -- off dictionary encoding, set this fraction to a number that is less than
    -- the number of distinct keys in a dictionary. To always use dictionary
    -- encoding, set this threshold to 1.
    OrcSerDe -> Maybe Double
dictionaryKeyThreshold :: Prelude.Maybe Prelude.Double,
    -- | Set this to @true@ to indicate that you want stripes to be padded to the
    -- HDFS block boundaries. This is useful if you intend to copy the data
    -- from Amazon S3 to HDFS before querying. The default is @false@.
    OrcSerDe -> Maybe Bool
enablePadding :: Prelude.Maybe Prelude.Bool,
    -- | The compression code to use over data blocks. The default is @SNAPPY@.
    OrcSerDe -> Maybe OrcCompression
compression :: Prelude.Maybe OrcCompression,
    -- | The column names for which you want Kinesis Data Firehose to create
    -- bloom filters. The default is @null@.
    OrcSerDe -> Maybe [Text]
bloomFilterColumns :: Prelude.Maybe [Prelude.Text],
    -- | The number of rows between index entries. The default is 10,000 and the
    -- minimum is 1,000.
    OrcSerDe -> Maybe Natural
rowIndexStride :: Prelude.Maybe Prelude.Natural,
    -- | The version of the file to write. The possible values are @V0_11@ and
    -- @V0_12@. The default is @V0_12@.
    OrcSerDe -> Maybe OrcFormatVersion
formatVersion :: Prelude.Maybe OrcFormatVersion,
    -- | The Hadoop Distributed File System (HDFS) block size. This is useful if
    -- you intend to copy the data from Amazon S3 to HDFS before querying. The
    -- default is 256 MiB and the minimum is 64 MiB. Kinesis Data Firehose uses
    -- this value for padding calculations.
    OrcSerDe -> Maybe Natural
blockSizeBytes :: Prelude.Maybe Prelude.Natural,
    -- | The number of bytes in each stripe. The default is 64 MiB and the
    -- minimum is 8 MiB.
    OrcSerDe -> Maybe Natural
stripeSizeBytes :: Prelude.Maybe Prelude.Natural,
    -- | A number between 0 and 1 that defines the tolerance for block padding as
    -- a decimal fraction of stripe size. The default value is 0.05, which
    -- means 5 percent of stripe size.
    --
    -- For the default values of 64 MiB ORC stripes and 256 MiB HDFS blocks,
    -- the default block padding tolerance of 5 percent reserves a maximum of
    -- 3.2 MiB for padding within the 256 MiB block. In such a case, if the
    -- available size within the block is more than 3.2 MiB, a new, smaller
    -- stripe is inserted to fit within that space. This ensures that no stripe
    -- crosses block boundaries and causes remote reads within a node-local
    -- task.
    --
    -- Kinesis Data Firehose ignores this parameter when OrcSerDe$EnablePadding
    -- is @false@.
    OrcSerDe -> Maybe Double
paddingTolerance :: Prelude.Maybe Prelude.Double
  }
  deriving (OrcSerDe -> OrcSerDe -> Bool
(OrcSerDe -> OrcSerDe -> Bool)
-> (OrcSerDe -> OrcSerDe -> Bool) -> Eq OrcSerDe
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OrcSerDe -> OrcSerDe -> Bool
$c/= :: OrcSerDe -> OrcSerDe -> Bool
== :: OrcSerDe -> OrcSerDe -> Bool
$c== :: OrcSerDe -> OrcSerDe -> Bool
Prelude.Eq, ReadPrec [OrcSerDe]
ReadPrec OrcSerDe
Int -> ReadS OrcSerDe
ReadS [OrcSerDe]
(Int -> ReadS OrcSerDe)
-> ReadS [OrcSerDe]
-> ReadPrec OrcSerDe
-> ReadPrec [OrcSerDe]
-> Read OrcSerDe
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OrcSerDe]
$creadListPrec :: ReadPrec [OrcSerDe]
readPrec :: ReadPrec OrcSerDe
$creadPrec :: ReadPrec OrcSerDe
readList :: ReadS [OrcSerDe]
$creadList :: ReadS [OrcSerDe]
readsPrec :: Int -> ReadS OrcSerDe
$creadsPrec :: Int -> ReadS OrcSerDe
Prelude.Read, Int -> OrcSerDe -> ShowS
[OrcSerDe] -> ShowS
OrcSerDe -> String
(Int -> OrcSerDe -> ShowS)
-> (OrcSerDe -> String) -> ([OrcSerDe] -> ShowS) -> Show OrcSerDe
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OrcSerDe] -> ShowS
$cshowList :: [OrcSerDe] -> ShowS
show :: OrcSerDe -> String
$cshow :: OrcSerDe -> String
showsPrec :: Int -> OrcSerDe -> ShowS
$cshowsPrec :: Int -> OrcSerDe -> ShowS
Prelude.Show, (forall x. OrcSerDe -> Rep OrcSerDe x)
-> (forall x. Rep OrcSerDe x -> OrcSerDe) -> Generic OrcSerDe
forall x. Rep OrcSerDe x -> OrcSerDe
forall x. OrcSerDe -> Rep OrcSerDe x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OrcSerDe x -> OrcSerDe
$cfrom :: forall x. OrcSerDe -> Rep OrcSerDe x
Prelude.Generic)

-- |
-- Create a value of 'OrcSerDe' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'bloomFilterFalsePositiveProbability', 'orcSerDe_bloomFilterFalsePositiveProbability' - The Bloom filter false positive probability (FPP). The lower the FPP,
-- the bigger the Bloom filter. The default value is 0.05, the minimum is
-- 0, and the maximum is 1.
--
-- 'dictionaryKeyThreshold', 'orcSerDe_dictionaryKeyThreshold' - Represents the fraction of the total number of non-null rows. To turn
-- off dictionary encoding, set this fraction to a number that is less than
-- the number of distinct keys in a dictionary. To always use dictionary
-- encoding, set this threshold to 1.
--
-- 'enablePadding', 'orcSerDe_enablePadding' - Set this to @true@ to indicate that you want stripes to be padded to the
-- HDFS block boundaries. This is useful if you intend to copy the data
-- from Amazon S3 to HDFS before querying. The default is @false@.
--
-- 'compression', 'orcSerDe_compression' - The compression code to use over data blocks. The default is @SNAPPY@.
--
-- 'bloomFilterColumns', 'orcSerDe_bloomFilterColumns' - The column names for which you want Kinesis Data Firehose to create
-- bloom filters. The default is @null@.
--
-- 'rowIndexStride', 'orcSerDe_rowIndexStride' - The number of rows between index entries. The default is 10,000 and the
-- minimum is 1,000.
--
-- 'formatVersion', 'orcSerDe_formatVersion' - The version of the file to write. The possible values are @V0_11@ and
-- @V0_12@. The default is @V0_12@.
--
-- 'blockSizeBytes', 'orcSerDe_blockSizeBytes' - The Hadoop Distributed File System (HDFS) block size. This is useful if
-- you intend to copy the data from Amazon S3 to HDFS before querying. The
-- default is 256 MiB and the minimum is 64 MiB. Kinesis Data Firehose uses
-- this value for padding calculations.
--
-- 'stripeSizeBytes', 'orcSerDe_stripeSizeBytes' - The number of bytes in each stripe. The default is 64 MiB and the
-- minimum is 8 MiB.
--
-- 'paddingTolerance', 'orcSerDe_paddingTolerance' - A number between 0 and 1 that defines the tolerance for block padding as
-- a decimal fraction of stripe size. The default value is 0.05, which
-- means 5 percent of stripe size.
--
-- For the default values of 64 MiB ORC stripes and 256 MiB HDFS blocks,
-- the default block padding tolerance of 5 percent reserves a maximum of
-- 3.2 MiB for padding within the 256 MiB block. In such a case, if the
-- available size within the block is more than 3.2 MiB, a new, smaller
-- stripe is inserted to fit within that space. This ensures that no stripe
-- crosses block boundaries and causes remote reads within a node-local
-- task.
--
-- Kinesis Data Firehose ignores this parameter when OrcSerDe$EnablePadding
-- is @false@.
newOrcSerDe ::
  OrcSerDe
newOrcSerDe :: OrcSerDe
newOrcSerDe =
  OrcSerDe' :: Maybe Double
-> Maybe Double
-> Maybe Bool
-> Maybe OrcCompression
-> Maybe [Text]
-> Maybe Natural
-> Maybe OrcFormatVersion
-> Maybe Natural
-> Maybe Natural
-> Maybe Double
-> OrcSerDe
OrcSerDe'
    { $sel:bloomFilterFalsePositiveProbability:OrcSerDe' :: Maybe Double
bloomFilterFalsePositiveProbability =
        Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:dictionaryKeyThreshold:OrcSerDe' :: Maybe Double
dictionaryKeyThreshold = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:enablePadding:OrcSerDe' :: Maybe Bool
enablePadding = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:compression:OrcSerDe' :: Maybe OrcCompression
compression = Maybe OrcCompression
forall a. Maybe a
Prelude.Nothing,
      $sel:bloomFilterColumns:OrcSerDe' :: Maybe [Text]
bloomFilterColumns = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:rowIndexStride:OrcSerDe' :: Maybe Natural
rowIndexStride = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:formatVersion:OrcSerDe' :: Maybe OrcFormatVersion
formatVersion = Maybe OrcFormatVersion
forall a. Maybe a
Prelude.Nothing,
      $sel:blockSizeBytes:OrcSerDe' :: Maybe Natural
blockSizeBytes = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:stripeSizeBytes:OrcSerDe' :: Maybe Natural
stripeSizeBytes = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:paddingTolerance:OrcSerDe' :: Maybe Double
paddingTolerance = Maybe Double
forall a. Maybe a
Prelude.Nothing
    }

-- | The Bloom filter false positive probability (FPP). The lower the FPP,
-- the bigger the Bloom filter. The default value is 0.05, the minimum is
-- 0, and the maximum is 1.
orcSerDe_bloomFilterFalsePositiveProbability :: Lens.Lens' OrcSerDe (Prelude.Maybe Prelude.Double)
orcSerDe_bloomFilterFalsePositiveProbability :: (Maybe Double -> f (Maybe Double)) -> OrcSerDe -> f OrcSerDe
orcSerDe_bloomFilterFalsePositiveProbability = (OrcSerDe -> Maybe Double)
-> (OrcSerDe -> Maybe Double -> OrcSerDe)
-> Lens OrcSerDe OrcSerDe (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrcSerDe' {Maybe Double
bloomFilterFalsePositiveProbability :: Maybe Double
$sel:bloomFilterFalsePositiveProbability:OrcSerDe' :: OrcSerDe -> Maybe Double
bloomFilterFalsePositiveProbability} -> Maybe Double
bloomFilterFalsePositiveProbability) (\s :: OrcSerDe
s@OrcSerDe' {} Maybe Double
a -> OrcSerDe
s {$sel:bloomFilterFalsePositiveProbability:OrcSerDe' :: Maybe Double
bloomFilterFalsePositiveProbability = Maybe Double
a} :: OrcSerDe)

-- | Represents the fraction of the total number of non-null rows. To turn
-- off dictionary encoding, set this fraction to a number that is less than
-- the number of distinct keys in a dictionary. To always use dictionary
-- encoding, set this threshold to 1.
orcSerDe_dictionaryKeyThreshold :: Lens.Lens' OrcSerDe (Prelude.Maybe Prelude.Double)
orcSerDe_dictionaryKeyThreshold :: (Maybe Double -> f (Maybe Double)) -> OrcSerDe -> f OrcSerDe
orcSerDe_dictionaryKeyThreshold = (OrcSerDe -> Maybe Double)
-> (OrcSerDe -> Maybe Double -> OrcSerDe)
-> Lens OrcSerDe OrcSerDe (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrcSerDe' {Maybe Double
dictionaryKeyThreshold :: Maybe Double
$sel:dictionaryKeyThreshold:OrcSerDe' :: OrcSerDe -> Maybe Double
dictionaryKeyThreshold} -> Maybe Double
dictionaryKeyThreshold) (\s :: OrcSerDe
s@OrcSerDe' {} Maybe Double
a -> OrcSerDe
s {$sel:dictionaryKeyThreshold:OrcSerDe' :: Maybe Double
dictionaryKeyThreshold = Maybe Double
a} :: OrcSerDe)

-- | Set this to @true@ to indicate that you want stripes to be padded to the
-- HDFS block boundaries. This is useful if you intend to copy the data
-- from Amazon S3 to HDFS before querying. The default is @false@.
orcSerDe_enablePadding :: Lens.Lens' OrcSerDe (Prelude.Maybe Prelude.Bool)
orcSerDe_enablePadding :: (Maybe Bool -> f (Maybe Bool)) -> OrcSerDe -> f OrcSerDe
orcSerDe_enablePadding = (OrcSerDe -> Maybe Bool)
-> (OrcSerDe -> Maybe Bool -> OrcSerDe)
-> Lens OrcSerDe OrcSerDe (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrcSerDe' {Maybe Bool
enablePadding :: Maybe Bool
$sel:enablePadding:OrcSerDe' :: OrcSerDe -> Maybe Bool
enablePadding} -> Maybe Bool
enablePadding) (\s :: OrcSerDe
s@OrcSerDe' {} Maybe Bool
a -> OrcSerDe
s {$sel:enablePadding:OrcSerDe' :: Maybe Bool
enablePadding = Maybe Bool
a} :: OrcSerDe)

-- | The compression code to use over data blocks. The default is @SNAPPY@.
orcSerDe_compression :: Lens.Lens' OrcSerDe (Prelude.Maybe OrcCompression)
orcSerDe_compression :: (Maybe OrcCompression -> f (Maybe OrcCompression))
-> OrcSerDe -> f OrcSerDe
orcSerDe_compression = (OrcSerDe -> Maybe OrcCompression)
-> (OrcSerDe -> Maybe OrcCompression -> OrcSerDe)
-> Lens
     OrcSerDe OrcSerDe (Maybe OrcCompression) (Maybe OrcCompression)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrcSerDe' {Maybe OrcCompression
compression :: Maybe OrcCompression
$sel:compression:OrcSerDe' :: OrcSerDe -> Maybe OrcCompression
compression} -> Maybe OrcCompression
compression) (\s :: OrcSerDe
s@OrcSerDe' {} Maybe OrcCompression
a -> OrcSerDe
s {$sel:compression:OrcSerDe' :: Maybe OrcCompression
compression = Maybe OrcCompression
a} :: OrcSerDe)

-- | The column names for which you want Kinesis Data Firehose to create
-- bloom filters. The default is @null@.
orcSerDe_bloomFilterColumns :: Lens.Lens' OrcSerDe (Prelude.Maybe [Prelude.Text])
orcSerDe_bloomFilterColumns :: (Maybe [Text] -> f (Maybe [Text])) -> OrcSerDe -> f OrcSerDe
orcSerDe_bloomFilterColumns = (OrcSerDe -> Maybe [Text])
-> (OrcSerDe -> Maybe [Text] -> OrcSerDe)
-> Lens OrcSerDe OrcSerDe (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrcSerDe' {Maybe [Text]
bloomFilterColumns :: Maybe [Text]
$sel:bloomFilterColumns:OrcSerDe' :: OrcSerDe -> Maybe [Text]
bloomFilterColumns} -> Maybe [Text]
bloomFilterColumns) (\s :: OrcSerDe
s@OrcSerDe' {} Maybe [Text]
a -> OrcSerDe
s {$sel:bloomFilterColumns:OrcSerDe' :: Maybe [Text]
bloomFilterColumns = Maybe [Text]
a} :: OrcSerDe) ((Maybe [Text] -> f (Maybe [Text])) -> OrcSerDe -> f OrcSerDe)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> OrcSerDe
-> f OrcSerDe
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The number of rows between index entries. The default is 10,000 and the
-- minimum is 1,000.
orcSerDe_rowIndexStride :: Lens.Lens' OrcSerDe (Prelude.Maybe Prelude.Natural)
orcSerDe_rowIndexStride :: (Maybe Natural -> f (Maybe Natural)) -> OrcSerDe -> f OrcSerDe
orcSerDe_rowIndexStride = (OrcSerDe -> Maybe Natural)
-> (OrcSerDe -> Maybe Natural -> OrcSerDe)
-> Lens OrcSerDe OrcSerDe (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrcSerDe' {Maybe Natural
rowIndexStride :: Maybe Natural
$sel:rowIndexStride:OrcSerDe' :: OrcSerDe -> Maybe Natural
rowIndexStride} -> Maybe Natural
rowIndexStride) (\s :: OrcSerDe
s@OrcSerDe' {} Maybe Natural
a -> OrcSerDe
s {$sel:rowIndexStride:OrcSerDe' :: Maybe Natural
rowIndexStride = Maybe Natural
a} :: OrcSerDe)

-- | The version of the file to write. The possible values are @V0_11@ and
-- @V0_12@. The default is @V0_12@.
orcSerDe_formatVersion :: Lens.Lens' OrcSerDe (Prelude.Maybe OrcFormatVersion)
orcSerDe_formatVersion :: (Maybe OrcFormatVersion -> f (Maybe OrcFormatVersion))
-> OrcSerDe -> f OrcSerDe
orcSerDe_formatVersion = (OrcSerDe -> Maybe OrcFormatVersion)
-> (OrcSerDe -> Maybe OrcFormatVersion -> OrcSerDe)
-> Lens
     OrcSerDe OrcSerDe (Maybe OrcFormatVersion) (Maybe OrcFormatVersion)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrcSerDe' {Maybe OrcFormatVersion
formatVersion :: Maybe OrcFormatVersion
$sel:formatVersion:OrcSerDe' :: OrcSerDe -> Maybe OrcFormatVersion
formatVersion} -> Maybe OrcFormatVersion
formatVersion) (\s :: OrcSerDe
s@OrcSerDe' {} Maybe OrcFormatVersion
a -> OrcSerDe
s {$sel:formatVersion:OrcSerDe' :: Maybe OrcFormatVersion
formatVersion = Maybe OrcFormatVersion
a} :: OrcSerDe)

-- | The Hadoop Distributed File System (HDFS) block size. This is useful if
-- you intend to copy the data from Amazon S3 to HDFS before querying. The
-- default is 256 MiB and the minimum is 64 MiB. Kinesis Data Firehose uses
-- this value for padding calculations.
orcSerDe_blockSizeBytes :: Lens.Lens' OrcSerDe (Prelude.Maybe Prelude.Natural)
orcSerDe_blockSizeBytes :: (Maybe Natural -> f (Maybe Natural)) -> OrcSerDe -> f OrcSerDe
orcSerDe_blockSizeBytes = (OrcSerDe -> Maybe Natural)
-> (OrcSerDe -> Maybe Natural -> OrcSerDe)
-> Lens OrcSerDe OrcSerDe (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrcSerDe' {Maybe Natural
blockSizeBytes :: Maybe Natural
$sel:blockSizeBytes:OrcSerDe' :: OrcSerDe -> Maybe Natural
blockSizeBytes} -> Maybe Natural
blockSizeBytes) (\s :: OrcSerDe
s@OrcSerDe' {} Maybe Natural
a -> OrcSerDe
s {$sel:blockSizeBytes:OrcSerDe' :: Maybe Natural
blockSizeBytes = Maybe Natural
a} :: OrcSerDe)

-- | The number of bytes in each stripe. The default is 64 MiB and the
-- minimum is 8 MiB.
orcSerDe_stripeSizeBytes :: Lens.Lens' OrcSerDe (Prelude.Maybe Prelude.Natural)
orcSerDe_stripeSizeBytes :: (Maybe Natural -> f (Maybe Natural)) -> OrcSerDe -> f OrcSerDe
orcSerDe_stripeSizeBytes = (OrcSerDe -> Maybe Natural)
-> (OrcSerDe -> Maybe Natural -> OrcSerDe)
-> Lens OrcSerDe OrcSerDe (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrcSerDe' {Maybe Natural
stripeSizeBytes :: Maybe Natural
$sel:stripeSizeBytes:OrcSerDe' :: OrcSerDe -> Maybe Natural
stripeSizeBytes} -> Maybe Natural
stripeSizeBytes) (\s :: OrcSerDe
s@OrcSerDe' {} Maybe Natural
a -> OrcSerDe
s {$sel:stripeSizeBytes:OrcSerDe' :: Maybe Natural
stripeSizeBytes = Maybe Natural
a} :: OrcSerDe)

-- | A number between 0 and 1 that defines the tolerance for block padding as
-- a decimal fraction of stripe size. The default value is 0.05, which
-- means 5 percent of stripe size.
--
-- For the default values of 64 MiB ORC stripes and 256 MiB HDFS blocks,
-- the default block padding tolerance of 5 percent reserves a maximum of
-- 3.2 MiB for padding within the 256 MiB block. In such a case, if the
-- available size within the block is more than 3.2 MiB, a new, smaller
-- stripe is inserted to fit within that space. This ensures that no stripe
-- crosses block boundaries and causes remote reads within a node-local
-- task.
--
-- Kinesis Data Firehose ignores this parameter when OrcSerDe$EnablePadding
-- is @false@.
orcSerDe_paddingTolerance :: Lens.Lens' OrcSerDe (Prelude.Maybe Prelude.Double)
orcSerDe_paddingTolerance :: (Maybe Double -> f (Maybe Double)) -> OrcSerDe -> f OrcSerDe
orcSerDe_paddingTolerance = (OrcSerDe -> Maybe Double)
-> (OrcSerDe -> Maybe Double -> OrcSerDe)
-> Lens OrcSerDe OrcSerDe (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrcSerDe' {Maybe Double
paddingTolerance :: Maybe Double
$sel:paddingTolerance:OrcSerDe' :: OrcSerDe -> Maybe Double
paddingTolerance} -> Maybe Double
paddingTolerance) (\s :: OrcSerDe
s@OrcSerDe' {} Maybe Double
a -> OrcSerDe
s {$sel:paddingTolerance:OrcSerDe' :: Maybe Double
paddingTolerance = Maybe Double
a} :: OrcSerDe)

instance Core.FromJSON OrcSerDe where
  parseJSON :: Value -> Parser OrcSerDe
parseJSON =
    String -> (Object -> Parser OrcSerDe) -> Value -> Parser OrcSerDe
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OrcSerDe"
      ( \Object
x ->
          Maybe Double
-> Maybe Double
-> Maybe Bool
-> Maybe OrcCompression
-> Maybe [Text]
-> Maybe Natural
-> Maybe OrcFormatVersion
-> Maybe Natural
-> Maybe Natural
-> Maybe Double
-> OrcSerDe
OrcSerDe'
            (Maybe Double
 -> Maybe Double
 -> Maybe Bool
 -> Maybe OrcCompression
 -> Maybe [Text]
 -> Maybe Natural
 -> Maybe OrcFormatVersion
 -> Maybe Natural
 -> Maybe Natural
 -> Maybe Double
 -> OrcSerDe)
-> Parser (Maybe Double)
-> Parser
     (Maybe Double
      -> Maybe Bool
      -> Maybe OrcCompression
      -> Maybe [Text]
      -> Maybe Natural
      -> Maybe OrcFormatVersion
      -> Maybe Natural
      -> Maybe Natural
      -> Maybe Double
      -> OrcSerDe)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BloomFilterFalsePositiveProbability")
            Parser
  (Maybe Double
   -> Maybe Bool
   -> Maybe OrcCompression
   -> Maybe [Text]
   -> Maybe Natural
   -> Maybe OrcFormatVersion
   -> Maybe Natural
   -> Maybe Natural
   -> Maybe Double
   -> OrcSerDe)
-> Parser (Maybe Double)
-> Parser
     (Maybe Bool
      -> Maybe OrcCompression
      -> Maybe [Text]
      -> Maybe Natural
      -> Maybe OrcFormatVersion
      -> Maybe Natural
      -> Maybe Natural
      -> Maybe Double
      -> OrcSerDe)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"DictionaryKeyThreshold")
            Parser
  (Maybe Bool
   -> Maybe OrcCompression
   -> Maybe [Text]
   -> Maybe Natural
   -> Maybe OrcFormatVersion
   -> Maybe Natural
   -> Maybe Natural
   -> Maybe Double
   -> OrcSerDe)
-> Parser (Maybe Bool)
-> Parser
     (Maybe OrcCompression
      -> Maybe [Text]
      -> Maybe Natural
      -> Maybe OrcFormatVersion
      -> Maybe Natural
      -> Maybe Natural
      -> Maybe Double
      -> OrcSerDe)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EnablePadding")
            Parser
  (Maybe OrcCompression
   -> Maybe [Text]
   -> Maybe Natural
   -> Maybe OrcFormatVersion
   -> Maybe Natural
   -> Maybe Natural
   -> Maybe Double
   -> OrcSerDe)
-> Parser (Maybe OrcCompression)
-> Parser
     (Maybe [Text]
      -> Maybe Natural
      -> Maybe OrcFormatVersion
      -> Maybe Natural
      -> Maybe Natural
      -> Maybe Double
      -> OrcSerDe)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe OrcCompression)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Compression")
            Parser
  (Maybe [Text]
   -> Maybe Natural
   -> Maybe OrcFormatVersion
   -> Maybe Natural
   -> Maybe Natural
   -> Maybe Double
   -> OrcSerDe)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Natural
      -> Maybe OrcFormatVersion
      -> Maybe Natural
      -> Maybe Natural
      -> Maybe Double
      -> OrcSerDe)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BloomFilterColumns"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser
  (Maybe Natural
   -> Maybe OrcFormatVersion
   -> Maybe Natural
   -> Maybe Natural
   -> Maybe Double
   -> OrcSerDe)
-> Parser (Maybe Natural)
-> Parser
     (Maybe OrcFormatVersion
      -> Maybe Natural -> Maybe Natural -> Maybe Double -> OrcSerDe)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RowIndexStride")
            Parser
  (Maybe OrcFormatVersion
   -> Maybe Natural -> Maybe Natural -> Maybe Double -> OrcSerDe)
-> Parser (Maybe OrcFormatVersion)
-> Parser
     (Maybe Natural -> Maybe Natural -> Maybe Double -> OrcSerDe)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe OrcFormatVersion)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FormatVersion")
            Parser (Maybe Natural -> Maybe Natural -> Maybe Double -> OrcSerDe)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> Maybe Double -> OrcSerDe)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BlockSizeBytes")
            Parser (Maybe Natural -> Maybe Double -> OrcSerDe)
-> Parser (Maybe Natural) -> Parser (Maybe Double -> OrcSerDe)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StripeSizeBytes")
            Parser (Maybe Double -> OrcSerDe)
-> Parser (Maybe Double) -> Parser OrcSerDe
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"PaddingTolerance")
      )

instance Prelude.Hashable OrcSerDe

instance Prelude.NFData OrcSerDe

instance Core.ToJSON OrcSerDe where
  toJSON :: OrcSerDe -> Value
toJSON OrcSerDe' {Maybe Bool
Maybe Double
Maybe Natural
Maybe [Text]
Maybe OrcCompression
Maybe OrcFormatVersion
paddingTolerance :: Maybe Double
stripeSizeBytes :: Maybe Natural
blockSizeBytes :: Maybe Natural
formatVersion :: Maybe OrcFormatVersion
rowIndexStride :: Maybe Natural
bloomFilterColumns :: Maybe [Text]
compression :: Maybe OrcCompression
enablePadding :: Maybe Bool
dictionaryKeyThreshold :: Maybe Double
bloomFilterFalsePositiveProbability :: Maybe Double
$sel:paddingTolerance:OrcSerDe' :: OrcSerDe -> Maybe Double
$sel:stripeSizeBytes:OrcSerDe' :: OrcSerDe -> Maybe Natural
$sel:blockSizeBytes:OrcSerDe' :: OrcSerDe -> Maybe Natural
$sel:formatVersion:OrcSerDe' :: OrcSerDe -> Maybe OrcFormatVersion
$sel:rowIndexStride:OrcSerDe' :: OrcSerDe -> Maybe Natural
$sel:bloomFilterColumns:OrcSerDe' :: OrcSerDe -> Maybe [Text]
$sel:compression:OrcSerDe' :: OrcSerDe -> Maybe OrcCompression
$sel:enablePadding:OrcSerDe' :: OrcSerDe -> Maybe Bool
$sel:dictionaryKeyThreshold:OrcSerDe' :: OrcSerDe -> Maybe Double
$sel:bloomFilterFalsePositiveProbability:OrcSerDe' :: OrcSerDe -> Maybe Double
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"BloomFilterFalsePositiveProbability" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
bloomFilterFalsePositiveProbability,
            (Text
"DictionaryKeyThreshold" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
dictionaryKeyThreshold,
            (Text
"EnablePadding" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enablePadding,
            (Text
"Compression" Text -> OrcCompression -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (OrcCompression -> Pair) -> Maybe OrcCompression -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OrcCompression
compression,
            (Text
"BloomFilterColumns" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
bloomFilterColumns,
            (Text
"RowIndexStride" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
rowIndexStride,
            (Text
"FormatVersion" Text -> OrcFormatVersion -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (OrcFormatVersion -> Pair) -> Maybe OrcFormatVersion -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OrcFormatVersion
formatVersion,
            (Text
"BlockSizeBytes" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
blockSizeBytes,
            (Text
"StripeSizeBytes" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
stripeSizeBytes,
            (Text
"PaddingTolerance" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
paddingTolerance
          ]
      )