Skip to content

Commit

Permalink
DPAL-2030 [hive-udf] str_to_date() UDF bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
julingks committed Apr 9, 2013
1 parent e7e7ab5 commit 78f0c2f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/nexr/platform/hive/udf/UDFDateFormat.java
Expand Up @@ -61,6 +61,8 @@ public class UDFDateFormat extends UDF {
private final SimpleDateFormat formatter = new SimpleDateFormat();

public UDFDateFormat() {
standardFormatter.setLenient(false);
formatter.setLenient(false);
}

Text result = new Text();
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/nexr/platform/hive/udf/UDFLastDay.java
Expand Up @@ -59,7 +59,9 @@ public class UDFLastDay extends UDF {
private final SimpleDateFormat standardFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private final Calendar calendar = Calendar.getInstance();

public UDFLastDay() { }
public UDFLastDay() {
standardFormatter.setLenient(false);
}

Text result = new Text();

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/nexr/platform/hive/udf/UDFStrToDate.java
Expand Up @@ -49,8 +49,10 @@ public class UDFStrToDate extends UDF {
private final SimpleDateFormat standardFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private final SimpleDateFormat formatter = new SimpleDateFormat();
private final Calendar calendar = Calendar.getInstance();

public UDFStrToDate() {
standardFormatter.setLenient(false);
formatter.setLenient(false);
}

Text result = new Text();
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/nexr/platform/hive/udf/UDFSysDate.java
Expand Up @@ -52,6 +52,11 @@ public class UDFSysDate extends UDF{
private final SimpleDateFormat stdFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private final SimpleDateFormat formatter = new SimpleDateFormat();
private final Calendar calendar = Calendar.getInstance();

public UDFSysDate() {
stdFormatter.setLenient(false);
formatter.setLenient(false);
}

Text result= new Text();
public Text evaluate() {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/nexr/platform/hive/udf/UDFToChar.java
Expand Up @@ -89,6 +89,8 @@ public class UDFToChar extends UDF {
private Text lastPatternText = new Text();

public UDFToChar() {
standardFormatter.setLenient(false);
formatter.setLenient(false);
}

public Text evaluate(NullWritable i) {
Expand Down

0 comments on commit 78f0c2f

Please sign in to comment.