ComposantsComponents

ComposantsComponents › TechniqueTechnical

tHashInput

tHashInput

TechniqueTechnical masqué par défauthidden by default

Relit les lignes gardées en mémoire par un tHashOutput du même job et les envoie dans un flux. Le même cache se relit autant de fois que nécessaire, par un ou plusieurs tHashInput, tant qu'il n'est pas vidé. Reads the rows kept in memory by a tHashOutput of the same job and sends them into a flow. The same cache can be read as many times as needed, by one or several tHashInput components, as long as it is not cleared.

EntréeInput

Aucune : il commence son sous-job. Sinon un lien Iterate. None: it starts its subjob. Otherwise one Iterate link.

SortieOutput

Main un flux : les lignes du cacheone flow: the rows of the cache

Déclencheurs en sortieOutput triggers

On Subjob Ok On Subjob Error On Component Ok On Component Error Run if

UtilisationUsage

Après le tHashOutputAfter the tHashOutput

row1 (Main) OnSubjobOk row2 (Main) tFileInputDelimited_1 tHashOutput_1 tHashInput_1 tMap_1

Le tHashInput commence un sous-job qui s'exécute une fois le cache rempli : la source n'est lue qu'une fois, ses lignes servent ensuite où il faut. The tHashInput starts a subjob that runs once the cache is filled: the source is read only once, its rows are then used where needed.

Lire deux foisRead twice

row1 (Main) OnSubjobOk row2 (Main) tHashInput_1 tFileOutputDelimited_1 tHashInput_2 tDBOutput_1

Deux tHashInput lisent le même tHashOutput, l'un après l'autre. Cochez Vider le cache après lecture sur le dernier seulement. Two tHashInput components read the same tHashOutput, one after the other. Check Clear cache after reading on the last one only.

  1. Affichez le composant dans la palette (voir plus bas), puis déposez le tHashInput depuis la famille Technique. Show the component in the palette (see below), then drop the tHashInput from the Technical family.
  2. Choisissez le tHashOutput à lire dans Liste des composants. Choose the tHashOutput to read in Component list.
  3. Donnez-lui le schéma du tHashOutput : mêmes colonnes, dans le même ordre, avec les mêmes types. Give it the schema of the tHashOutput: same columns, in the same order, with the same types.
  4. Reliez le sous-job du tHashOutput au sien par On Subjob Ok, puis reliez sa sortie à la suite du flux. Connect the subjob of the tHashOutput to its own with On Subjob Ok, then connect its output to the rest of the flow.

Afficher le composant dans la paletteShow the component in the palette

Le tHashInput est masqué par défaut : il n'est pas dans la palette tant qu'il n'est pas affiché dans les paramètres du projet. Le réglage est enregistré dans le projet : il vaut pour tous ses jobs et pour tous ceux qui ouvrent le projet. Faites-le en même temps pour le tHashOutput, masqué lui aussi. The tHashInput is hidden by default: it is not in the palette until it is shown in the project settings. The setting is saved in the project: it applies to all its jobs and to everyone who opens the project. Do it at the same time for the tHashOutput, which is hidden too.

  1. Menu Fichier › Modifier les propriétés du projet, ou bouton Paramètres du projet de la barre d'outils. Dans l'éditeur d'un job, un clic droit sur le titre de la palette › PaletteFilter ouvre directement la bonne page. File › Edit Project properties menu, or Project settings button of the toolbar. In a job editor, a right-click on the palette title › PaletteFilter opens the right page directly.
  2. Dans l'arbre de gauche, ouvrez Designer › Paramètres de la Palette. In the tree on the left, open Designer › Palette Settings.
  3. La liste Hide (à gauche) contient les composants masqués. Dépliez-la jusqu'à la famille Technique et sélectionnez tHashInput (Ctrl+clic pour en prendre plusieurs). The Hide list (on the left) holds the hidden components. Unfold it down to the Technical family and select tHashInput (Ctrl+click to take several).
  4. Cliquez sur la flèche vers la droite, entre les deux listes : le composant passe dans la liste Show. Click the right arrow, between the two lists: the component moves to the Show list.
  5. Validez avec Apply and Close : le composant apparaît dans la famille Technique de la palette. Confirm with Apply and Close: the component appears in the Technical family of the palette.

Les libellés Hide, Show, PaletteFilter et Apply and Close sont en anglais, même dans le Studio en français. Un composant déjà utilisé dans un job du projet ne peut pas être masqué de nouveau : le Studio le laisse visible et le signale. The Hide, Show, PaletteFilter and Apply and Close labels are in English, even in the French Studio. A component already used in a job of the project cannot be hidden again: the Studio leaves it visible and says so.

Paramètres simplesBasic settings

Les libellés sont ceux de l'onglet Composant ; le nom technique, en gris, est celui du paramètre dans le fichier du job. Le composant n'a pas de paramètres avancés propres. Labels are those of the Component tab; the technical name, in grey, is the parameter name in the job file. The component has no advanced settings of its own.

ParamètreSetting DéfautDefault VisibleShown Description
SchémaSchemaSCHEMA — ToujoursAlways Les colonnes envoyées dans le flux. Les valeurs du cache y sont copiées par position, pas par nom : la 1re colonne du tHashOutput dans la 1re colonne, et ainsi de suite. The columns sent into the flow. The cache values are copied into them by position, not by name: the 1st column of the tHashOutput into the 1st column, and so on.
Relier à un tHashOutputLink with a tHashOutputLINK_WITH OuiYes ToujoursAlways Coché et grisé : le tHashInput lit toujours le cache d'un tHashOutput. Checked and greyed out: the tHashInput always reads the cache of a tHashOutput.
Liste des composantsComponent listLIST — ToujoursAlways Le tHashOutput du job dont le cache est lu. S'il est relié à un autre tHashOutput, c'est le cache commun qui est lu, avec toutes ses lignes (voir l'exemple). The tHashOutput of the job whose cache is read. If it is linked with another tHashOutput, the common cache is read, with all its rows (see the example).
Vider le cache après lectureClear cache after readingRELEASE_CACHE NonNo ToujoursAlways Une fois toutes les lignes lues, efface le cache, avec celui des tHashOutput qui lui sont reliés : la mémoire est libérée, mais une lecture suivante du même cache échoue. À cocher sur la dernière lecture (voir l'exemple). Once all the rows are read, clears the cache, along with that of the tHashOutput components linked to it: the memory is freed, but a later read of the same cache fails. To check on the last read (see the example).

ExemplesExamples

Un tFixedFlowInput envoie trois lignes à un tHashOutput_1. Les sorties sont celles de la console, copiées depuis une exécution du job ; les tLogRow affichent leur nom unique devant chaque ligne. Dans les erreurs, le nom du job est remplacé par MyJob et les traces sont abrégées. A tFixedFlowInput sends three rows to a tHashOutput_1. The outputs are the console ones, copied from a run of the job; the tLogRow components print their unique name in front of each row. In the errors, the job name is replaced with MyJob and the traces are shortened.

row1 (Main) OnSubjobOk row2 (Main) OnSubjobOk row3 (Main) tFixedFlowInput_1 tHashOutput_1 tHashInput_1 tLogRow_1 tHashInput_2 tLogRow_2
idInteger nameString cityString
1AdaLondon
2GraceNew York
3AlanManchester

Deux lectures du même cacheTwo reads of the same cache

Les deux tHashInput lisent le tHashOutput_1, Vider le cache après lecture décoché : chacun reçoit les trois lignes. Both tHashInput components read tHashOutput_1, Clear cache after reading unchecked: each one receives the three rows.

[tLogRow_1] 1|Ada|London
[tLogRow_1] 2|Grace|New York
[tLogRow_1] 3|Alan|Manchester
[tLogRow_2] 1|Ada|London
[tLogRow_2] 2|Grace|New York
[tLogRow_2] 3|Alan|Manchester

Cache vidé par la première lectureCache cleared by the first read

Même job, Vider le cache après lecture coché sur le tHashInput_1 : le tHashInput_2 ne trouve plus rien à lire. Same job, Clear cache after reading checked on tHashInput_1: tHashInput_2 finds nothing left to read.

[tLogRow_1] 1|Ada|London
[tLogRow_1] 2|Grace|New York
[tLogRow_1] 3|Alan|Manchester
Exception in component tHashInput_2 (MyJob)
java.lang.RuntimeException: The hash is not initialized : The hash must exist before you read from it
	at demo.myjob_0_1.MyJob.tHashInput_2Process(MyJob.java:2729)
	…

Le job s'arrête avec le code de sortie 1. The job stops with exit code 1.

Lire un tHashOutput relié, avec d'autres noms de colonnesRead a linked tHashOutput, with other column names

Le job de l'exemple Relier à un tHashOutput : tHashOutput_1 reçoit id, name (1 Ada, 2 Grace) ; tHashOutput_2, relié au premier, reçoit code, label (10 Alan, 11 Margaret). Le tHashInput_2 lit le tHashOutput_2 avec le schéma code (Integer), label (String). Extrait : les lignes de son tLogRow_2. The job of the Link with a tHashOutput example: tHashOutput_1 receives id, name (1 Ada, 2 Grace); tHashOutput_2, linked with the first one, receives code, label (10 Alan, 11 Margaret). tHashInput_2 reads tHashOutput_2 with the schema code (Integer), label (String). Excerpt: the rows of its tLogRow_2.

[tLogRow_2] 1|Ada
[tLogRow_2] 2|Grace
[tLogRow_2] 10|Alan
[tLogRow_2] 11|Margaret

Le cache commun est lu en entier, et les valeurs de id et name arrivent dans code et label : seule la position compte. The common cache is read in full, and the values of id and name arrive in code and label: only the position matters.

Nombre de lignes luesNumber of rows read

Un seul tHashInput, suivi par On Subjob Ok d'un tJava : A single tHashInput, followed through On Subjob Ok by a tJava:

System.out.println("tHashOutput_1_NB_LINE: " + globalMap.get("tHashOutput_1_NB_LINE"));
System.out.println("tHashInput_1_NB_LINE: " + globalMap.get("tHashInput_1_NB_LINE"));
1|Ada|London
2|Grace|New York
3|Alan|Manchester
tHashOutput_1_NB_LINE: 3
tHashInput_1_NB_LINE: 3

Ici le tLogRow est réglé par défaut, sans nom unique. Avec Garder le premier sur le tHashOutput, les deux nombres peuvent différer : voir la gestion des clés. Here the tLogRow has its default settings, without the unique name. With Keep first on the tHashOutput, the two numbers can differ: see keys management.

ErreursErrors

Lire avant que le tHashOutput ait démarréReading before the tHashOutput has started

row1 (Main) row2 (Main) tHashInput_1 tLogRow_1 tFixedFlowInput_1 tHashOutput_1

Deux sous-jobs sans lien entre eux, celui du tHashInput placé en premier : il s'exécute d'abord. Two subjobs without a link between them, the tHashInput one placed first: it runs first.

Exception in component tHashInput_1 (MyJob)
java.lang.RuntimeException: The hash is not initialized : The hash must exist before you read from it
	at demo.myjob_0_1.MyJob.tHashInput_1Process(MyJob.java:902)
	…

Le même message apparaît quand le cache a été vidé par un tHashInput précédent (voir plus haut). Reliez le sous-job du tHashOutput à celui du tHashInput par On Subjob Ok. The same message appears when the cache was cleared by an earlier tHashInput (see above). Connect the subjob of the tHashOutput to the one of the tHashInput with On Subjob Ok.

Variable globaleGlobal variable

NB_LINE (Integer, disponible après l'exécution du composant) : nombre de lignes lues dans le cache. NB_LINE (Integer, available after the component has run): number of rows read from the cache.

((Integer) globalMap.get("tHashInput_1_NB_LINE"))

Conseils et limitesTips and limits

Même schéma, même ordreSame schema, same order

Les noms des colonnes ne sont pas comparés, seule leur position compte : deux colonnes de même type inversées dans un des schémas échangent leurs valeurs, sans message. Après un changement du schéma du tHashOutput, reportez-le dans le tHashInput. Column names are not compared, only their position matters: two columns of the same type swapped in one of the schemas exchange their values, without a message. After a change to the schema of the tHashOutput, apply it to the tHashInput too.

Libérer la mémoireFree the memory

Le cache reste en mémoire jusqu'à la fin du job. Sur un gros volume, cochez Vider le cache après lecture sur le dernier tHashInput qui le lit. The cache stays in memory until the end of the job. On a large volume, check Clear cache after reading on the last tHashInput that reads it.

Ordre de lectureRead order

Les lignes sortent dans leur ordre d'arrivée avec Garder tout sur le tHashOutput. Avec Garder le premier ou Garder le dernier, l'ordre n'est pas garanti : triez ensuite si besoin. The rows come out in their arrival order with Keep all on the tHashOutput. With Keep first or Keep last, the order is not guaranteed: sort afterwards if needed.

Utilisé aussi par le StudioAlso used by the Studio

Quand un même flux traverse au moins deux composants de fusion (tUnite), le code généré range les lignes dans un tHashOutput puis les relit par un tHashInput qui vide le cache après lecture. Leurs noms, comme tHashInput_tUnite_1, peuvent apparaître dans les messages d'erreur. When a same flow goes through at least two merge components (tUnite), the generated code stores the rows in a tHashOutput then reads them back with a tHashInput that clears the cache after reading. Their names, such as tHashInput_tUnite_1, can appear in error messages.

Voir aussiSee also