小编Har*_*ish的帖子

Hive 查询从字符串中分别提取日期和时间

我需要从配置单元中的字符串列中提取日期和小时。

桌子: 在此输入图像描述

select TO_DATE(from_unixtime(UNIX_TIMESTAMP(dates,'dd/MM/yyyy'))) from dates;

output:

0016-01-01
0016-01-01

select TO_DATE(from_unixtime(UNIX_TIMESTAMP(dates,'hh'))) from dates;

output:

1970-01-01
1970-01-01
Run Code Online (Sandbox Code Playgroud)

请告知如何从表列中单独获取日期和时间。

hadoop hive hiveql

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

将 Powerclass 用于使用 JAXB 的测试类时出现链接错误

`java.lang.LinkageError: loader constraint violation: when resolving overridden method "com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshal

`Exception(Lorg/xml/sax/SAXException;)Ljavax/xml/bind/UnmarshalException;" the class loader (instance of org/powermock/core/classloader/MockClassLoader) of the current class, com/sun/xml/bind/v2/runtime/unmarshaller/UnmarshallerImpl, and its superclass loader (instance of <bootloader>), have different Class objects for the type org/xml/sax/SAXException used in the signature
Run Code Online (Sandbox Code Playgroud)

我正在使用 Powermock 在 JUNIT 测试用例中模拟静态类。由于我的 junit 使用 xml 文件,所以我收到了一些错误,我必须使用 powermock 忽略,如下所示。

@PowerMockIgnore({ "javax.xml.*"})
@RunWith(PowerMockRunner.class)
Run Code Online (Sandbox Code Playgroud)

我收到链接错误以及以下错误。请指教

javax.xml.transform.TransformerFactoryConfigurationError: Provider for class javax.xml.transform.TransformerFactory cannot be created
Run Code Online (Sandbox Code Playgroud)

java junit jaxb powermock powermockito

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

为 Future 回调编写 junit 测试用例

有人可以帮助为下面的代码部分(尤其是添加回调部分)编写 JUnit 测试吗?我不知道如何使用回调为 Listenablefuture 编写单元测试用例

    private void handleResponse(final ListenableFuture<UserRecordResult> response, CompletableFuture future) {

        Futures.addCallback(response, new FutureCallback<UserRecordResult>() {

            @Override
            public void onFailure(@Nonnull Throwable throwable) {

                future.completeExceptionally(new Exception("Fail to put record" + throwable.getMessage()));
            }

            @Override
            public void onSuccess(UserRecordResult result) {
                if(result.isSuccessful()) {
                    future.complete(true);
                } else {
                    future.completeExceptionally(new Exception("Fail to put record"));
                }
            }
        });
    }
Run Code Online (Sandbox Code Playgroud)

java junit callback async-await completable-future

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