我正在使用此链接制作一些docker-compose yml文件.在这个配置中,驱动程序的含义是什么:本地顶级卷?
volumes:
esdata1:
driver: local
esdata2:
driver: local
Run Code Online (Sandbox Code Playgroud) 我阅读本文档以了解"search_after"并提出两个问题.
当我添加search_after的多个参数时,是'和'条件还是'或'条件?
ex)"search_after":[1463538857,5147821]
我可以从数据库加载数据,我用这些数据做一些处理.问题是某些表的日期列为'String',但其他一些表将其特征为'timestamp'.
在加载数据之前,我无法知道什么类型的日期列.
> x.getAs[String]("date") // could be error when date column is timestamp type
> x.getAs[Timestamp]("date") // could be error when date column is string type
Run Code Online (Sandbox Code Playgroud)
这是我从spark加载数据的方式.
spark.read
.format("jdbc")
.option("url", url)
.option("dbtable", table)
.option("user", user)
.option("password", password)
.load()
Run Code Online (Sandbox Code Playgroud)
有什么方法可以将它们混合在一起吗?或者将其转换为字符串总是?
我正在使用spark 2.1并试图读取csv文件.
Run Code Online (Sandbox Code Playgroud)compile group: 'org.scala-lang', name: 'scala-library', version: '2.11.1' compile group: 'org.apache.spark', name: 'spark-core_2.11', version: '2.1.0'
这是我的代码.
import java.io.{BufferedWriter, File, FileWriter}
import java.sql.{Connection, DriverManager}
import net.sf.log4jdbc.sql.jdbcapi.ConnectionSpy
import org.apache.spark.sql.{DataFrame, SparkSession, Column, SQLContext}
import org.apache.spark.sql.functions._
import org.postgresql.jdbc.PgConnection
spark.read
.option("charset", "utf-8")
.option("header", "true")
.option("quote", "\"")
.option("delimiter", ",")
.csv(...)
Run Code Online (Sandbox Code Playgroud)
它运作良好.问题是spark read(DataFrameReader)选项键与reference(link)不同.参考说我应该使用'encoding'进行编码但不能正常工作,但charset运行良好.参考是错的吗?
我有一个 CSV 文件,其中包含双引号 (") 中的数据。
“0001”、“A”、“001”、“2017/01/01 12”
“0001”、“B”、“002”、“2017/01/01 13”
我只想读取纯数据(没有 " 符号)。
spark.read
.option("encoding", encoding)
.option("header", header)
.option("quote", quote)
.option("sep", sep)
Run Code Online (Sandbox Code Playgroud)
其他选项运行良好,但只有引用似乎不能正常工作。它加载了引号 (")。我应该如何从加载的数据中去掉这个符号。
dataframe.show 结果
+----+----+------+---------------+
| _c0| _c1| _c2| _c3|
+----+----+------+---------------+
|0001| "A"| "001"| "2017/01/01 12"|
|0001| "B"| "002"| "2017/01/01 13"|
+----+----+------+---------------+
Run Code Online (Sandbox Code Playgroud) 我正在使用jest弹性搜索(作为java客户端).我需要一些嵌套文档中的字段,因为无法将嵌套字段作为对,我需要'_source'来获取它们.
以下是在ES查询[ Link ]中获取它们的问题,并且效果很好.
但是无法将其查询转换为jest代码.以下是我的尝试.
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder().query(
query
)
.fields( // need _source but no method.
"oid",
"_source.events.activityoid",
"_source.events.worktime");
Run Code Online (Sandbox Code Playgroud) 我想将类型转换List<A>为List<B>.我可以用java 8流方法吗?
Map< String, List<B>> bMap = aMap.entrySet().stream().map( entry -> {
List<B> BList = new ArrayList<B>();
List<A> sList = entry.getValue();
// convert A to B
return ???; Map( entry.getKey(), BList) need to return
}).collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue()));
Run Code Online (Sandbox Code Playgroud)
我尝试使用此代码,但无法在map()中进行转换.
我想只获得嵌套字段,但不能,因为它不是叶字段.
GET index/_search
{
"size": 10,
"fields": [
"nested_fields"
]
}
Run Code Online (Sandbox Code Playgroud)
ERROR : "reason": "field [nested_fields] isn't a leaf field"
我在下面尝试过,但无法匹配嵌套对象中的每个id和名称.
GET index/_search
{
"size": 10,
"fields": [
"nested_fields.id",
"nested_fields.name"
]
}
Run Code Online (Sandbox Code Playgroud)
结果:
"fields": {
"events.id": [
"13342",
"24232",
"25534",
"63454"
],
"events.name": [
"R1413",
"R1414",
"R1415",
"R1416",
]
}
Run Code Online (Sandbox Code Playgroud)
这是我的预期结果:
fields" : {
"evets" : {
"id" : "234234",
"name" : "RP1524"
},
.... so on
}
Run Code Online (Sandbox Code Playgroud) 项目由angular cli创建
Angular CLI: 1.7.2
Node: 6.11.4
OS: win32 x64
Angular: 5.2.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
@angular/cli: 1.7.2
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.1
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.5.3
webpack: 3.11.0
Run Code Online (Sandbox Code Playgroud)
并使用ng命令生成服务.
ng g service newService2
Run Code Online (Sandbox Code Playgroud)
我尝试'ng test'来测试我的代码,但是我得到了如下错误.
StaticInjectorError(Platform:core)[AppComponent - > NewService2Service]:NullInjectorError:没有NewService2Service的提供者!错误:StaticInjectorError(DynamicTestModule)[AppComponent - > NewService2Service]:at _NullInjector.webpackJsonp ../ node_modules/@angular/core/esm5/core.js._NullInjector.get node_modules/@angular/core/esm5/core.js:1002 :1)at resolveToken node_modules/@angular/core/esm5/core.js:1300:1)
这是我的代码.
app.module.ts
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from …Run Code Online (Sandbox Code Playgroud)