ComposantsComponents › TraitementProcessing
Garde, retire ou réordonne les colonnes d'un flux : son schéma est le schéma de sortie, et chaque colonne de sortie reçoit la colonne d'entrée de même nom. Aucun calcul, aucune conversion : pour cela, prenez un tMap.
Keeps, removes or reorders the columns of a flow: its schema is the output schema, and each output column gets the input column of the same name. No computation, no conversion: for that, take a tMap.
EntréeInput
Main un fluxone flow
SortieOutput
Main un flux, aux colonnes du schéma du composantone flow, with the columns of the component schema
Déclencheurs en sortieOutput triggers
On Component Ok On Component Error Run if
Contrairement à la plupart des composants de traitement, le tFilterColumns ne reprend pas le schéma du lien entrant : relié, il garde un schéma vide, que vous remplissez avec les colonnes à garder. Unlike most processing components, the tFilterColumns does not take the schema of the incoming link: once connected, it keeps an empty schema, which you fill with the columns to keep.
Le libellé est celui de l'onglet Composant ; le nom technique, en gris, est celui du paramètre dans le fichier du job. Le composant n'a pas d'autre paramètre, ni de paramètres avancés propres. The label is the one of the Component tab; the technical name, in grey, is the parameter name in the job file. The component has no other setting, nor advanced settings of its own.
| ParamètreSetting | DéfautDefault | VisibleShown | Description |
|---|---|---|---|
| SchémaSchemaSCHEMA | videempty | ToujoursAlways |
Les colonnes de sortie, dans leur ordre. Une colonne dont le nom est celui d'une colonne d'entrée, majuscules comprises, en reçoit la valeur ; les autres ne reçoivent rien et gardent la valeur par défaut de Java : null, ou 0 et false pour un nombre ou un booléen non nullable. Une colonne d'entrée absente du schéma est perdue.
The output columns, in their order. A column whose name is the one of an input column, case included, gets its value; the others get nothing and keep the Java default value: null, or 0 and false for a non-nullable number or boolean. An input column missing from the schema is lost.
|
City n'est pas city).
By the exact name only: neither the position, nor the label, nor a resemblance (City is not city).
NB_LINE (Integer, disponible après le composant) : les lignes envoyées en sortie. Elle n'est comptée que s'il y a un lien de sortie : sans lui, elle vaut 0 même si des lignes sont arrivées (exemple). NB_LINE (Integer, available after the component): the rows sent to the output. It is only counted if there is an output link: without it, it is 0 even if rows arrived (example).
((Integer) globalMap.get("tFilterColumns_1_NB_LINE"))
Les jobs ont été exécutés dans Talaxie (Java 21). Un tFixedFlowInput envoie trois lignes au tFilterColumns, suivi d'un tLogRow en mode tableau, qui montre le nom des colonnes de sortie. Un tJava relié par On Subjob Ok affiche tFilterColumns_1_NB_LINE, puis toutes les variables dont le nom commence par tFilterColumns_1. Sorties copiées depuis la console ; dans les erreurs, le nom du job est remplacé par MyJob et le chemin du code est abrégé.
The jobs were run in Talaxie (Java 21). A tFixedFlowInput sends three rows to the tFilterColumns, followed by a tLogRow in table mode, which shows the names of the output columns. A tJava connected with On Subjob Ok prints tFilterColumns_1_NB_LINE, then all the variables whose name starts with tFilterColumns_1. Outputs copied from the console; in the errors, the job name is replaced with MyJob and the code path is shortened.
| idInteger | nameString | cityString | ageInteger |
|---|---|---|---|
| 1 | Ada | London | 36 |
| 2 | Grace | null | 85 |
| 3 | Alan | Manchester | 41 |
Schéma du composant : name (String), id (Integer). city et age disparaissent, name passe en premier. Console complète :
Component schema: name (String), id (Integer). city and age disappear, name comes first. Full console:
.-----+--. |tLogRow_1| |=----+-=| |name |id| |=----+-=| |Ada |1 | |Grace|2 | |Alan |3 | '-----+--' tFilterColumns_1_NB_LINE = 3 Global variables: 1 tFilterColumns_1_NB_LINE = 3
Schéma : name (String), country (String), score (Integer, non nullable), City (String). Seule name existe en entrée. country reste null, score vaut 0, et City, à une majuscule près, reste null : aucun message ne le signale.
Schema: name (String), country (String), score (Integer, not nullable), City (String). Only name exists in input. country stays null, score is 0, and City, one capital letter apart, stays null: no message reports it.
.-----+-------+-----+----. | tLogRow_1 | |=----+-------+-----+---=| |name |country|score|City| |=----+-------+-----+---=| |Ada |null |0 |null| |Grace|null |0 |null| |Alan |null |0 |null| '-----+-------+-----+----' tFilterColumns_1_NB_LINE = 3 Global variables: 1 tFilterColumns_1_NB_LINE = 3
Schéma : id (Integer), age (String) alors que age est un Integer en entrée. Talaxie refuse de lancer le job (interface en anglais) :
Schema: id (Integer), age (String) whereas age is an Integer in input. Talaxie refuses to run the job:
The job failed to compile: C:\…\MyJob.java:1454: error: incompatible types: Integer cannot be converted to String row2.age = row1.age; ^ 1 error
Même chose d'Integer vers Long (id en Long) :
Same thing from Integer to Long (id as Long):
The job failed to compile: C:\…\MyJob.java:1370: error: incompatible types: Integer cannot be converted to Long row2.id = row1.id; ^ 1 error
Pour changer un type, utilisez un tConvertType ou un tMap.
To change a type, use a tConvertType or a tMap.
Le tFilterColumns reçoit les trois lignes, mais n'est relié à rien. Console complète : The tFilterColumns receives the three rows, but is connected to nothing. Full console:
tFilterColumns_1_NB_LINE = 0 Global variables: 1 tFilterColumns_1_NB_LINE = 0
Pour compter les lignes reçues, prenez la variable NB_LINE du composant d'entrée.
To count the rows received, take the NB_LINE variable of the input component.
Une colonne de sortie mal nommée n'est pas une erreur : elle sort vide (null ou 0), comme City dans l'exemple. Copiez les colonnes depuis le schéma d'entrée plutôt que de les retaper.
A wrongly named output column is not an error: it comes out empty (null or 0), like City in the example. Copy the columns from the input schema rather than typing them again.
Une colonne ajoutée, renommée ou retypée plus haut dans le job n'est pas reportée dans le tFilterColumns : une colonne renommée sort vide, une colonne retypée empêche la compilation. Revoyez son schéma après chaque changement en amont. A column added, renamed or retyped higher up in the job is not carried over to the tFilterColumns: a renamed column comes out empty, a retyped column prevents the compilation. Review its schema after each upstream change.
La valeur par défaut d'une colonne du schéma n'est pas utilisée : une colonne nouvelle sort toujours vide. Pour une valeur fixe ou calculée, utilisez un tMap ou un tJavaRow.
The default value of a schema column is not used: a new column always comes out empty. For a fixed or computed value, use a tMap or a tJavaRow.
Toutes les lignes passent. Pour garder certaines lignes, voyez le tFilterRow (conditions) ou le tSampleRow (numéros de ligne). All the rows go through. To keep some rows, see the tFilterRow (conditions) or the tSampleRow (row numbers).
tMap · choisir, calculer et convertir des colonneschoose, compute and convert columnstConvertType · changer le type des colonneschange the type of columnstFilterRow · garder les lignes qui remplissent des conditionskeep the rows that meet conditionstSampleRow · garder des lignes par leur numérokeep rows by their numbertJavaRow · code Java pour chaque ligneJava code for each rowtLogRow · afficher les lignes d'un fluxdisplay the rows of a flow