Shuffle

On this Page

Overview

The Shuffle Snap is a a Flow type Snap that enables you to randomize the order of the rows in an incoming dataset. The Snap can be optimized to work with large datasets by configuring the maximum percentage of memory that can be used to buffer the dataset, if that limit is exceeded then the dataset is downloaded to a temporary file in local storage. A random integer can be assigned as the seed value, a seed value is any number that acts as the identifier for a particular randomized order. The Snap produces the same randomized order for the same seed value. This Snap, along with the Sample Snap, is helpful in randomizing a sample dataset for further analysis. 

Input and Output

  • Expected input: Document containing row data. 
  • Expected output: Document with randomized row order.
  • Expected upstream Snaps: Any Snap that produces a document output containing row-data. For example, CSV Generator, and Mapper.
  • Expected downstream Snaps: Any Snap that accepts a document input. For example, Mapper.

Prerequisites

None.

Configuring Accounts

Accounts are not required in this Snap.

Configuring Views

Input

Exactly one document input view.
OutputExactly one document output view.
ErrorAt most one document error view.

Troubleshooting

None.

Limitations and Known Issues

None.

Modes


Snap Settings


Label

Required. The name for the Snap. Modify this to be more specific, especially if there are more than one of the same Snap in the pipeline.

Use random seed

Select this field to enable using a seed value. The next field is ignored if this field is deselected. 

Default value: Selected

Random seed

Conditional. This is required if the Use random seed field is selected and specifies the seed value to be used in randomizing the dataset. Using the same seed value for a dataset generates the same order of shuffled dataset.

Default value: 12345

The result is different if the value specified in Maximum memory % or the JCC memory are different.

Maximum memory %

Required. The maximum portion of the node's memory, as a percentage, that can be utilized to buffer the incoming dataset. If this percentage is exceeded then the dataset is written to a temporary local file and then the sample generated from this temporary file. This configuration is useful in handling large datasets without over-utilization of the node memory. The minimum default memory to be utilized by the Snap is set at 100 MB.

Default value: 10

Snap Execution

Select one of the three modes in which the Snap executes. Available options are:
  • Validate & Execute: Performs limited execution of the Snap, and generates a data preview during Pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during Pipeline runtime.
  • Execute only: Performs full execution of the Snap during Pipeline execution without generating preview data.
  • Disabled: Disables the Snap and all Snaps that are downstream from it.

Temporary Files

During execution, data processing on Snaplex nodes occurs principally in-memory as streaming and is unencrypted. When larger datasets are processed that exceeds the available compute memory, the Snap writes Pipeline data to local storage as unencrypted to optimize the performance. These temporary files are deleted when the Snap/Pipeline execution completes. You can configure the temporary data's location in the Global properties table of the Snaplex's node properties, which can also help avoid Pipeline errors due to the unavailability of space. For more information, see Temporary Folder in Configuration Options


Examples



Shuffling a Numerical Dataset

The Pipeline in this example, Shuffle_Snap_Numerical_Data.slp, demonstrates the core functionality of the Shuffle Snap. An input dataset containing 50 rows is passed to the Shuffle Snap. Three cases are demonstrated:

  • Using a seed value
  • Using another seed value
  • Without seed value

Upon execution, the output document is the input document with the rows in a random order.

Download this pipeline. 

 Understanding the pipeline

The Sequence Snap simulates a numerical dataset by generating a sequence of 50 numbers as shown below:


Three Shuffle Snaps demonstrate how the Snap works with and without a seed value:

  • Using Random Seed #1: The Use random seed checkbox is selected and the Random seed field is configured as 12345.


    The output from this Snap is as shown below:



  • Using Random Seed #2: The Use random seed checkbox is selected and the Random seed field is configured as 54321.


    The output from this Snap is as shown below:



  • Without Random Seed: The Use random seed checkbox is deselected. The Random seed field, regardless of its configuration, is ignored by the Snap.


    The output from this Snap is as shown below:


Download this pipeline.  

Shuffling a Categorical Dataset

The Pipeline in this example, Shuffle_Snap_Categorical_Data.slp, demonstrates how categorical data or data containing multiple fields is handled by the Shuffle Snap. An input dataset containing 21 rows is passed to the Shuffle Snap. Three cases are demonstrated:

  • Using a seed value
  • Using another seed value
  • Without seed value

When the Pipeline is executed, the output generated is the incoming dataset but with its order randomized.

Download this pipeline. 

 Understanding the pipeline

The input is a JSON file containing information about different aspects of 3 species of a flower, aspects such as sepal length, sepal width, petal length, petal width, and classification. 21 records are present in this dataset, sorted based on the $class field as shown below:


The three Shuffle Snaps are used to demonstrate how the Snap works with and without a seed value. Two different seed values are given to verify the output dataset's row order:

  • Using Random Seed #1: The Use random seed checkbox is selected and the Random seed field is configured as 12345.


    The output from this Snap is as shown below:



  • Using Random Seed #2: The Use random seed checkbox is selected and the Random seed field is configured as 54321.


    The output from this Snap is as shown below:



  • Without Random Seed: The Use random seed checkbox is deselected. The Random seed field, regardless of its configuration, is ignored by the Snap.


    The output from this Snap is as shown below:


Download this pipeline. 


Downloads

Important steps to successfully reuse Pipelines

  1. Download and import the Pipeline into SnapLogic.
  2. Configure Snap accounts as applicable.
  3. Provide Pipeline parameters as applicable.

  File Modified

File Shuffle_Snap_Categorical_Data.slp

Nov 09, 2018 by Rakesh Chaudhary

File Shuffle_Snap_Numerical_Data.slp

Nov 09, 2018 by Rakesh Chaudhary

Snap Pack History

 Click to view/expand
Release Snap Pack VersionDateType  Updates
February 2024main25112 StableUpdated and certified against the current SnapLogic Platform release.
November 2023main23721Nov 8, 2023StableUpdated and certified against the current SnapLogic Platform release.

August 2023

main22460

Aug 16, 2023

Stable

Updated and certified against the current SnapLogic Platform release.

May 2023433patches21572 Latest

The Deduplicate Snap now manages memory efficiently and eliminates out-of-memory crashes using the following fields:

  • Minimum memory (MB)

  • Minimum free disk space (MB)

May 2023433patches21247 Latest

Fixed an issue with the Match Snap where a null pointer exception was thrown when the second input view had fewer records than the first.

May 2023

main21015 

Stable

Upgraded with the latest SnapLogic Platform release.

February 2023main19844 StableUpgraded with the latest SnapLogic Platform release.
December 2022431patches19268 Latest

The Deduplicate Snap now ignores fields with empty strings and whitespaces as no data.

November 2022main18944
 
Stable

Upgraded with the latest SnapLogic Platform release.

August 2022main17386
 
Stable

Upgraded with the latest SnapLogic Platform release.

4.29main15993
 
StableUpgraded with the latest SnapLogic Platform release.
4.28main14627
 
Stable

Enhanced the Type Converter Snap with the Fail safe upon execution checkbox. Select this checkbox to enable the Snap to convert data with valid data types, while ignoring invalid data types.

4.27427patches13730

Enhanced the Type Converter Snap with the Fail safe upon execution checkbox. Select this checkbox to enable the Snap to ignore invalid data types and convert data with valid data types.

4.27427patches13948
 
Latest

Fixed an issue with the Principal Component Analysis Snap, where a deadlock occurred when data is loaded from both the input views.

4.27main12833
 
StableUpgraded with the latest SnapLogic Platform release.
4.26main11181
 
StableUpgraded with the latest SnapLogic Platform release.
4.25425patches10994
 

Fixed an issue when the Deduplicate Snap where the Snap breaks when running on a locale that does not format decimals with Period (.) character. 

4.25main9554
 
StableUpgraded with the latest SnapLogic Platform release.
4.24main8556
 
StableUpgraded with the latest SnapLogic Platform release.
4.23main7430
 
StableUpgraded with the latest SnapLogic Platform release.
4.22main6403
 
StableUpgraded with the latest SnapLogic Platform release.
4.21snapsmrc542
 
Stable
  • Introduces the Mask Snap that enables you to hide sensitive information in your dataset before exporting the dataset for analytics or writing the dataset to a target file.
  • Enhances the Match Snap to add a new field, Match all, which matches one record from the first input with multiple records in the second input. Also, enhances the Comparator field in the Snap by adding one more option, Exact, which identifies and classifies a match as either an exact match or not a match at all.
  • Enhances the Deduplicate Snap to add a new field, Group ID, which includes the Group ID for each record in the output. Also, enhances the Comparator field in the Snap by adding one more option, Exact, which identifies and classifies a match as either an exact match or not a match at all.
  • Enhances the Sample Snap by adding a second output view which displays data that is not in the first output. Also, a new algorithm type, Linear Split, which enables you to split the dataset based on the pass-through percentage.
4.20 Patchmldatapreparation8771
 
Latest

Removes the unused jcc-optional dependency from the ML Data Preparation Snap Pack.

4.20snapsmrc535
 
StableUpgraded with the latest SnapLogic Platform release.
4.19snapsmrc528
 
Stable

New Snap: Introducing the Deduplicate Snap. Use this Snap to remove duplicate records from input documents. When you use multiple matching criteria to deduplicate your data, it is evaluated using each criterion separately, and then aggregated to give the final result.

4.18snapsmrc523
 
StableUpgraded with the latest SnapLogic Platform release.
4.17 PatchALL7402
 
Latest

Pushed automatic rebuild of the latest version of each Snap Pack to SnapLogic UAT and Elastic servers.

4.17snapsmrc515
 
Latest
  • New Snap: Introducing the Feature Synthesis Snap, which automatically creates features out of multiple datasets that share a one-to-one or one-to-many relationship with each other.
  • New Snap: Introducing the Match Snap, which enables you to automatically identify matched records across datasets that do not have a common key field.
  • Added the Snap Execution field to all Standard-mode Snaps. In some Snaps, this field replaces the existing Execute during preview check box.
4.16snapsmrc508
 
Stable

Added a new Snap, Principal Component Analysis, which enables you to perform principal component analysis (PCA) on numeric fields (columns) to reduce dimensions of the dataset.

4.15snapsmrc500
 
Stable
  • New Snap Pack. Perform preparatory operations on datasets such as data type transformation, data cleanup, sampling, shuffling, and scaling. Snaps in this Snap Pack are: 
    • Categorical to Numeric
    • Clean Missing Values
    • Date Time Extractor
    • Numeric to Categorical
    • Sample
    • Scale
    • Shuffle
    • Type Converter