小编sas*_*hmi的帖子

插入到accumulo中的表的行数

我在Accumulo的表中插入了一些行.有些行是新创建的,有些行是更新的.

如何在Java中找到插入或更新到accumulo表中的行数?

def obj= jsonObject["obj"]
for(entry in obj) {
                String a = entry["a"];
                String b = entry["b"];
                String c = entry["c"];
                String d = entry["d"];
                String e = entry["e"];

                ColumnVisibility cv = new ColumnVisibility(d);
                Mutation m = new Mutation(a);
                m.put(b, c, cv, e)
                bw.addMutation(m);
                count++;
            }
Run Code Online (Sandbox Code Playgroud)

这是当前正在进行的操作,计数被视为写入表中的条目数.但是如果只插入了一些新的入口/行并且要更新其他入口/行,则不能将计数视为输入表中的新条目

java accumulo

2
推荐指数
1
解决办法
587
查看次数

在 SPARK 中将多列合并为单列

我的镶木地板文件中有以下格式的扁平化传入数据:

在此输入图像描述

我想将其转换为以下格式,其中我不展平我的结构:

在此输入图像描述

我尝试了以下方法:

Dataset<Row> rows = df.select(col("id"), col("country_cd"),
                explode(array("fullname_1", "fullname_2")).as("fullname"),
                explode(array("firstname_1", "firstname_2")).as("firstname"));
Run Code Online (Sandbox Code Playgroud)

但它给出了以下错误:

线程“main”org.apache.spark.sql.AnalysisException 中出现异常:每个 select 子句仅允许一个生成器,但发现 2 个:explode(array(fullname_1, fullname_2)),explode(array(firstname_1,firstname_2));

我理解这是因为你不能在查询中使用超过 1 个爆炸。我正在寻找在 Spark Java 中执行上述操作的选项。

apache-spark apache-spark-sql databricks

2
推荐指数
1
解决办法
5484
查看次数

s3distcp 在单个命令中将文件和目录从 HDFS 复制到 S3

我在 HDFS 中有以下 2 个文件和 1 个目录。

-rw-r--r-- 1 hadoop hadoop 11194859 2017-05-05 19:53 hdfs:///outputfiles/abc_output.txt
drwxr-xr-x - hadoop hadoop 0 2017-05-05 19:28 hdfs:///outputfiles/sample_directory
-rw-r--r-- 1 hadoop hadoop 68507436 2017-05-05 19:55 hdfs:///outputfiles/sample_output.txt

I want to copy abc_output.txt and sample_directory in gzip format onto S3 from HDFS in a single command. I don't want the files to be combined on S3.

My S3 bucket should contain the following: abc_output.txt.gzip sample_directory.gzip

I tried the following:

s3-dist-cp --s3Endpoint=s3.amazonaws.com --src=hdfs:///outputfiles/ --dest=s3://bucket-name/outputfiles/ --outputCodec=gzip

But this copies …

amazon-s3 s3distcp

1
推荐指数
1
解决办法
1万
查看次数