The SQL standard, JDBC and ODBC define a set of core types. There is no INT or 
INT4 type, but there is INTEGER. In several databases, INT is a synonym for 
INTEGER.

And when you talk to MySQL or Postgres, java.sql.Types.INTEGER is what comes 
out of DatabaseMetaData.getColumns  in the DATA_TYPE column. The TYPE_NAME 
column is a "Data source dependent type name” but Calcite doesn’t try to do 
anything particularly clever with it. Probably what we return is what we got 
from the underlying JDBC driver.

Regarding VARCHAR. According to the SQL standard character types have a 
character set and collation, which have a system default, but Calcite tends to 
add them when it reads the type. Character set and collation are present in 
other systems, but Calcite is maybe a bit more verbose than most.

Julian


> On Jan 8, 2017, at 8:15 AM, Riccardo Tommasini <[email protected]> 
> wrote:
> 
> Hello everybody,
> 
> I am running a set of tests to understand which kind of metadata Calcite is 
> exposing already, w.r.t. this JIRA [1].
> 
> Using both MySQL and Postgres I queried the available database metadata both 
> through Calcite and directly using the relative driver class. The result is 
> the attached files.
> 
> What I am trying to understand is the meaning of the Calcite TYPE_NAME column 
> values.
> 
> Calcites interprets Postgres’  varchar 12 and MYSQL’s VARCHAR 12
> 
> as 
> VARCHAR(100) CHARACTER SET "ISO-8859-1" COLLATE "ISO-8859-1$en_US$primary" 
> NOT NULL
> 
> and Postgres’ int4 and MYSQL’s INT as
> 
> INTEGER NOT NULL
> 
> Can you please explain to me what these datatypes refer to?
> 
> 
> thanks in advance!
> 
> [1] https://issues.apache.org/jira/browse/CALCITE-1545 
> <https://issues.apache.org/jira/browse/CALCITE-1545>
> 
> 
> Riccardo Tommasini
> Master Degree Computer Science
> PhD Student at Politecnico di Milano (Italy)
> streamreasoning.org <http://streamreasoning.org/>
> 
> Submitted from an iPhone, I apologise for typos.

Reply via email to