我有一个包含 Java 和 Scala 组件的 maven 项目,但是当我使用 maven-shade-plugin 时,它会重新定位 Java 和 Scala 文件的包名,但只重命名 Java 文件中的包,Scala 文件仍然包含旧的包名,我错过了什么?
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<!--<minimizeJar>true</minimizeJar>-->
<artifactSet>
<includes>
<include>ml.dmlc:xgboost4j-spark</include>
<include>ml.dmlc:xgboost4j</include>
</includes>
</artifactSet>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<relocations>
<relocation>
<pattern>ml.dmlc.xgboost4j</pattern>
<shadedPattern>ml.dmlc.xgboost4j.shaded</shadedPattern>
</relocation>
</relocations>
<transformers>
</transformers>
</configuration>
</execution>
</executions>
</plugin>```
Run Code Online (Sandbox Code Playgroud) 我正在尝试以服务到服务的方式转发一个非常大的 csv 格式的文件。
因此,用户上传了一个非常大的 csv 文件(几个 GB),后端接收该文件作为 Spring 的MultipartFile抽象(我的版本是spring-web-4.3.3.RELEASE)。
之后,我MultipartFile使用RestTemplate. 一切工作正常,如果setBufferRequestBody是true在要求的工厂,但如预期,它与内存不足的错误炸毁内存文件的字节被写入之前内部缓冲。但是,当我设置setBufferRequestBody为 时false,出现以下异常。
我发现 Spring 代理我的自定义请求工厂InterceptingClientHttpRequest,然后在内部将其委托给我的自定义请求工厂:
java.lang.UnsupportedOperationException: getBody not supported
at org.springframework.http.client.HttpComponentsStreamingClientHttpRequest.getBodyInternal(HttpComponentsStreamingClientHttpRequest.java:84)
at org.springframework.http.client.AbstractClientHttpRequest.getBody(AbstractClientHttpRequest.java:47)
at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:91)
at org.springframework.cloud.netflix.metrics.MetricsClientHttpRequestInterceptor.intercept(MetricsClientHttpRequestInterceptor.java:65)
at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:85)
at org.springframework.http.client.InterceptingClientHttpRequest.executeInternal(InterceptingClientHttpRequest.java:69)
at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:619)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:595)
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:516)
at org.springframework.web.client.RestTemplate$$FastClassBySpringCGLIB$$aa4e9ed0.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
at org.keycloak.adapters.springsecurity.client.KeycloakRestTemplate$$EnhancerBySpringCGLIB$$596ee8a2.exchange(<generated>)
at us.deloitteinnovation.cfsa.service.dawb.impl.DatafileServiceImpl.doUploadInternal(DatafileServiceImpl.java:131)
at us.deloitteinnovation.cfsa.service.dawb.impl.DatafileServiceImpl.uploadDataFile(DatafileServiceImpl.java:88)
at …Run Code Online (Sandbox Code Playgroud) 我有以下 mongo 聚合管道,我试图在包含 600 万个文档的集合上执行(每个文档平均有 30 个键值对)。我担心的是小组赛需要很长时间(大约几分钟)。这些阶段的顺序是:匹配 -> 排序 -> 项目 -> 组 -> 跳过 -> 限制。作为匹配和排序的一部分的所有查询键都已正确编入索引。我还尝试在没有组阶段的情况下运行相同的管道,它在不到一秒钟的时间内完成。我也对这个聚合管道做了解释,我的索引被正确使用。
无论如何,我可以进一步提高我下面的管道的小组赛表现吗?或者有没有其他替代方法可以用来执行不同的查询,以及对我的集合中的键进行分页(跳过/限制)?我查看了 db.collection.distinct,但它的 bson 大小上限为 16 MB。
[
{ "$match":{ "dSource":{ "$in":[ "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33" ] }, "$and":[ { "dirty":{ "$exists":false } } ] } },
{ "$sort":{ "_id":1 } },
{ "$project":{ "sampleKey":1 } },
{ "$group":{ "_id":"$sampleKey" } },
{ "$skip":0 },
{ "$limit":200 } …Run Code Online (Sandbox Code Playgroud) mongodb database-performance query-performance aggregation-framework