bug fixed in sampling operations and resolved truncating each table'a attribute to 255 characters

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-access/DatabasesResourcesManager@99348 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Loredana Liccardo 2014-08-29 11:51:09 +00:00
parent 6ce1e4d44b
commit 6942920792
1 changed files with 15 additions and 12 deletions

View File

@ -171,11 +171,13 @@ public class Sampler {
if (DBType.equals(POSTGRES)) {
attribute = "CAST(" + listColumns.get(i) + " as text), ";
// attribute = "CAST(" + listColumns.get(i) + " as text), ";
attribute = "CAST(" + listColumns.get(i) + " as character varying(255)), ";
if (i == (listColumns.size() - 1)) {
attribute = "CAST(" + listColumns.get(i) + " as text)";
// attribute = "CAST(" + listColumns.get(i) + " as text)";
attribute = "CAST(" + listColumns.get(i) + " as character varying(255))";
}
@ -196,7 +198,7 @@ public class Sampler {
// attribute = "CONVERT(" + listColumns.get(i) +
// ", CHAR), ";
attribute = "CAST(" + "`" +listColumns.get(i)+ "`"
+ " as CHAR CHARACTER SET utf8), ";
+ " as CHAR(255) CHARACTER SET utf8), ";
if (i == (listColumns.size() - 1)) {
@ -207,14 +209,14 @@ public class Sampler {
// ", BINARY)";
attribute = "CAST(" + "`" +listColumns.get(i)+ "`"
+ " as CHAR CHARACTER SET utf8)";
+ " as CHAR(255) CHARACTER SET utf8)";
}
} else {
attribute = "CAST(CAST(" + "`" +listColumns.get(i)+ "`"
+ " as BINARY) as CHAR CHARACTER SET utf8), ";
+ " as BINARY) as CHAR(255) CHARACTER SET utf8), ";
if (i == (listColumns.size() - 1)) {
@ -225,7 +227,7 @@ public class Sampler {
// ", BINARY)";
attribute = "CAST(CAST(" + "`" +listColumns.get(i)+ "`"
+ " as BINARY) as CHAR CHARACTER SET utf8)";
+ " as BINARY) as CHAR(255) CHARACTER SET utf8)";
}
@ -704,12 +706,13 @@ public class Sampler {
if ((listRows.size() > 100) && (removal == false)) {
for (int k = 0; k < listRows.size(); k++) {
AnalysisLogger.getLogger().debug(
"Sampler->row with index: " + k + " score "
+ listRows.get(k).getScore());
}
//print check
// for (int k = 0; k < listRows.size(); k++) {
//
// AnalysisLogger.getLogger().debug(
// "Sampler->row with index: " + k + " score "
// + listRows.get(k).getScore());
// }
AnalysisLogger.getLogger().debug(
"Sampler->starting the removal operation");