Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/embedded
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Zdybał committed Jul 11, 2017
2 parents a8b69e3 + 8ecb978 commit 2ecae7e
Show file tree
Hide file tree
Showing 24 changed files with 380 additions and 276 deletions.
2 changes: 1 addition & 1 deletion client/mutations.go
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ func (d *Dgraph) NodeXid(xid string, storeXid bool) (Node, error) {
}
n := Node{uid: uid}
if storeXid && isNew {
e := n.Edge("_xid_")
e := n.Edge("xid")
x.Check(e.SetValueString(xid))
d.BatchSet(e)
}
Expand Down
14 changes: 13 additions & 1 deletion cmd/dgraphloader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ import (
"google.golang.org/grpc/credentials"

"github.com/dgraph-io/dgraph/client"
"github.com/dgraph-io/dgraph/protos"
"github.com/dgraph-io/dgraph/rdf"
"github.com/dgraph-io/dgraph/schema"
"github.com/dgraph-io/dgraph/types"
"github.com/dgraph-io/dgraph/x"

"github.com/pkg/profile"
Expand All @@ -40,7 +42,7 @@ var (
dgraph = flag.String("d", "127.0.0.1:9080", "Dgraph gRPC server address")
concurrent = flag.Int("c", 100, "Number of concurrent requests to make to Dgraph")
numRdf = flag.Int("m", 1000, "Number of RDF N-Quads to send as part of a mutation.")
storeXid = flag.Bool("x", false, "Store xids by adding corresponding _xid_ edges")
storeXid = flag.Bool("x", false, "Store xids by adding corresponding xid edges")
mode = flag.String("profile.mode", "", "enable profiling mode, one of [cpu, mem, mutex, block]")
clientDir = flag.String("cd", "c", "Directory to store xid to uid mapping")
blockRate = flag.Int("block", 0, "Block profiling rate")
Expand Down Expand Up @@ -242,6 +244,16 @@ func main() {

filesList := strings.Split(*files, ",")
x.AssertTrue(len(filesList) > 0)
if *storeXid {
if err := dgraphClient.AddSchema(protos.SchemaUpdate{
Predicate: "xid",
ValueType: uint32(types.StringID),
Tokenizer: []string{"hash"},
Directive: protos.SchemaUpdate_INDEX,
}); err != nil {
log.Fatal("While adding schema to batch ", err)
}
}
if len(*schemaFile) > 0 {
processSchemaFile(*schemaFile, dgraphClient)
}
Expand Down
2 changes: 1 addition & 1 deletion contrib/freebase/spielberg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
func TestSpielberg(t *testing.T) {
q := `
{
me(func:eq(_xid_,"m.06pj8")) {
me(func:eq(xid,"m.06pj8")) {
name@en
director.film (first: 4, orderasc: initial_release_date) {
name@en
Expand Down
2 changes: 1 addition & 1 deletion contrib/indextest/allof_the.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
me(func:eq(_xid_,"m.07mv_h")) {
me(func:eq(xid,"m.07mv_h")) {
director.film {
directed_by {
director.film @filter(allofterms(name, "the")) {
Expand Down
2 changes: 1 addition & 1 deletion contrib/indextest/allof_the_a.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
me(func:eq(_xid_,"m.07mv_h")) {
me(func:eq(xid,"m.07mv_h")) {
director.film {
directed_by {
director.film @filter(allofterms(name, "the") and allofterms(name, "a")) {
Expand Down
2 changes: 1 addition & 1 deletion contrib/indextest/allof_the_first.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
me(func:eq(_xid_,"m.07mv_h")) {
me(func:eq(xid,"m.07mv_h")) {
director.film {
directed_by {
director.film(first: 10) @filter(allofterms(name, "the")) {
Expand Down
2 changes: 1 addition & 1 deletion contrib/indextest/basic.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
me(func:eq(_xid_,"m.07mv_h")) {
me(func:eq(xid,"m.07mv_h")) {
director.film {
directed_by {
director.film {
Expand Down
2 changes: 1 addition & 1 deletion contrib/indextest/releasedate.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
me(func:eq(_xid_,"m.07mv_h")) {
me(func:eq(xid,"m.07mv_h")) {
director.film {
directed_by {
director.film {
Expand Down
2 changes: 1 addition & 1 deletion contrib/indextest/releasedate_geq.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
me(func:eq(_xid_,"m.07mv_h")) {
me(func:eq(xid,"m.07mv_h")) {
director.film {
directed_by {
director.film @filter(ge(initial_release_date, "2000-01-05")) {
Expand Down
2 changes: 1 addition & 1 deletion contrib/indextest/releasedate_sort.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
me(func:eq(_xid_,"m.07mv_h")) {
me(func:eq(xid,"m.07mv_h")) {
director.film {
directed_by {
director.film(orderasc: initial_release_date) {
Expand Down
2 changes: 1 addition & 1 deletion contrib/indextest/releasedate_sort_first_offset.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
me(func:eq(_xid_,"m.07mv_h")) {
me(func:eq(xid,"m.07mv_h")) {
director.film {
directed_by {
director.film(orderasc: initial_release_date, first: 5, offset: 10) {
Expand Down
6 changes: 3 additions & 3 deletions gql/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,11 @@ func Parse(r Request) (res Result, rerr error) {
return res, err
}

l := lex.Lexer{Input: query}
l.Run(lexTopLevel)
lexer := lex.Lexer{Input: query}
lexer.Run(lexTopLevel)

var qu *GraphQuery
it := l.NewIterator()
it := lexer.NewIterator()
fmap := make(fragmentMap)
for it.Next() {
item := it.Item()
Expand Down
42 changes: 22 additions & 20 deletions rdf/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,24 +321,26 @@ func isNewline(r rune) bool {
}

var typeMap = map[string]types.TypeID{
"xs:string": types.StringID,
"xs:date": types.DateTimeID,
"xs:dateTime": types.DateTimeID,
"xs:int": types.IntID,
"xs:boolean": types.BoolID,
"xs:double": types.FloatID,
"xs:float": types.FloatID,
"xs:base64Binary": types.BinaryID,
"geo:geojson": types.GeoID,
"pwd:password": types.PasswordID,
"http://www.w3.org/2001/XMLSchema#string": types.StringID,
"http://www.w3.org/2001/XMLSchema#dateTime": types.DateTimeID,
"http://www.w3.org/2001/XMLSchema#date": types.DateTimeID,
"http://www.w3.org/2001/XMLSchema#int": types.IntID,
"http://www.w3.org/2001/XMLSchema#integer": types.IntID,
"http://www.w3.org/2001/XMLSchema#boolean": types.BoolID,
"http://www.w3.org/2001/XMLSchema#double": types.FloatID,
"http://www.w3.org/2001/XMLSchema#float": types.FloatID,
"http://www.w3.org/2001/XMLSchema#gYear": types.DateTimeID,
"http://www.w3.org/2001/XMLSchema#gYearMonth": types.DateTimeID,
"xs:string": types.StringID,
"xs:date": types.DateTimeID,
"xs:dateTime": types.DateTimeID,
"xs:int": types.IntID,
"xs:positiveInteger": types.IntID,
"xs:boolean": types.BoolID,
"xs:double": types.FloatID,
"xs:float": types.FloatID,
"xs:base64Binary": types.BinaryID,
"geo:geojson": types.GeoID,
"pwd:password": types.PasswordID,
"http://www.w3.org/2001/XMLSchema#string": types.StringID,
"http://www.w3.org/2001/XMLSchema#dateTime": types.DateTimeID,
"http://www.w3.org/2001/XMLSchema#date": types.DateTimeID,
"http://www.w3.org/2001/XMLSchema#int": types.IntID,
"http://www.w3.org/2001/XMLSchema#positiveInteger": types.IntID,
"http://www.w3.org/2001/XMLSchema#integer": types.IntID,
"http://www.w3.org/2001/XMLSchema#boolean": types.BoolID,
"http://www.w3.org/2001/XMLSchema#double": types.FloatID,
"http://www.w3.org/2001/XMLSchema#float": types.FloatID,
"http://www.w3.org/2001/XMLSchema#gYear": types.DateTimeID,
"http://www.w3.org/2001/XMLSchema#gYearMonth": types.DateTimeID,
}
6 changes: 3 additions & 3 deletions worker/assign.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ func AssignUidsOverNetwork(ctx context.Context, num *protos.Num) (*protos.Assign
if tr, ok := trace.FromContext(ctx); ok {
tr.LazyPrintf("Not leader of group: %d. Sending to: %d", leaseGid, lid)
}
p := pools().get(addr)
conn, err := p.Get()
p, err := pools().get(addr)
if err != nil {
if tr, ok := trace.FromContext(ctx); ok {
tr.LazyPrintf("Error while retrieving connection: %+v", err)
}
return &emptyAssignedIds, err
}
defer p.Put(conn)
defer pools().release(p)
conn := p.Get()
if tr, ok := trace.FromContext(ctx); ok {
tr.LazyPrintf("Calling AssignUids for group: %d, addr: %s", leaseGid, addr)
}
Expand Down
Loading

0 comments on commit 2ecae7e

Please sign in to comment.