Editar

Compartir a través de


Invoke-AzSynapseSparkStatement

Invokes a Synapse Analytics Spark statement.

Syntax

Invoke-AzSynapseSparkStatement
      -WorkspaceName <String>
      -SparkPoolName <String>
      -Language <String>
      -SessionId <Int32>
      -FilePath <String>
      [-Response]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Invoke-AzSynapseSparkStatement
      -WorkspaceName <String>
      -SparkPoolName <String>
      -Language <String>
      -SessionId <Int32>
      -Code <String>
      [-Response]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Invoke-AzSynapseSparkStatement
      -Language <String>
      -SessionObject <PSSynapseSparkSession>
      [-SessionId <Int32>]
      -Code <String>
      [-Response]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Invoke-AzSynapseSparkStatement
      -Language <String>
      -SessionObject <PSSynapseSparkSession>
      [-SessionId <Int32>]
      -FilePath <String>
      [-Response]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Invoke-AzSynapseSparkStatement cmdlet invokes a Synapse Analytics Spark statement.

Examples

Example 1

$session = Start-AzSynapseSparkSession -WorkspaceName ContosoWorkspace -SparkPoolName ContosoSparkPool -Name ContosoSessionName -ExecutorCount 3 -ExecutorSize Small
$session.Language = 'Spark' 
$session | Invoke-AzSynapseSparkStatement -Code 'print("Hello world\n")'

These commands start a Spark session then invoke an inline Spark statement through pipeline.

Example 2

Invoke-AzSynapseSparkStatement -SessionId 324 -Language 'Spark' -Code 'print("Hello world\n")'

These commands start a Spark session then invoke an inline Spark statement.

Example 3

$session = Start-AzSynapseSparkSession -WorkspaceName ContosoWorkspace -SparkPoolName ContosoSparkPool -Name ContosoSessionName -ExecutorCount 3 -ExecutorSize Small
$session.Language = 'Spark' 
$session | Invoke-AzSynapseSparkStatement -FilePath 'C:\path\to\code.sc'

These commands start a Spark session then invoke Spark statements in a file.

Parameters

-AsJob

Run cmdlet in the background

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Code

The execution code.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-FilePath

Specifies a local file path that contains the execution code.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Language

Language of the execution code.

Type:String
Accepted values:Spark, Scala, PySpark, Python, SparkDotNet, CSharp, SQL, Spark, Scala, PySpark, Python, SparkDotNet, CSharp, SQL
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Response

Indicates full response should be return.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SessionId

Identifier of Spark session.

Type:Int32
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-SessionObject

Spark session input object, usually passed through the pipeline.

Type:PSSynapseSparkSession
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-SparkPoolName

Name of Synapse Spark pool.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WorkspaceName

Name of Synapse workspace.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

PSSynapseSparkSession

Outputs

PSSynapseExtendedSparkStatement