{-# 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.Athena.Types.QueryStagePlanNode
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Athena.Types.QueryStagePlanNode where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Stage plan information such as name, identifier, sub plans, and remote
-- sources.
--
-- /See:/ 'newQueryStagePlanNode' smart constructor.
data QueryStagePlanNode = QueryStagePlanNode'
  { -- | Stage plan information such as name, identifier, sub plans, and remote
    -- sources of child plan nodes\/
    QueryStagePlanNode -> Maybe [QueryStagePlanNode]
children :: Prelude.Maybe [QueryStagePlanNode],
    -- | Information about the operation this query stage plan node is
    -- performing.
    QueryStagePlanNode -> Maybe Text
identifier :: Prelude.Maybe Prelude.Text,
    -- | Name of the query stage plan that describes the operation this stage is
    -- performing as part of query execution.
    QueryStagePlanNode -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Source plan node IDs.
    QueryStagePlanNode -> Maybe [Text]
remoteSources :: Prelude.Maybe [Prelude.Text]
  }
  deriving (QueryStagePlanNode -> QueryStagePlanNode -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QueryStagePlanNode -> QueryStagePlanNode -> Bool
$c/= :: QueryStagePlanNode -> QueryStagePlanNode -> Bool
== :: QueryStagePlanNode -> QueryStagePlanNode -> Bool
$c== :: QueryStagePlanNode -> QueryStagePlanNode -> Bool
Prelude.Eq, ReadPrec [QueryStagePlanNode]
ReadPrec QueryStagePlanNode
Int -> ReadS QueryStagePlanNode
ReadS [QueryStagePlanNode]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QueryStagePlanNode]
$creadListPrec :: ReadPrec [QueryStagePlanNode]
readPrec :: ReadPrec QueryStagePlanNode
$creadPrec :: ReadPrec QueryStagePlanNode
readList :: ReadS [QueryStagePlanNode]
$creadList :: ReadS [QueryStagePlanNode]
readsPrec :: Int -> ReadS QueryStagePlanNode
$creadsPrec :: Int -> ReadS QueryStagePlanNode
Prelude.Read, Int -> QueryStagePlanNode -> ShowS
[QueryStagePlanNode] -> ShowS
QueryStagePlanNode -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QueryStagePlanNode] -> ShowS
$cshowList :: [QueryStagePlanNode] -> ShowS
show :: QueryStagePlanNode -> String
$cshow :: QueryStagePlanNode -> String
showsPrec :: Int -> QueryStagePlanNode -> ShowS
$cshowsPrec :: Int -> QueryStagePlanNode -> ShowS
Prelude.Show, forall x. Rep QueryStagePlanNode x -> QueryStagePlanNode
forall x. QueryStagePlanNode -> Rep QueryStagePlanNode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep QueryStagePlanNode x -> QueryStagePlanNode
$cfrom :: forall x. QueryStagePlanNode -> Rep QueryStagePlanNode x
Prelude.Generic)

-- |
-- Create a value of 'QueryStagePlanNode' 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:
--
-- 'children', 'queryStagePlanNode_children' - Stage plan information such as name, identifier, sub plans, and remote
-- sources of child plan nodes\/
--
-- 'identifier', 'queryStagePlanNode_identifier' - Information about the operation this query stage plan node is
-- performing.
--
-- 'name', 'queryStagePlanNode_name' - Name of the query stage plan that describes the operation this stage is
-- performing as part of query execution.
--
-- 'remoteSources', 'queryStagePlanNode_remoteSources' - Source plan node IDs.
newQueryStagePlanNode ::
  QueryStagePlanNode
newQueryStagePlanNode :: QueryStagePlanNode
newQueryStagePlanNode =
  QueryStagePlanNode'
    { $sel:children:QueryStagePlanNode' :: Maybe [QueryStagePlanNode]
children = forall a. Maybe a
Prelude.Nothing,
      $sel:identifier:QueryStagePlanNode' :: Maybe Text
identifier = forall a. Maybe a
Prelude.Nothing,
      $sel:name:QueryStagePlanNode' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:remoteSources:QueryStagePlanNode' :: Maybe [Text]
remoteSources = forall a. Maybe a
Prelude.Nothing
    }

-- | Stage plan information such as name, identifier, sub plans, and remote
-- sources of child plan nodes\/
queryStagePlanNode_children :: Lens.Lens' QueryStagePlanNode (Prelude.Maybe [QueryStagePlanNode])
queryStagePlanNode_children :: Lens' QueryStagePlanNode (Maybe [QueryStagePlanNode])
queryStagePlanNode_children = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryStagePlanNode' {Maybe [QueryStagePlanNode]
children :: Maybe [QueryStagePlanNode]
$sel:children:QueryStagePlanNode' :: QueryStagePlanNode -> Maybe [QueryStagePlanNode]
children} -> Maybe [QueryStagePlanNode]
children) (\s :: QueryStagePlanNode
s@QueryStagePlanNode' {} Maybe [QueryStagePlanNode]
a -> QueryStagePlanNode
s {$sel:children:QueryStagePlanNode' :: Maybe [QueryStagePlanNode]
children = Maybe [QueryStagePlanNode]
a} :: QueryStagePlanNode) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Information about the operation this query stage plan node is
-- performing.
queryStagePlanNode_identifier :: Lens.Lens' QueryStagePlanNode (Prelude.Maybe Prelude.Text)
queryStagePlanNode_identifier :: Lens' QueryStagePlanNode (Maybe Text)
queryStagePlanNode_identifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryStagePlanNode' {Maybe Text
identifier :: Maybe Text
$sel:identifier:QueryStagePlanNode' :: QueryStagePlanNode -> Maybe Text
identifier} -> Maybe Text
identifier) (\s :: QueryStagePlanNode
s@QueryStagePlanNode' {} Maybe Text
a -> QueryStagePlanNode
s {$sel:identifier:QueryStagePlanNode' :: Maybe Text
identifier = Maybe Text
a} :: QueryStagePlanNode)

-- | Name of the query stage plan that describes the operation this stage is
-- performing as part of query execution.
queryStagePlanNode_name :: Lens.Lens' QueryStagePlanNode (Prelude.Maybe Prelude.Text)
queryStagePlanNode_name :: Lens' QueryStagePlanNode (Maybe Text)
queryStagePlanNode_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryStagePlanNode' {Maybe Text
name :: Maybe Text
$sel:name:QueryStagePlanNode' :: QueryStagePlanNode -> Maybe Text
name} -> Maybe Text
name) (\s :: QueryStagePlanNode
s@QueryStagePlanNode' {} Maybe Text
a -> QueryStagePlanNode
s {$sel:name:QueryStagePlanNode' :: Maybe Text
name = Maybe Text
a} :: QueryStagePlanNode)

-- | Source plan node IDs.
queryStagePlanNode_remoteSources :: Lens.Lens' QueryStagePlanNode (Prelude.Maybe [Prelude.Text])
queryStagePlanNode_remoteSources :: Lens' QueryStagePlanNode (Maybe [Text])
queryStagePlanNode_remoteSources = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryStagePlanNode' {Maybe [Text]
remoteSources :: Maybe [Text]
$sel:remoteSources:QueryStagePlanNode' :: QueryStagePlanNode -> Maybe [Text]
remoteSources} -> Maybe [Text]
remoteSources) (\s :: QueryStagePlanNode
s@QueryStagePlanNode' {} Maybe [Text]
a -> QueryStagePlanNode
s {$sel:remoteSources:QueryStagePlanNode' :: Maybe [Text]
remoteSources = Maybe [Text]
a} :: QueryStagePlanNode) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON QueryStagePlanNode where
  parseJSON :: Value -> Parser QueryStagePlanNode
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"QueryStagePlanNode"
      ( \Object
x ->
          Maybe [QueryStagePlanNode]
-> Maybe Text -> Maybe Text -> Maybe [Text] -> QueryStagePlanNode
QueryStagePlanNode'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Children" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Identifier")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Name")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"RemoteSources" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable QueryStagePlanNode where
  hashWithSalt :: Int -> QueryStagePlanNode -> Int
hashWithSalt Int
_salt QueryStagePlanNode' {Maybe [Text]
Maybe [QueryStagePlanNode]
Maybe Text
remoteSources :: Maybe [Text]
name :: Maybe Text
identifier :: Maybe Text
children :: Maybe [QueryStagePlanNode]
$sel:remoteSources:QueryStagePlanNode' :: QueryStagePlanNode -> Maybe [Text]
$sel:name:QueryStagePlanNode' :: QueryStagePlanNode -> Maybe Text
$sel:identifier:QueryStagePlanNode' :: QueryStagePlanNode -> Maybe Text
$sel:children:QueryStagePlanNode' :: QueryStagePlanNode -> Maybe [QueryStagePlanNode]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [QueryStagePlanNode]
children
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
identifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
remoteSources

instance Prelude.NFData QueryStagePlanNode where
  rnf :: QueryStagePlanNode -> ()
rnf QueryStagePlanNode' {Maybe [Text]
Maybe [QueryStagePlanNode]
Maybe Text
remoteSources :: Maybe [Text]
name :: Maybe Text
identifier :: Maybe Text
children :: Maybe [QueryStagePlanNode]
$sel:remoteSources:QueryStagePlanNode' :: QueryStagePlanNode -> Maybe [Text]
$sel:name:QueryStagePlanNode' :: QueryStagePlanNode -> Maybe Text
$sel:identifier:QueryStagePlanNode' :: QueryStagePlanNode -> Maybe Text
$sel:children:QueryStagePlanNode' :: QueryStagePlanNode -> Maybe [QueryStagePlanNode]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [QueryStagePlanNode]
children
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
identifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
remoteSources