tags:

views:

117

answers:

1

I am beginning with HSQLDB, but I hit this issue and can't figure out what's going on:

CREATE TEXT TABLE ozizkaindata (
  jobName VARCHAR(255) NOT NULL,
  buildNumber VARCHAR(255) NOT NULL,
  config VARCHAR(255) NOT NULL,
  ar VARCHAR(255) NOT NULL,
  arFile VARCHAR(255) NOT NULL,
  deployDur VARCHAR(255) NOT NULL,
  warmupDur VARCHAR(255) NOT NULL,
  scale VARCHAR(255) NOT NULL
)

SELECT *, ((0.0 + warmupDur) / deployDur) AS xwarmupSlower FROM ozizkaindata ORDER BY deployDur

Throws:

Caused by: org.hsqldb.HsqlException: duplicate column name in derived table
    at org.hsqldb.error.Error.error(Unknown Source)
    at org.hsqldb.error.Error.error(Unknown Source)
    at org.hsqldb.QuerySpecification.addSelectColumnExpression(Unknown Source)
    at org.hsqldb.ParserDQL.XreadSelect(Unknown Source)
    ...

SELECT ((0.0 + warmupDur) / deployDur) FROM ozizkaindata ORDER BY deployDur

Throws:

Caused by: java.lang.RuntimeException: unsupported internal operation: Type
    at org.hsqldb.error.Error.runtimeError(Unknown Source)
    at org.hsqldb.types.Type.divide(Unknown Source)
    at org.hsqldb.ExpressionArithmetic.getValue(Unknown Source)
    at org.hsqldb.QuerySpecification.buildResult(Unknown Source)
    at org.hsqldb.QuerySpecification.getSingleResult(Unknown Source)
    at org.hsqldb.QuerySpecification.getResult(Unknown Source)
    at org.hsqldb.StatementQuery.getResult(Unknown Source)

SELECT ((0.0 + CAST(warmupDur AS INT)) / CAST(deployDur AS INT)) AS xwarmupSlower FROM ozizkaindata

Throws:

Caused by: org.hsqldb.HsqlException: data exception: invalid character value for cast
    at org.hsqldb.error.Error.error(Unknown Source)
    at org.hsqldb.error.Error.error(Unknown Source)
    at org.hsqldb.Scanner.convertToNumber(Unknown Source)
    at org.hsqldb.types.NumberType.convertToType(Unknown Source)
    at org.hsqldb.types.Type.castToType(Unknown Source)
    at org.hsqldb.ExpressionOp.getValue(Unknown Source)
    at org.hsqldb.ExpressionArithmetic.getValue(Unknown Source)
    at org.hsqldb.ExpressionArithmetic.getValue(Unknown Source)
    at org.hsqldb.QuerySpecification.buildResult(Unknown Source)
    at org.hsqldb.QuerySpecification.getSingleResult(Unknown Source)
    at org.hsqldb.QuerySpecification.getResult(Unknown Source)
A: 

All right, this was easy. I forgot to ignore the first line with a comment. What a shame :)

Ondra Žižka
Btw if anyone knows HSQL's form of `SELECT 1 FROM DUAL`, pls tell...
Ondra Žižka
HSQLDB 2.0"VALUES(1)" HSQLDB 1.8"CREATE TABLE DUAL C INT" "INSERT INTO DUAL VALUES 0" "SELECT 1 FROM DUAL"
fredt