Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ void singleServerLoadTest(DatabaseWrapper.Protocol protocol) throws InterruptedE
// Each thread will create friendships
executor.submit(() -> {
DatabaseWrapper db1 = new DatabaseWrapper(server, idSupplier, protocol);
;
db1.createLike(numOfLike);
db1.close();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ public void createSchema() {

CREATE VERTEX TYPE Photo;
CREATE PROPERTY Photo.id INTEGER;
CREATE PROPERTY Photo.tags LIST OF STRING;
CREATE INDEX ON Photo (id) UNIQUE;
CREATE INDEX ON Photo (tags BY ITEM) NOTUNIQUE;

CREATE EDGE TYPE HasUploaded;

Expand Down Expand Up @@ -192,17 +194,19 @@ private void addPhotosOfUser(int userId, int numberOfPhotos) {
for (int i = 0; i < numberOfPhotos; i++) {
int photoId = idSupplier.get();
String photoName = String.format("download-%s.jpg", photoId);
String tag1 = "tag" + i % numberOfPhotos;
String tag2 = "tag" + (i % numberOfPhotos + 1);
String sqlScript = """
BEGIN;
LOCK TYPE User, Photo, HasUploaded;
LET photo = CREATE VERTEX Photo SET id = ?, name = ?;
LET photo = CREATE VERTEX Photo SET id = ?, name = ?, tags = ['?', '?'];
LET user = SELECT FROM User WHERE id = ?;
CREATE EDGE HasUploaded FROM $user TO $photo;
COMMIT RETRY 30;
""";
try {
photosTimer.record(() -> {
db.command("sqlscript", sqlScript, photoId, photoName, userId);
db.command("sqlscript", sqlScript, photoId, photoName, userId, tag1, tag2);
}
);

Expand Down
3 changes: 2 additions & 1 deletion e2e/src/test/java/com/arcadedb/e2e/JdbcQueriesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ void createSchemaWithSqlScript() throws SQLException {
CREATE PROPERTY article.comment IF NOT EXISTS LIST OF comment;
CREATE PROPERTY article.location IF NOT EXISTS EMBEDDED OF location;

CREATE INDEX IF NOT EXISTS on article(id) UNIQUE;
CREATE INDEX IF NOT EXISTS on article (id) UNIQUE;
CREATE INDEX IF NOT EXISTS on article (tags BY ITEM) NOTUNIQUE;
""");

st.execute("""
Expand Down
21 changes: 7 additions & 14 deletions e2e/src/test/java/com/arcadedb/e2e/RemoteGrpcDatabaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@
public class RemoteGrpcDatabaseTest extends ArcadeContainerTemplate {

private RemoteGrpcDatabase database;
private RemoteGrpcServer server;

@BeforeEach
void setUp() {

server = new RemoteGrpcServer(host, grpcPort, "root", "playwithdata", true, List.of());
RemoteGrpcServer server = new RemoteGrpcServer(host, grpcPort, "root", "playwithdata", true, List.of());
database = new RemoteGrpcDatabase(server, host, grpcPort, httpPort, "beer", "root", "playwithdata");
// ENLARGE THE TIMEOUT TO PASS THESE TESTS ON CI (GITHUB ACTIONS)
database.setTimeout(60_000);
Expand All @@ -53,27 +52,21 @@ void tearDown() {

@Test
void simpleSQLQuery() {
database.transaction(() -> {
final ResultSet result = database.query("SQL", "select * from Beer limit 10");
assertThat(CollectionUtils.countEntries(result)).isEqualTo(10);
}, true, 10);
final ResultSet result = database.query("SQL", "select * from Beer limit 10");
assertThat(CollectionUtils.countEntries(result)).isEqualTo(10);
}

@Test
@Disabled("Gremlin not supported yet")
void simpleGremlinQuery() {
database.transaction(() -> {
final ResultSet result = database.query("gremlin", "g.V().limit(10)");
assertThat(CollectionUtils.countEntries(result)).isEqualTo(10);
}, false, 10);
final ResultSet result = database.query("gremlin", "g.V().limit(10)");
assertThat(CollectionUtils.countEntries(result)).isEqualTo(10);
}

@Test
@Disabled("Cypher not supported yet")
void simpleCypherQuery() {
database.transaction(() -> {
final ResultSet result = database.query("cypher", "MATCH(p:Beer) RETURN * LIMIT 10");
assertThat(CollectionUtils.countEntries(result)).isEqualTo(10);
}, false, 10);
final ResultSet result = database.query("cypher", "MATCH(p:Beer) RETURN * LIMIT 10");
assertThat(CollectionUtils.countEntries(result)).isEqualTo(10);
}
}
7 changes: 7 additions & 0 deletions engine/src/main/grammar/SQLGrammar.jjt
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ TOKEN :
| <CONTAINSTEXT: ("C"|"c")("O"|"o")("N"|"n")("T"|"t")("A"|"a")("I"|"i")("N"|"n")("S"|"s")("T"|"t")("E"|"e")("X"|"x")("T"|"t") >
| <MATCHES: ("M"|"m")("A"|"a")("T"|"t")("C"|"c")("H"|"h")("E"|"e")("S"|"s") >
| <KEY: ("K"|"k")("E"|"e")("Y"|"y") >
| <ITEM: ("I"|"i")("T"|"t")("E"|"e")("M"|"m") >
| <INSTANCEOF: ("I"|"i")("N"|"n")("S"|"s")("T"|"t")("A"|"a")("N"|"n")("C"|"c")("E"|"e")("O"|"o")("F"|"f") >
}

Expand Down Expand Up @@ -500,6 +501,7 @@ Rid Rid():
{ return jjtThis; }
}


BucketIdentifier BucketIdentifier():
{}
{
Expand Down Expand Up @@ -589,6 +591,7 @@ Identifier Identifier():
| token = <MERGE>
| token = <CONTENT>
| token = <KEY>
| token = <ITEM>
| token = <OF>
| token = <OFFSET>
| token = <VALUE>
Expand Down Expand Up @@ -3566,6 +3569,8 @@ CreateIndexStatement CreateIndexStatement():
<KEY> { lastProperty.byKey = true; }
|
<VALUE> { lastProperty.byValue = true; }
|
<ITEM> { lastProperty.byItem = true; }
)
]
(
Expand All @@ -3589,6 +3594,8 @@ CreateIndexStatement CreateIndexStatement():
<KEY> { lastProperty.byKey = true; }
|
<VALUE> { lastProperty.byValue = true; }
|
<ITEM> { lastProperty.byItem = true; }
)
]
)*
Expand Down
Loading
Loading