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

UserError Path enters non-object #108

Open
bcdroid opened this issue Mar 31, 2023 · 0 comments
Open

UserError Path enters non-object #108

bcdroid opened this issue Mar 31, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@bcdroid
Copy link

bcdroid commented Mar 31, 2023

Running a nested query with an array of objects nested within an object fails with "Path enters non-object" with dsq 0.23.0. The same query worked with a previous version of dsq, but I do not know the version number.

Query that fails: dsq a.json b.json 'select name from {0, "people"} where id not in (select id from {1})'

a.json

{
   "people": [
    { "name": "p", "id": "1" },
    { "name": "q", "id": "2"}
  ]
}

b.json

[
  {"id": "1"}
]

The error message is:

DSError {
  "name": "UserError",
  "message": "Path enters non-object: people",
  "stack": "goroutine 1 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x65\ngithub.com/multiprocessio/datastation/runner.makeErrUser(...)\n\tgithub.com/multiprocessio/datastation/[email protected]/errors.go:64\ngithub.com/multiprocessio/datastation/runner.shapeAtPath({{0x2a9e0b2, 0x5}, 0x0, 0x0, 0xc000b037d0, 0x0}, {0xc00010e5c1, 0x6})\n\tgithub.com/multiprocessio/datastation/[email protected]/shape.go:489 +0x357\ngithub.com/multiprocessio/datastation/runner.transformDM_getPanelCalls.func1({0xc00010e5ea?, 0x37?})\n\tgithub.com/multiprocessio/datastation/[email protected]/sql.go:174 +0x24c\nregexp.(*Regexp).ReplaceAllStringFunc.func1({0xc000d080c0, 0x37, 0x40}, {0xc0006570c0?, 0x6661fe32a6f5dc03?, 0x0?})\n\tregexp/regexp.go:604 +0x91\nregexp.(*Regexp).replaceAll(0xc000e18c80, {0x0, 0x0, 0x0}, {0xc00010e5a0, 0x59}, 0x2, 0xc000a1e370)\n\tregexp/regexp.go:642 +0x3ee\nregexp.(*Regexp).ReplaceAllStringFunc(0x0?, {0xc00010e5a0?, 0x0?}, 0x0?)\n\tregexp/regexp.go:603 +0x5d\ngithub.com/multiprocessio/datastation/runner.transformDM_getPanelCalls({0xc00010e5a0?, 0x2?}, 0x0?, 0x0?, 0x1, {{0x2fa5408?, 0x0?}, {0x2a9b04a?, 0x0?}}, 0x0)\n\tgithub.com/multiprocessio/datastation/[email protected]/sql.go:127 +0x11c\ngithub.com/multiprocessio/datastation/runner.(*EvalContext).EvalDatabasePanelWithWriter(0xc000a1fad8, 0xc000a1fb58, 0x0, 0xc000a1f398, 0x0?, {0x2c?, 0x0?}, 0xc0005db700)\n\tgithub.com/multiprocessio/datastation/[email protected]/database.go:482 +0x10f4\ngithub.com/multiprocessio/datastation/runner.(*EvalContext).EvalDatabasePanel(0xc000a1fad8, 0xc000a1fb58, 0x24?, 0xc000a1f398, 0xe9ab8f?, {0x10?, 0x0?})\n\tgithub.com/multiprocessio/datastation/[email protected]/database.go:621 +0x1af\nmain.runQuery({0x7ffd1799101d?, 0x0?}, 0xc000a1fb58, 0xc000a1fad8, 0xc0000ba780, {0xc0005db580, 0x2, 0x2a9e90e?}, 0x0?)\n\tgithub.com/multiprocessio/dsq/main.go:250 +0x2e5\nmain._main()\n\tgithub.com/multiprocessio/dsq/main.go:681 +0x1ac5\nmain.main()\n\tgithub.com/multiprocessio/dsq/main.go:685 +0x19\n",
  "targetPanelId": "",
  "extra": null
}
goroutine 1 [running]:
runtime/debug.Stack()
        runtime/debug/stack.go:24 +0x65
github.com/multiprocessio/datastation/runner.makeErrUser(...)
        github.com/multiprocessio/datastation/[email protected]/errors.go:64
github.com/multiprocessio/datastation/runner.shapeAtPath({{0x2a9e0b2, 0x5}, 0x0, 0x0, 0xc000b037d0, 0x0}, {0xc00010e5c1, 0x6})
        github.com/multiprocessio/datastation/[email protected]/shape.go:489 +0x357
github.com/multiprocessio/datastation/runner.transformDM_getPanelCalls.func1({0xc00010e5ea?, 0x37?})
        github.com/multiprocessio/datastation/[email protected]/sql.go:174 +0x24c
regexp.(*Regexp).ReplaceAllStringFunc.func1({0xc000d080c0, 0x37, 0x40}, {0xc0006570c0?, 0x6661fe32a6f5dc03?, 0x0?})
        regexp/regexp.go:604 +0x91
regexp.(*Regexp).replaceAll(0xc000e18c80, {0x0, 0x0, 0x0}, {0xc00010e5a0, 0x59}, 0x2, 0xc000a1e370)
        regexp/regexp.go:642 +0x3ee
regexp.(*Regexp).ReplaceAllStringFunc(0x0?, {0xc00010e5a0?, 0x0?}, 0x0?)
        regexp/regexp.go:603 +0x5d
github.com/multiprocessio/datastation/runner.transformDM_getPanelCalls({0xc00010e5a0?, 0x2?}, 0x0?, 0x0?, 0x1, {{0x2fa5408?, 0x0?}, {0x2a9b04a?, 0x0?}}, 0x0)
        github.com/multiprocessio/datastation/[email protected]/sql.go:127 +0x11c
github.com/multiprocessio/datastation/runner.(*EvalContext).EvalDatabasePanelWithWriter(0xc000a1fad8, 0xc000a1fb58, 0x0, 0xc000a1f398, 0x0?, {0x2c?, 0x0?}, 0xc0005db700)
        github.com/multiprocessio/datastation/[email protected]/database.go:482 +0x10f4
github.com/multiprocessio/datastation/runner.(*EvalContext).EvalDatabasePanel(0xc000a1fad8, 0xc000a1fb58, 0x24?, 0xc000a1f398, 0xe9ab8f?, {0x10?, 0x0?})
        github.com/multiprocessio/datastation/[email protected]/database.go:621 +0x1af
main.runQuery({0x7ffd1799101d?, 0x0?}, 0xc000a1fb58, 0xc000a1fad8, 0xc0000ba780, {0xc0005db580, 0x2, 0x2a9e90e?}, 0x0?)
        github.com/multiprocessio/dsq/main.go:250 +0x2e5
main._main()
        github.com/multiprocessio/dsq/main.go:681 +0x1ac5
main.main()
        github.com/multiprocessio/dsq/main.go:685 +0x19

If the array is extracted from the object, the modified query does succeed.

Query that succeeds: dsq c.json b.json 'select name from {0} where id not in (select id from {1})'

c.json

[
  { "name": "p", "id": "1" },
  { "name": "q", "id": "2"}
]
@bcdroid bcdroid added the bug Something isn't working label Mar 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant