我正在使用snakeYaml将某些配置/属性值解析为Configuration对象.
我的yaml文件看起来像这样 -
#Thread
batchLimit: 1000
threadCountLimit: 2
#Some More Config
key: value
#MAP
keyMapping: <What goes here?>
Run Code Online (Sandbox Code Playgroud)
我的Configuration类看起来像这样 -
public class Configuration{
int batchlimit;
int threadCountLimit;
...
Map<String,String> keyMapping;
}
Run Code Online (Sandbox Code Playgroud)
如何keyMapping在YAML文件中定义它以便直接通过SnakeYAML读取?
请查找随附的代码段.我使用此代码将文件从hdfs下载到我的本地文件系统 -
Configuration conf = new Configuration();
FileSystem hdfsFileSystem = FileSystem.get(conf);
Path local = new Path(destinationPath);
Path hdfs = new Path(sourcePath);
String fileName = hdfs.getName();
if (hdfsFileSystem.exists(hdfs))
{
hdfsFileSystem.copyToLocalFile(false, hdfs, local, true);
logger.info("File " + fileName + " copied to local machine on location: " + destinationPath);
}
else
{
logger.error("File " + fileName + " does not exist on HDFS on location: " + sourcePath);
}
Run Code Online (Sandbox Code Playgroud)
运行此命令会产生以下输出 -
Exception in thread "main" java.lang.UnsupportedOperationException: Not implemented by the DistributedFileSystem FileSystem …Run Code Online (Sandbox Code Playgroud) 我正在处理一个包含记录列表的 avro 文件,并对每条记录执行 client.put 到我本地的 Aerospike 商店。
由于某种原因,放置一定数量的记录是成功的,而对于其余的记录则不然。我正在这样做——
client.put(writePolicy, recordKey, bins);
失败调用的相关值是 -
命名空间=测试
集合名称 = 测试集
用户密钥 = some_string
写入策略=空
垃圾箱-
是用户:1
prof_loc:530049,530046,530032,530031,530017,530016,500046
rfm:白金
store_browsed:some_string
store_purch:some_string
城市ID:空
日志片段 -
com.aerospike.client.AerospikeException: Error Code 4: Parameter error
at com.aerospike.client.command.WriteCommand.parseResult(WriteCommand.java:72)
at com.aerospike.client.command.SyncCommand.execute(SyncCommand.java:56)
at com.aerospike.client.AerospikeClient.put(AerospikeClient.java:338)
可能是什么问题?