org.apache.spark.SparkException: Task failed while writing rows

Stack Overflow | Legolas | 6 months ago
  1. 0

    GitHub comment 220#164967695

    GitHub | 1 year ago | amitmawkin
    org.springframework.data.mongodb.UncategorizedMongoDbException: Query failed with error code 17287 and error message 'Can't canonicalize query: BadValue unknown top level operator: $query' on server ccloud-tomcat04200.kdc.capitalone.com:11500; nested exception is com.mongodb.MongoQueryException: Query failed with error code 17287 and error message 'Can't canonicalize query: BadValue unknown top level operator: $query' on server ccloud-tomcat04200.kdc.capitalone.com:11500
  2. 0

    com.mongodb.MongoQueryException: Query failed with error code 2 and error message 'bad sort specification'

    Google Groups | 5 months ago | srinivas seema
    com.mongodb.MongoQueryException: Query failed with error code 2 and error message 'bad sort specification' on server localhost:27017]
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    An object is annotated with {{@Document}} and {{@TextIndexed}} on several fields. The text index is created on the collection the right way. I assume it's done when the object is accessed the first time. However if the collection (or the database) is dropped, while the context is in place, the object is recreated but without the index. Consider the following code: {code:java} mongoTemplate.save(new ObjectSource()); mongoTemplate.find(new Query(new TextCriteria().matching("bla")), ObjectSource.class); mongoTemplate.dropCollection(ObjectSource.class); mongoTemplate.save(new ObjectSource()); mongoTemplate.find(new Query(new TextCriteria().matching("bla")), ObjectSource.class); {code} The first find works fine, the second find throws the exception below. This is easily reproducible and behaves the same whether the collection exists in the database prior to the run or not. {noformat} org.springframework.data.mongodb.UncategorizedMongoDbException: Query failed with error code 17007 and error message 'Unable to execute query: error processing query: ns=tenant1.objectSource limit=0 skip=0 Tree: TEXT : query=bla, language=, tag=NULL Sort: {} Proj: {} planner returned error: need exactly one text index for $text query' on server 127.0.0.1:27017; nested exception is com.mongodb.MongoQueryException: Query failed with error code 17007 and error message 'Unable to execute query: error processing query: ns=tenant1.objectSource limit=0 skip=0 Tree: TEXT : query=bla, language=, tag=NULL Sort: {} Proj: {} planner returned error: need exactly one text index for $text query' on server 127.0.0.1:27017 at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:101) at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2069) at org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:1912) at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1723) at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1706) at org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:602) at org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:593) at com.cisco.lockhart.model.springmongo.filter.SpringIssueTester.testSpringReproduceIssue(SpringIssueTester.java:34) 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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84) at org.testng.internal.MethodInvocationHelper$1.runTestMethod(MethodInvocationHelper.java:200) at org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:170) 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.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:212) at org.testng.internal.Invoker.invokeMethod(Invoker.java:707) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111) at org.testng.TestRunner.privateRun(TestRunner.java:767) at org.testng.TestRunner.run(TestRunner.java:617) at org.testng.SuiteRunner.runTest(SuiteRunner.java:348) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:343) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:305) at org.testng.SuiteRunner.run(SuiteRunner.java:254) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224) at org.testng.TestNG.runSuitesLocally(TestNG.java:1149) at org.testng.TestNG.run(TestNG.java:1057) at org.gradle.api.internal.tasks.testing.testng.TestNGTestClassProcessor.stop(TestNGTestClassProcessor.java:115) at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:57) 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.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32) at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93) at com.sun.proxy.$Proxy2.stop(Unknown Source) at org.gradle.api.internal.tasks.testing.worker.TestWorker.stop(TestWorker.java:115) 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.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:355) at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: com.mongodb.MongoQueryException: Query failed with error code 17007 and error message 'Unable to execute query: error processing query: ns=tenant1.objectSource limit=0 skip=0 Tree: TEXT : query=bla, language=, tag=NULL Sort: {} Proj: {} planner returned error: need exactly one text index for $text query' on server 127.0.0.1:27017 at com.mongodb.connection.ProtocolHelper.getQueryFailureException(ProtocolHelper.java:102) at com.mongodb.connection.QueryProtocol.execute(QueryProtocol.java:303) at com.mongodb.connection.QueryProtocol.execute(QueryProtocol.java:54) at com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:159) at com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:260) at com.mongodb.connection.DefaultServerConnection.query(DefaultServerConnection.java:183) at com.mongodb.operation.FindOperation$1.call(FindOperation.java:397) at com.mongodb.operation.FindOperation$1.call(FindOperation.java:394) at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:196) at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:169) at com.mongodb.operation.FindOperation.execute(FindOperation.java:394) at com.mongodb.operation.FindOperation.execute(FindOperation.java:57) at com.mongodb.Mongo.execute(Mongo.java:760) at com.mongodb.Mongo$2.execute(Mongo.java:747) at com.mongodb.DBCursor.initializeCursor(DBCursor.java:817) at com.mongodb.DBCursor.hasNext(DBCursor.java:151) at org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:1898) ... 56 more {noformat}

    Spring JIRA | 12 months ago | Doron Levari
    com.mongodb.MongoQueryException: Query failed with error code 17007 and error message 'Unable to execute query: error processing query: ns=tenant1.objectSource limit=0 skip=0 Tree: TEXT : query=bla, language=, tag=NULL Sort: {} Proj: {} planner returned error: need exactly one text index for $text query' on server 127.0.0.1:27017

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. com.mongodb.MongoQueryException

      Query failed with error code 16493 and error message 'Tried to create string longer than 16MB' on server xx.xxx.xx.xx:27018

      at com.mongodb.connection.ProtocolHelper.getQueryFailureException()
    2. MongoDB Java Driver
      MongoBatchCursorAdapter.hasNext
      1. com.mongodb.connection.ProtocolHelper.getQueryFailureException(ProtocolHelper.java:131)
      2. com.mongodb.connection.GetMoreProtocol.execute(GetMoreProtocol.java:96)
      3. com.mongodb.connection.GetMoreProtocol.execute(GetMoreProtocol.java:49)
      4. com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:159)
      5. com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:286)
      6. com.mongodb.connection.DefaultServerConnection.getMore(DefaultServerConnection.java:251)
      7. com.mongodb.operation.QueryBatchCursor.getMore(QueryBatchCursor.java:218)
      8. com.mongodb.operation.QueryBatchCursor.hasNext(QueryBatchCursor.java:103)
      9. com.mongodb.MongoBatchCursorAdapter.hasNext(MongoBatchCursorAdapter.java:46)
      9 frames
    3. Scala
      Iterator$$anon$11.hasNext
      1. scala.collection.convert.Wrappers$JIteratorWrapper.hasNext(Wrappers.scala:41)
      2. scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)
      3. scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)
      4. scala.collection.Iterator$$anon$11.hasNext(Iterator.scala:327)
      4 frames
    4. Spark
      SerDeUtil$AutoBatchedPickler.next
      1. org.apache.spark.api.python.SerDeUtil$AutoBatchedPickler.next(SerDeUtil.scala:118)
      2. org.apache.spark.api.python.SerDeUtil$AutoBatchedPickler.next(SerDeUtil.scala:110)
      2 frames
    5. Scala
      Iterator$class.foreach
      1. scala.collection.Iterator$class.foreach(Iterator.scala:727)
      1 frame
    6. Spark
      PythonRunner$WriterThread.run
      1. org.apache.spark.api.python.SerDeUtil$AutoBatchedPickler.foreach(SerDeUtil.scala:110)
      2. org.apache.spark.api.python.PythonRDD$.writeIteratorToStream(PythonRDD.scala:452)
      3. org.apache.spark.api.python.PythonRunner$WriterThread$$anonfun$run$3.apply(PythonRDD.scala:280)
      4. org.apache.spark.util.Utils$.logUncaughtExceptions(Utils.scala:1801)
      5. org.apache.spark.api.python.PythonRunner$WriterThread.run(PythonRDD.scala:239)
      5 frames