java-client-api
java-client-api copied to clipboard
facetBy with bucketGroup throws OPTIC-INVALARGS
facetBy works with namedGroup now, but still throws an error with bucketGroup as below
PlanBuilder p = rowMgr.newPlanBuilder();
PlanBuilder.ExportablePlan builtPlan =
p.fromLiterals(numberRows)
.facetBy(
p.bucketGroup(p.xs.string("r"), p.col("r"), p.xs.integerSeq(2,4))
);
The error msg is
Local message: failed to apply resource at rows: Bad Request. Server Message: OPTIC-INVALARGS: fn.error(null, 'OPTIC-INVALARGS', errMsg+arg); -- Invalid arguments: cannot facetBy() with invalid columns: columns() {
return this._keycols;
}
com.marklogic.client.FailedRequestException: Local message: failed to apply resource at rows: Bad Request. Server Message: OPTIC-INVALARGS: fn.error(null, 'OPTIC-INVALARGS', errMsg+arg); -- Invalid arguments: cannot facetBy() with invalid columns: columns() {
return this._keycols;
}
at com.marklogic.client.impl.OkHttpServices.checkStatus(OkHttpServices.java:4474)
at com.marklogic.client.impl.OkHttpServices.postIteratedResourceImpl(OkHttpServices.java:3996)
at com.marklogic.client.impl.OkHttpServices.postIteratedResource(OkHttpServices.java:3956)
at com.marklogic.client.impl.RowManagerImpl.makeRequest(RowManagerImpl.java:355)
at com.marklogic.client.impl.RowManagerImpl.resultRows(RowManagerImpl.java:175)
at com.marklogic.client.impl.RowManagerImpl.resultRows(RowManagerImpl.java:168)
at com.marklogic.client.test.RowManagerTest.testBucketGroup(RowManagerTest.java:1364)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.runTestClass(JUnitTestClassExecutor.java:110)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:58)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecutor.execute(JUnitTestClassExecutor.java:38)
at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:119)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:414)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.lang.Thread.run(Thread.java:748)
So we can address your issue, please include the following:
Version of MarkLogic Java Client API
See Readme.txt
Version of MarkLogic Server
See admin gui on port 8001 or run xdmp:version() in Query Console - port 8000)
Java version
Run java -version
OS and version
For MAC, run sw_vers
.
For Windows, run systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
For Linux, run cat /etc/os-release
and uname -r
Input: Some code to illustrate the problem, preferably in a state that can be independently reproduced on our end
Actual output: What did you observe? What errors did you see? Can you attach the logs? (Java logs, MarkLogic logs)
Expected output: What specifically did you expect to happen?
Alternatives: What else have you tried, actual/expected?
it's not a bug. Need to wrap it inside namedGroupSeq. PlanBuilder.ExportablePlan builtPlan = p.fromLiterals(numberRows) .facetBy(p.namedGroupSeq( p.bucketGroup(p.xs.string("r"), p.col("r"), p.xs.integerSeq(2,4)) ));
@ling, it's surprising to me that the call needs to be wrapped. As I read it:
- bucketGroup() returns a PlanNamedGroup.
- PlanNamedGroup extends PlanNamedGroupSeq.
- So, the return value of bucketGroup() should be a valid argument for facetBy()
What am I missing?
Hi Erik, you are right. I think I shouldn't close this issue. facetBy accepts the return value of bucketGroup and namedGroup, but when this query is sent to the server, we get SJS side error as below. Let me reopen this issue. As we have a workaround by wrapping it up with namedGroupSeq, it's ok for us to push it to the next release, right? Ajit prepares to make the release tomorrow. Do you think we should include this one in this release?
failed to apply resource at rows: Bad Request. Server Message: OPTIC-INVALARGS: fn.error(null, 'OPTIC-INVALARGS', errMsg+arg); -- Invalid arguments: cannot facetBy() with invalid columns: columns() { return this._keycols; }
+1 both that the fix may be on the server side and that the availability of the workaround makes it possible to push this bug.
Tracking this with a PR with an ignored test - https://github.com/marklogic/java-client-api/pull/1464/files
And the underlying bug is referenced in that PR. Closing this as a result. We'll un-ignore the test once the server bug is fixed.