我正在尝试使用QueryDatabaseTable
和PutHiveQl
处理器将数据从MySql导入到Hive ,但是会发生错误.
我有一些问题:
puthiveql
?我正在使用 SimpleDateFormat 来格式化或验证日期,但我想通过使用 java 8 DateTimeFormatter 使其成为线程安全的。我无法实现某些要求。
我的应用程序将只接受三种类型的格式。"yyyy-MM-dd", "yyyy-MM", "yyyy"
Existing Code gives me desired output:
/*simple date format to process yyyy-MM-dd format
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd")
/*simple date format to process yyyy-MM format
SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM")
/*simple date format to process yyyy format
SimpleDateFormat simpleDateFormat3 = new SimpleDateFormat("yyyy")
/* to parse input
simpleDateFormat.parse(input)
/* to format
simpleDateFormat.format(simpleDateFormat1)
Run Code Online (Sandbox Code Playgroud)
这是输入和预期输出:
input expected
'2018-03-19' '2018-03-19'
'2018-03' '2018-03'
'2018' '2018'
'2017-02-54' '2017-02'
'2016-13-19' '2016'
Run Code Online (Sandbox Code Playgroud)
如何在 java 8 DateTimeFormat enter code …