Nous avons créé deux ensemble de données phraseDataFrame, phraseDataFrame2 où search replace doit se produire. PhraseDataFrame2 stocke les termes de recherche et de remplacement.Rechercher et remplacer dans Apache Spark
Nous avons également effectué tous les 11 types de jointure «interne», «externe», «complet», «fullouter», «leftouter», «gauche», «rightouter», «droite», «leftsemi», «leftanti» ',' croiser 'aucun d'entre eux nous a donné le résultat.
Pouvez-vous s'il vous plaît laissez-nous savoir Où nous allons mal et veuillez nous diriger dans la bonne direction.
List<Row> data = Arrays.asList(
RowFactory.create(0, "Allen jeevi pramod Allen"),
RowFactory.create(1,"sandesh Armstrong jeevi"),
RowFactory.create(2,"harsha Nischay DeWALT"));
StructType schema = new StructType(new StructField[] {
new StructField("label", DataTypes.IntegerType, false,
Metadata.empty()),
new StructField("sentence", DataTypes.StringType, false,
Metadata.empty()) });
Dataset<Row> sentenceDataFrame = spark.createDataFrame(data, schema);
List<Row> data2 = Arrays.asList(
RowFactory.create("Allen", "Apex Tool Group"),
RowFactory.create("Armstrong","Apex Tool Group"),
RowFactory.create("DeWALT","StanleyBlack"));
StructType schema2 = new StructType(new StructField[] {
new StructField("label2", DataTypes.StringType, false,
Metadata.empty()),
new StructField("sentence2", DataTypes.StringType, false,
Metadata.empty()) });
Dataset<Row> sentenceDataFrame2 = spark.createDataFrame(data2, schema2);
Dataset<Row> remainingElements=sentenceDataFrame.join(sentenceDataFrame2,sentenceDataFrame.col("label").equalTo(sentenceDataFrame2.col("label2")),"cross");
System.out.println("Left anti join count :"+remainingElements.count());
Entrée
Allen de Pramod Allen
Sandesh Armstrong
Harsha Nischay DeWALT
attendu Sortie
Apex Tool Group Jivi Pramod Tool Group Apex
Sandesh Apex Tool Group Jivi
Harsha Nischay StanleyBlack
Merci @Ivan Gozali cela a fonctionné parfaitement. – Nischay