Uploaded image for project: 'Livy (READ-ONLY)'
  1. Livy (READ-ONLY)
  2. LIVY-72

Output value is always plain/text instead of JSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Not A Bug
    • Affects Version/s: 0.2
    • Fix Version/s: None
    • Component/s: API, Core, Interpreter
    • Labels:
      None
    • Environment:

      Git: master, rev. aa0742107df8715c3fa83e83b94c39259c896295

      Description

      According to the docs at https://github.com/cloudera/hue/tree/master/apps/spark/java#statement-output, by specifying "application/json" as MIME I should get back a JSON output result:

      an object mapping a mime type to the result. If the mime type is application/json, the value will be a JSON value

      However, executing this code I get back a "plain/text" result:

      $ curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST http://localhost:8998/sessions/ -d '{"kind": "spark"}'
      {"id":0,"state":"starting","kind":"spark","log":[]}
      
      $ curl -H "Accept: application/json" -X GET http://localhost:8998/sessions/0
      {"id":0,"state":"idle","kind":"spark","log":["16/02/11 14:15:08 INFO SparkUI: Started SparkUI at http://10.100.44.51:4040","16/02/11 14:15:08 INFO SparkContext: Added JAR file:/home/milad/projects/hue/apps/spark/java/livy-assembly/target/scala-2.10/livy-assembly-0.2.0-SNAPSHOT.jar at http://10.100.44.51:54600/jars/livy-assembly-0.2.0-SNAPSHOT.jar with timestamp 1455196508415","16/02/11 14:15:08 WARN MetricsSystem: Using default name DAGScheduler for source because spark.app.id is not set.","16/02/11 14:15:08 INFO Executor: Starting executor ID driver on host localhost","16/02/11 14:15:08 INFO Executor: Using REPL class URI: http://10.100.44.51:17347","16/02/11 14:15:08 INFO Utils: Successfully started service 'org.apache.spark.network.netty.NettyBlockTransferService' on port 42576.","16/02/11 14:15:08 INFO NettyBlockTransferService: Server created on 42576","16/02/11 14:15:08 INFO BlockManagerMaster: Trying to register BlockManager","16/02/11 14:15:08 INFO BlockManagerMasterEndpoint: Registering block manager localhost:42576 with 530.0 MB RAM, BlockManagerId(driver, localhost, 42576)","16/02/11 14:15:08 INFO BlockManagerMaster: Registered BlockManager"]}
       
      $ curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST http://localhost:8998/sessions/0/statements -d '{"code": "41 + 1"}'
      {"id":0,"state":"running","output":null}
      
      $ curl -H "Accept: application/json" -X GET http://localhost:8998/sessions/0/statements/0
      {"id":0,"state":"available","output":{"status":"ok","execution_count":0,"data":{"text/plain":"res0: Int = 42"}}}
      

      I'd expect to see something different than this:

      {"text/plain":"res0: Int = 42"}
      

      For example:

      {"application/json":"42"}
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              milad.bourhani@gmail.com Milad Bourhani
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: