Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TigerGraph implementation #37

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<module>tugraph</module>
<module>galaxybase-cypher</module>
<module>ultipa</module>
<module>tigergraph</module>
<!-- <module>neo4j</module>-->
</modules>

Expand Down
92 changes: 92 additions & 0 deletions tigergraph/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# TigerGraph LDBC Financial Implemention

- [1. Preparation](#1-preparation)
- [1.1 Install TigerGraph](#11-install-tigergraph)
- [1.2 Download & Install Dependencies](#12-download--install-dependencies)
- [2. DDL & Loading & Queries](#2-ddl--loading--queries)
- [2.1 Create schema and loading job](#21-create-schema-and-loading-job)
- [2.2 Load data](#22-load-data)
- [2.2.1 Data directory structure](#221-data-directory-structure)
- [2.2.2 Data Loading](#222-data-loading)
- [2.3 Create and install queries](#23-create-and-install-queries)
- [2.4 One-step setup](#24-one-step-setup)
- [3. Validate](#3-validate)
- [3.1 Create validation](#31-create-validation)
- [3.2 Validate](#32-validate)

---

## 1. Preparation

Before using the project, follow these steps to prepare your environment.

### 1.1 Install TigerGraph

For detailed installation instructions, please refer to the official documentation: [TigerGraph Getting Started Guide](https://docs.tigergraph.com/tigergraph-server/current/getting-started/linux)

### 1.2 Download & Install Dependencies

To install the project dependencies, perform the following actions:

```bash
cd ~
git clone https://github.com/ldbc/ldbc_finbench_transaction_impls.git
cd ~/ldbc_finbench_transaction_impls
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should cd to tigergraph directory

mvn clean package
```

## 2. DDL & Loading & Queries
Ensure that you have already installed TigerGraph and authenticated as a user with the necessary privileges to run TigerGraph.
### 2.1 Create schema and loading job
```bash
bash ~/ldbc_finbench_transaction_impls/tigergraph/scripts/setup_schema.sh
```

### 2.2 load data
#### 2.2.1 Data directory structure
```bash
$ tree -L 2 ~/ldbc_finbench_transaction_impls/tigergraph/data
├── sf1
│ ├── deletes
│ ├── incremental
│ ├── inserts
│ ├── raw
│ ├── read_params
│ └── snapshot
└── sf10
├── incremental
├── raw
├── read_params
└── snapshot
...
```

#### 2.2.2 Data Loading
```bash
bash ~/ldbc_finbench_transaction_impls/tigergraph/scripts/load_data.sh
```

### 2.3 Create and install queries
```bash
bash ~/ldbc_finbench_transaction_impls/tigergraph/scripts/create_queries.sh
bash ~/ldbc_finbench_transaction_impls/tigergraph/scripts/install_queries.sh
```

### 2.4 one-step setup
If you prefer to avoid separately performing steps 2.1, 2.2, and 2.3, you can use the convenient ```one_step_env.sh``` script, which automates the setup process of creating schemas, loading data, and preparing queries.
```bash
bash ~/ldbc_finbench_transaction_impls/tigergraph/scripts/one_step_env.sh
```

## 3. Validate
### 3.1 Create validation
```shell
cd ~/ldbc_finbench_transaction_impls/tigergraph
bash run.sh create_validation.properties
```

### 3.2 Validate
```shell
cd ~/ldbc_finbench_transaction_impls/tigergraph
bash run.sh validate_database.properties
```
94 changes: 94 additions & 0 deletions tigergraph/benchmark.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
############################################################
# SUT defined configurations #
############################################################
ipAddr=34.41.176.245
port=14240
user=tigergraph
pass=tigergraph
graph=ldbc_fin
maxPoolSize=160

############################################################
# Driver configurations #
############################################################
status=1
thread_count=16
name=LDBC-FinBench
# Modes available: 1.CREATE_VALIDATION 2.VALIDATE_DATABASE 3.EXECUTE_BENCHMARK
mode=EXECUTE_BENCHMARK
results_log=true
time_unit=MICROSECONDS
time_compression_ratio=0.1
peer_identifiers=
workload_statistics=false
spinner_wait_duration=1
help=false
ignore_scheduled_start_times=false
workload=org.ldbcouncil.finbench.driver.workloads.transaction.LdbcFinBenchTransactionWorkload
db=org.ldbcouncil.finbench.impls.tigergraph.TigerGraphTransactionDb
operation_count=1000000
validation_parameters_size=1000
validate_workload=true
validate_database=validation_params.csv
warmup=1000
ldbc.finbench.transaction.queries.parameters_dir=data/sf10/read_params
ldbc.finbench.transaction.queries.updates_dir=data/sf10/incremental
# param and update files suffix, `csv` or `parquet`, default is `csv`
ldbc.finbench.transaction.queries.files_suffix=csv
ldbc.finbench.transaction.queries.simple_read_dissipation=0.2
ldbc.finbench.transaction.queries.update_interleave=500
ldbc.finbench.transaction.queries.scale_factor=1
# Frequency of complex read queries
ldbc.finbench.transaction.queries.ComplexRead1_freq=10
ldbc.finbench.transaction.queries.ComplexRead2_freq=45
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep the parameters same here

ldbc.finbench.transaction.queries.ComplexRead3_freq=23
ldbc.finbench.transaction.queries.ComplexRead4_freq=57
ldbc.finbench.transaction.queries.ComplexRead5_freq=83
ldbc.finbench.transaction.queries.ComplexRead6_freq=21
ldbc.finbench.transaction.queries.ComplexRead7_freq=36
ldbc.finbench.transaction.queries.ComplexRead8_freq=51
ldbc.finbench.transaction.queries.ComplexRead9_freq=21
ldbc.finbench.transaction.queries.ComplexRead10_freq=6
ldbc.finbench.transaction.queries.ComplexRead11_freq=12
ldbc.finbench.transaction.queries.ComplexRead12_freq=34
# For debugging purposes
ldbc.finbench.transaction.queries.ComplexRead1_enable=true
ldbc.finbench.transaction.queries.ComplexRead2_enable=true
ldbc.finbench.transaction.queries.ComplexRead3_enable=true
ldbc.finbench.transaction.queries.ComplexRead4_enable=true
ldbc.finbench.transaction.queries.ComplexRead5_enable=true
ldbc.finbench.transaction.queries.ComplexRead6_enable=true
ldbc.finbench.transaction.queries.ComplexRead7_enable=true
ldbc.finbench.transaction.queries.ComplexRead8_enable=true
ldbc.finbench.transaction.queries.ComplexRead9_enable=true
ldbc.finbench.transaction.queries.ComplexRead10_enable=true
ldbc.finbench.transaction.queries.ComplexRead11_enable=true
ldbc.finbench.transaction.queries.ComplexRead12_enable=true
ldbc.finbench.transaction.queries.SimpleRead1_enable=true
ldbc.finbench.transaction.queries.SimpleRead2_enable=true
ldbc.finbench.transaction.queries.SimpleRead3_enable=true
ldbc.finbench.transaction.queries.SimpleRead4_enable=true
ldbc.finbench.transaction.queries.SimpleRead5_enable=true
ldbc.finbench.transaction.queries.SimpleRead6_enable=true
ldbc.finbench.transaction.queries.Write1_enable=true
ldbc.finbench.transaction.queries.Write2_enable=true
ldbc.finbench.transaction.queries.Write3_enable=true
ldbc.finbench.transaction.queries.Write4_enable=true
ldbc.finbench.transaction.queries.Write5_enable=true
ldbc.finbench.transaction.queries.Write6_enable=true
ldbc.finbench.transaction.queries.Write7_enable=true
ldbc.finbench.transaction.queries.Write8_enable=true
ldbc.finbench.transaction.queries.Write9_enable=true
ldbc.finbench.transaction.queries.Write10_enable=true
ldbc.finbench.transaction.queries.Write11_enable=true
ldbc.finbench.transaction.queries.Write12_enable=true
ldbc.finbench.transaction.queries.Write13_enable=true
ldbc.finbench.transaction.queries.Write14_enable=true
ldbc.finbench.transaction.queries.Write15_enable=true
ldbc.finbench.transaction.queries.Write16_enable=true
ldbc.finbench.transaction.queries.Write17_enable=true
ldbc.finbench.transaction.queries.Write18_enable=true
ldbc.finbench.transaction.queries.Write19_enable=true
ldbc.finbench.transaction.queries.ReadWrite1_enable=true
ldbc.finbench.transaction.queries.ReadWrite2_enable=true
ldbc.finbench.transaction.queries.ReadWrite3_enable=true
94 changes: 94 additions & 0 deletions tigergraph/create_validation.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
############################################################
# SUT defined configurations #
############################################################
ipAddr=34.41.176.245
port=14240
user=tigergraph
pass=tigergraph
graph=ldbc_fin
maxPoolSize=160

############################################################
# Driver configurations #
############################################################
status=1
thread_count=16
name=LDBC-FinBench
# Modes available: 1.CREATE_VALIDATION 2.VALIDATE_DATABASE 3.EXECUTE_BENCHMARK
mode=CREATE_VALIDATION
results_log=false
time_unit=MICROSECONDS
time_compression_ratio=0.001
peer_identifiers=
workload_statistics=false
spinner_wait_duration=1
help=false
ignore_scheduled_start_times=false
workload=org.ldbcouncil.finbench.driver.workloads.transaction.LdbcFinBenchTransactionWorkload
db=org.ldbcouncil.finbench.impls.tigergraph.TigerGraphTransactionDb
operation_count=1000000
validation_parameters_size=1000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep the parameters same here

validate_workload=true
validate_database=validation_params.csv
warmup=0
ldbc.finbench.transaction.queries.parameters_dir=data/sf1/read_params
ldbc.finbench.transaction.queries.updates_dir=data/sf1/incremental
# param and update files suffix, `csv` or `parquet`, default is `csv`
ldbc.finbench.transaction.queries.files_suffix=csv
ldbc.finbench.transaction.queries.simple_read_dissipation=0.2
ldbc.finbench.transaction.queries.update_interleave=2147483647
ldbc.finbench.transaction.queries.scale_factor=1
# Frequency of complex read queries
ldbc.finbench.transaction.queries.ComplexRead1_freq=1
ldbc.finbench.transaction.queries.ComplexRead2_freq=1
ldbc.finbench.transaction.queries.ComplexRead3_freq=1
ldbc.finbench.transaction.queries.ComplexRead4_freq=1
ldbc.finbench.transaction.queries.ComplexRead5_freq=1
ldbc.finbench.transaction.queries.ComplexRead6_freq=1
ldbc.finbench.transaction.queries.ComplexRead7_freq=1
ldbc.finbench.transaction.queries.ComplexRead8_freq=1
ldbc.finbench.transaction.queries.ComplexRead9_freq=1
ldbc.finbench.transaction.queries.ComplexRead10_freq=1
ldbc.finbench.transaction.queries.ComplexRead11_freq=1
ldbc.finbench.transaction.queries.ComplexRead12_freq=1
# For debugging purposes
ldbc.finbench.transaction.queries.ComplexRead1_enable=true
ldbc.finbench.transaction.queries.ComplexRead2_enable=true
ldbc.finbench.transaction.queries.ComplexRead3_enable=true
ldbc.finbench.transaction.queries.ComplexRead4_enable=true
ldbc.finbench.transaction.queries.ComplexRead5_enable=true
ldbc.finbench.transaction.queries.ComplexRead6_enable=true
ldbc.finbench.transaction.queries.ComplexRead7_enable=true
ldbc.finbench.transaction.queries.ComplexRead8_enable=true
ldbc.finbench.transaction.queries.ComplexRead9_enable=true
ldbc.finbench.transaction.queries.ComplexRead10_enable=true
ldbc.finbench.transaction.queries.ComplexRead11_enable=true
ldbc.finbench.transaction.queries.ComplexRead12_enable=true
ldbc.finbench.transaction.queries.SimpleRead1_enable=true
ldbc.finbench.transaction.queries.SimpleRead2_enable=true
ldbc.finbench.transaction.queries.SimpleRead3_enable=true
ldbc.finbench.transaction.queries.SimpleRead4_enable=true
ldbc.finbench.transaction.queries.SimpleRead5_enable=true
ldbc.finbench.transaction.queries.SimpleRead6_enable=true
ldbc.finbench.transaction.queries.Write1_enable=true
ldbc.finbench.transaction.queries.Write2_enable=true
ldbc.finbench.transaction.queries.Write3_enable=true
ldbc.finbench.transaction.queries.Write4_enable=true
ldbc.finbench.transaction.queries.Write5_enable=true
ldbc.finbench.transaction.queries.Write6_enable=true
ldbc.finbench.transaction.queries.Write7_enable=true
ldbc.finbench.transaction.queries.Write8_enable=true
ldbc.finbench.transaction.queries.Write9_enable=true
ldbc.finbench.transaction.queries.Write10_enable=true
ldbc.finbench.transaction.queries.Write11_enable=true
ldbc.finbench.transaction.queries.Write12_enable=true
ldbc.finbench.transaction.queries.Write13_enable=true
ldbc.finbench.transaction.queries.Write14_enable=true
ldbc.finbench.transaction.queries.Write15_enable=true
ldbc.finbench.transaction.queries.Write16_enable=true
ldbc.finbench.transaction.queries.Write17_enable=true
ldbc.finbench.transaction.queries.Write18_enable=true
ldbc.finbench.transaction.queries.Write19_enable=true
ldbc.finbench.transaction.queries.ReadWrite1_enable=true
ldbc.finbench.transaction.queries.ReadWrite2_enable=true
ldbc.finbench.transaction.queries.ReadWrite3_enable=true
56 changes: 56 additions & 0 deletions tigergraph/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<artifactId>impls</artifactId>
<groupId>org.ldbcouncil.finbench</groupId>
<version>0.1.0-alpha</version>
</parent>

<artifactId>tigergraph</artifactId>
<name>tigergraph</name>
<version>0.1.0-alpha</version>
<description>A tigergraph implementation to help debug queries</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>com.tigergraph</groupId>
<artifactId>tigergraph-jdbc-driver</artifactId>
<version>1.3.9</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.4.2</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<configuration>
<!-- put your configurations here -->
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
46 changes: 46 additions & 0 deletions tigergraph/queries/tcr1.gsql
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
USE GRAPH ldbc_fin
CREATE or REPLACE QUERY tcr1(
VERTEX<Account> id,
UINT startTime,
UINT endTime,
INT truncationLimit,
STRING truncationOrder
) FOR GRAPH ldbc_fin syntax v1{
TYPEDEF TUPLE <UINT otherId, INT accountDistance, UINT mediumId, STRING mediumType> RESULT;
SetAccum<RESULT> @result_set;
HeapAccum<RESULT>(accountDistance ASC, otherId ASC, mediumId ASC) @@result;

ArrayAccum<MinAccum<UINT>> @min_times[4];

StepNodes = {id};

TMP = SELECT s from StepNodes:s POST-ACCUM s.@min_times[0] += 0;

INT i = 1;

WHILE StepNodes.size() > 0 and i <= 3 DO
StepNodes =
SELECT t
FROM StepNodes:s - (transfer:e) -> Account:t
WHERE e.timestamp > startTime and e.timestamp < endTime
and e.timestamp > s.@min_times[i-1]
ACCUM t.@min_times[i] += e.timestamp;

R =
SELECT t
FROM StepNodes:s - (signIn_REVERSE:e) -> Medium:t
WHERE e.timestamp > startTime and e.timestamp < endTime and t.isBlocked == true
ACCUM s.@result_set += RESULT(s.id, i, t.id, t.mediumType)
POST-ACCUM
FOREACH result in s.@result_set DO
@@result += result
END,
s.@result_set.clear()
;

i = i + 1;

END;

PRINT @@result;
}
Loading