Re: char vs varchar in testcases

On 27 Feb 2012, at 15:50, Juan Sequeda wrote:
> I've been reviewing each test case and I've bumped into an issue wrt char ans varchar in the table definitions. Take D010 [1].  "ISO 3166" as a datatype of CHAR (1), however the data that is inserted consists of only 2 characters. Therefore the result of querying on this table (select "ISO 3166" from "Country Code") is a string of 10 characters long where the first 2 characters is the country code that was inserted and the rest has been padded with white space. This is the case at least in SQL Server. It seems to be the case in Oracle [2].

It's the same in SQL 2008.

> I do not see in Section 10.2 in the R2RML spec [3] anything that says that the padded white spaces should be eliminated (or is there and it's simply monday morning and I can't seem to read/find it).

R2RML doesn't specify that padded white space shall be removed.

> Therefore, the DM (and I'm guessing subsequently) and R2RML results should include the extra whitespaces,

AFAICT, the expected result both according to the DM and R2RML specs would indeed include the padded whitespace. Hence the test case as currently written is wrong.

> or simply change the test cases to use VARCHAR.

That would be the easiest way of fixing the test case.

I propose to have an additional simple, minimal test case that uses CHAR and asserts that the resulting RDF is space-padded.

Good catch, Juan!

Best,
Richard



> 
> Btw, what was the intention of using CHAR instead of VARCHAR in the first place?
> 
> Thanks!
> 
> [1] http://www.w3.org/2001/sw/rdb2rdf/test-cases/#D010-1table1primarykey3colums3rows
> [2] http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1542606219593
> [3] http://www.w3.org/2001/sw/rdb2rdf/r2rml/#natural-mapping
> 
> Juan Sequeda
> +1-575-SEQ-UEDA
> www.juansequeda.com

Received on Monday, 27 February 2012 17:07:11 UTC