Rick Lin created BEAM-2952:
------------------------------

             Summary: How to use KV.OrderByKey
                 Key: BEAM-2952
                 URL: https://issues.apache.org/jira/browse/BEAM-2952
             Project: Beam
          Issue Type: New Feature
          Components: examples-java
            Reporter: Rick Lin
            Assignee: Reuven Lax
             Fix For: 2.1.0


Hi all,
I  have a question how to use the beam java sdk: KV.OrderByKey
My java code is as:
int[] key=new int[] {2,1,3,4,5};
double[] value=new double[] {1.0,1.0,1.0,1.0,1.0};
List<KV<Integer, Double>> KVlist = new ArrayList<>();
List<KV<Integer, Double>> KVtest = new ArrayList<>();
int n=value.length;
for (int i=0; i<n; i++){                        
  KVlist.add(KV.of(i, value[i]));
  System.out.println(KVlist.get(i));
        }
PipelineOptions options = PipelineOptionsFactory.create();              
Pipeline p = Pipeline.create(options);          
PCollection<KV<Integer, Double>> t1=p.apply("create data",Create.of(KVlist));
p.run;

Thanks

Rick




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to