Comments (1)
Solution
val source: (Seq[String], Seq[String]) = (Seq("uid"), Seq("unix_timestamp_s") )
val target: (Seq[String], Seq[String]) = (Seq("vid"), Seq("unix_timestamp_s"))
val mergeStatement = s"""
UNWIND {rows} as row
MERGE (source:ID {id : row.srcid.`${source._1.head}`})
SET source.timestamp = row.srctmp.`${source._2.head}`, source.type= 'abc'
MERGE (target:ID {id : row.trgid.`${target._1.head}`})
SET target.timestamp = row.trgtmp.`${target._2.head}`, target.type= 'xyz'
MERGE (source)-[:HasConnection]-(target)
"""
df.repartition($"component").foreachPartition( rows => {
val params: AnyRef = rows.map(r =>
Map(
"srcid" -> source._1.map( c => (c, r.getAs[AnyRef](c))).toMap.asJava,
"srctmp" -> source._2.map( c => (c, r.getAs[AnyRef](c))).toMap.asJava,
"trgid" -> target._1.map( c => (c, r.getAs[AnyRef](c))).toMap.asJava,
"trgtmp" -> target._2.map( c => (c, r.getAs[AnyRef](c))).toMap.asJava
)
.asJava).asJava
execute(config, mergeStatement, Map("rows" -> params).asJava)
})
from neo4j-spark-connector.
Related Issues (20)
- Issue : When updating node data via the Spark Connector HOT 2
- java.lang.LinkageError - Spark 3.1.2 neo4j - 4.1.0_for_spark_3 HOT 1
- IllegalArgumentException: Please provide a valid READ query
- Write example should be completed
- Code examples to use both Scala and Python HOT 1
- Update Spark v5 documentation for Neo4j v5 HOT 2
- can't acquire ExclusiveLock HOT 3
- very slow writing of data HOT 3
- Upgrade Cypher DSL to the latest version that supports a JDK 8 baseline HOT 1
- spark version validation fails on EMR / EMR Serverless HOT 1
- Not able to Insert Neo4j Map Data type using the neo4j-spark connector
- First-class support to GDS
- Project build fails after SBT upgrade to 1.9.0, but works for 1.8.3 HOT 1
- Support for pushdown limit
- Add example notebooks
- Transaction Retries using pyspark HOT 1
- Problem with datetime properties with null values HOT 1
- 5.2.0 missing from maven? HOT 2
- Neo4j connector is currently unusable to write data from Databricks with Unity Catalog enabled HOT 2
- Streaming reads: offsets are not loaded from checkpoint when restarting a stream after failure. HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neo4j-spark-connector.