Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7725963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:05:25+00:00 2026-06-01T05:05:25+00:00

I have a task where i need to write a multidimensional array to HDFS.

  • 0

I have a task where i need to write a multidimensional array to HDFS. Since double arrays are serializable, i thought i could do it just by using this code:

     FileSystem fs=FileSystem.get(context.getConfiguration());
     FSDataOutputStream dos = fs.create(new Path(directory+"/Predictions"));
     ObjectWritable obj=new ObjectWritable(double.class,labelPredictions);
     obj.write(dos);
     dos.close();

where directory is a path in hdfs, labelPredictions is the multidimensional array. But when i do this i get this error:

     java.lang.ClassCastException: [[D cannot be cast to java.lang.Double
at org.apache.hadoop.io.ObjectWritable.writeObject(ObjectWritable.java:150)
at org.apache.hadoop.io.ObjectWritable.write(ObjectWritable.java:70)
at MapReduce.MapReduce$Reduce.cleanup(MapReduce.java:181)
at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:178)
at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:648)
at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:416)
at org.apache.hadoop.mapred.Child$4.run(Child.java:259)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:416)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1059)
at org.apache.hadoop.mapred.Child.main(Child.java:253)

Does my double array need to implement Writable to do this, or there is another way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T05:05:26+00:00Added an answer on June 1, 2026 at 5:05 am

    Perhaps you should be using double[][].class instead of double.class…? (Depending on the dimension of the array you’re using — you said “multidimensional,” but it’s not clear what the actual dimension is.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have submitted a task using executors and I need it to stop after
Task: have a jailbroken iPhone need to write an application which would receive notifications
I have a task I need to perform, do_stuff(opts) , that will take ~1s
I have a rake task I need to run as a daily job on
I have a task where I need to translate a DataTable to a two-dimensional
I have a jQuery function already to perform the task I need but is
I have task involving reading SAS .xpt files using .NET. For that I'm using
I'm making a task-based program that needs to have plugins. Tasks need to have
I have a fairly simple task: I need to read a PDF file and
I need to write an ant task to determine if a certain file is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.