[
https://issues.apache.org/jira/browse/TAJO-842?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14008087#comment-14008087
]
Hyoungjun Kim edited comment on TAJO-842 at 5/27/14 5:23 AM:
-------------------------------------------------------------
I didn't check JSR about JDBC. After Prafulla comment, I found a JDBC
specification in the following URL.
http://download.oracle.com/otn-pub/jcp/jdbc-4_1-mrel-spec/jdbc4.1-fr-spec.pdf
I'll change JDBC null handing according to the following specifications.
{noformat}
The method wasNull can be called to determine if the last value retrieved was a
SQL NULL in the database.
When the column value in the database is SQL NULL, it may be returned to the
Java
application as null, 0, or false, depending on the type of the column value.
Column values that map to Java Object types are returned as a Java null; those
that map to numeric types are returned as 0; those that map to a Java boolean
are
returned as false. Therefore, it may be necessary to call the wasNull method to
determine whether the last value retrieved was a SQL NULL.
{noformat}
There is one issue. It is difficult to identify NULL value in the Tajo Shell.
So I'll add configuration named "tajo.cli.nullchar".
{noformat}
id,name,id2,name2,c1,c2
-------------------------------
1,ooo,1,,9991231,ooo
2,ppp,2,,9991231,ppp
3,qqq,,,9991231,9991231
4,rrr,,,9991231,9991231
5,xxx,,,9991231,9991231
{noformat}
If "tajo.cli.nullchar" is set with "null", Shell prints the following.
{noformat}
id,name,id2,name2,c1,c2
-------------------------------
1,ooo,1,null,9991231,ooo
2,ppp,2,null,9991231,ppp
3,qqq,null,null,9991231,9991231
4,rrr,null,null,9991231,9991231
5,xxx,null,null,9991231,9991231
{noformat}
was (Author: hjkim):
I didn't check JSR about JDBC. After Prafulla comment, I found a JDBC
specification in the following URL.
http://download.oracle.com/otn-pub/jcp/jdbc-4_1-mrel-spec/jdbc4.1-fr-spec.pdf
I'll change JDBC null handing according to the following specifications.
{noformat}
The method wasNull can be called to determine if the last value retrieved was a
SQL NULL in the database.
When the column value in the database is SQL NULL, it may be returned to the
Java
application as null, 0, or false, depending on the type of the column value.
Column values that map to Java Object types are returned as a Java null; those
that map to numeric types are returned as 0; those that map to a Java boolean
are
returned as false. Therefore, it may be necessary to call the wasNull method to
determine whether the last value retrieved was a SQL NULL.
{noformat}
There is one issue. It is difficult to identify NULL value in the Tajo Shell.
So I'll add configuration named "tajo.cli.null.print"(default=false) and
"tajo.cli.null.print.word".
{noformat}
id,name,id2,name2,c1,c2
-------------------------------
1,ooo,1,,9991231,ooo
2,ppp,2,,9991231,ppp
3,qqq,0,,9991231,9991231
4,rrr,0,,9991231,9991231
5,xxx,0,,9991231,9991231
{noformat}
If "tajo.cli.null.print" is true and "tajo.cli.null.print.word" is set with
"null", Shell prints the following.
{noformat}
id,name,id2,name2,c1,c2
-------------------------------
1,ooo,1,null,9991231,ooo
2,ppp,2,null,9991231,ppp
3,qqq,null,null,9991231,9991231
4,rrr,null,null,9991231,9991231
5,xxx,null,null,9991231,9991231
{noformat}
> NULL handling in JDBC.
> ----------------------
>
> Key: TAJO-842
> URL: https://issues.apache.org/jira/browse/TAJO-842
> Project: Tajo
> Issue Type: Improvement
> Reporter: Hyoungjun Kim
> Assignee: Hyoungjun Kim
>
> Currently JDBC doesn't handle NULL value, only wasnull() is provided. JDBC
> handles NULL data like the following rule.
> - Text type: return java null.
> - Int, Float type: return 0
> - Date/Time type: return null.
> - Boolean: return false
> - getObject(): return java null
--
This message was sent by Atlassian JIRA
(v6.2#6252)