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 8080435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:24:47+00:00 2026-06-05T16:24:47+00:00

Can anyone provide a clear example of how to remove a supercolumn in Java

  • 0

Can anyone provide a clear example of how to remove a supercolumn in Java using thrift?

Edit: Found a solution, this allows me to delete any number of supercolumns that I want in one batch mutate.

    List<Mutation> mutations = new ArrayList<Mutation>();
    Map<String, List<Mutation>> keyMutations = new HashMap<String, List<Mutation>>();
    Map<ByteBuffer, Map<String, List<Mutation>>> mutationsMap = new HashMap<ByteBuffer, Map<String, List<Mutation>>>();
    try {
        tr.open();
        client.set_keyspace("my_keyspace");

        Deletion deletion = new Deletion();
        SlicePredicate slicePredicate = new SlicePredicate();

        List<ByteBuffer> columns = new ArrayList<ByteBuffer>();

        // Add as many supercolumns as you want here 
        columns.add(toByteBuffer("supercolumn_name"));

        slicePredicate.setColumn_names(columns);
        deletion.setPredicate(slicePredicate);

        // timestamp in microseconds        
        deletion.setTimestamp(System.currentTimeMillis() * 1000);

        Mutation m = new Mutation();
        m.setDeletion(deletion);

        mutations.add(m);

        keyMutations.put("column_family_name", mutations);

        mutationsMap.put(toByteBuffer("row_id_in_column_family"), keyMutations);
        client.batch_mutate(mutationsMap, ConsistencyLevel.ONE);
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
         tr.flush();
         tr.close();
    }
  • 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-05T16:24:50+00:00Added an answer on June 5, 2026 at 4:24 pm

    Found a solution, this allows me to delete any number of supercolumns that I want in one batch mutate.

    List<Mutation> mutations = new ArrayList<Mutation>();
    Map<String, List<Mutation>> keyMutations = new HashMap<String, List<Mutation>>();
    Map<ByteBuffer, Map<String, List<Mutation>>> mutationsMap = new HashMap<ByteBuffer, Map<String, List<Mutation>>>();
    try {
        tr.open();
        client.set_keyspace("my_keyspace");
    
        Deletion deletion = new Deletion();
        SlicePredicate slicePredicate = new SlicePredicate();
    
        List<ByteBuffer> columns = new ArrayList<ByteBuffer>();
    
        // Add as many supercolumns as you want here 
        columns.add(toByteBuffer("supercolumn_name"));
    
        slicePredicate.setColumn_names(columns);
        deletion.setPredicate(slicePredicate);
    
        // timestamp in microseconds        
        deletion.setTimestamp(System.currentTimeMillis() * 1000);
    
        Mutation m = new Mutation();
        m.setDeletion(deletion);
    
        mutations.add(m);
    
        keyMutations.put("column_family_name", mutations);
    
        mutationsMap.put(toByteBuffer("row_id_in_column_family"), keyMutations);
        client.batch_mutate(mutationsMap, ConsistencyLevel.ONE);
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
         tr.flush();
         tr.close();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone provide a clear explanation / example of what these functions do, and
Can anyone provide me with a hello world example for a major mode in
Can anyone provide me an example of how to use WM_CLOSE to close a
I'm confused on how overriding differs from hiding in Java. Can anyone provide more
Thanks in advance for any assistance anyone can provide with this torturous issue. I
Can anyone provide a clear explanation of the difference between LOGON32__LOGON_INTERACTIVE and LOGON32_LOGON_NETWORK when
Can anyone either point me to (or provide here) a clear, step-by-step approach that
Can anyone provide a working sample code to convert following Oracle DB table with
Can anyone provide some links to good information on setting up Silverlight 2.0 to
Can anyone provide details on what the three of these mean? System::ContainerStartTime System::CreationDate System::StartTime

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.