Search in sources :

Example 1 with BinaryData

use of org.hsqldb_voltpatches.types.BinaryData in project voltdb by VoltDB.

the class RowInputText method readOther.

protected Object readOther() throws IOException {
    String s = readString();
    if (s == null) {
        return null;
    }
    BinaryData data = scanner.convertToBinary(s);
    if (data.length(null) == 0) {
        return null;
    }
    return new JavaObjectData(data.getBytes());
}
Also used : JavaObjectData(org.hsqldb_voltpatches.types.JavaObjectData) BinaryData(org.hsqldb_voltpatches.types.BinaryData)

Example 2 with BinaryData

use of org.hsqldb_voltpatches.types.BinaryData in project voltdb by VoltDB.

the class RowInputText method readBit.

protected BinaryData readBit() throws IOException {
    String s = readString();
    if (s == null) {
        return null;
    }
    BinaryData data = scanner.convertToBit(s);
    return data;
}
Also used : BinaryData(org.hsqldb_voltpatches.types.BinaryData)

Example 3 with BinaryData

use of org.hsqldb_voltpatches.types.BinaryData in project voltdb by VoltDB.

the class FunctionSQL method resolveTypes.

@Override
public void resolveTypes(Session session, Expression parent) {
    for (int i = 0; i < nodes.length; i++) {
        if (nodes[i] != null) {
            nodes[i].resolveTypes(session, this);
        }
    }
    switch(funcType) {
        case FUNC_POSITION_CHAR:
        case FUNC_POSITION_BINARY:
            {
                if (nodes[0].dataType == null) {
                    if (nodes[1].dataType == null) {
                        throw Error.error(ErrorCode.X_42567);
                    }
                    if (nodes[1].dataType.typeCode == Types.SQL_CLOB || nodes[1].dataType.isBinaryType()) {
                        nodes[0].dataType = nodes[1].dataType;
                    } else {
                        nodes[0].dataType = Type.SQL_VARCHAR_DEFAULT;
                    }
                }
                if (nodes[1].dataType == null) {
                    if (nodes[0].dataType.typeCode == Types.SQL_CLOB || nodes[0].dataType.isBinaryType()) {
                        nodes[1].dataType = nodes[0].dataType;
                    } else {
                        nodes[1].dataType = Type.SQL_VARCHAR_DEFAULT;
                    }
                }
                if (nodes[0].dataType.isCharacterType() && nodes[1].dataType.isCharacterType()) {
                    funcType = FUNC_POSITION_CHAR;
                } else if (nodes[0].dataType.isBinaryType() && nodes[1].dataType.isBinaryType()) {
                    if (nodes[0].dataType.isBitType() || nodes[1].dataType.isBitType()) {
                        throw Error.error(ErrorCode.X_42565);
                    }
                    funcType = FUNC_POSITION_BINARY;
                } else {
                    throw Error.error(ErrorCode.X_42565);
                }
                dataType = Type.SQL_BIGINT;
                break;
            }
        /*
            case FUNC_OCCURENCES_REGEX :
            case FUNC_POSITION_REGEX :
            */
        case FUNC_EXTRACT:
            {
                if (nodes[1].dataType == null) {
                    throw Error.error(ErrorCode.X_42567);
                }
                if (!nodes[1].dataType.isDateTimeType() && !nodes[1].dataType.isIntervalType()) {
                    throw Error.error(ErrorCode.X_42565);
                }
                int part = ((Number) nodes[0].valueData).intValue();
                DTIType type = (DTIType) nodes[1].dataType;
                part = DTIType.getFieldNameTypeForToken(part);
                dataType = type.getExtractType(part);
                break;
            }
        case FUNC_BIT_LENGTH:
            {
                if (nodes[0].dataType == null) {
                    nodes[0].dataType = Type.SQL_BIT_VARYING_MAX_LENGTH;
                }
                if (!nodes[0].dataType.isCharacterType() && !nodes[0].dataType.isBinaryType()) {
                    throw Error.error(ErrorCode.X_42565);
                }
                dataType = Type.SQL_BIGINT;
                break;
            }
        case FUNC_CHAR_LENGTH:
        case FUNC_OCTET_LENGTH:
            {
                if (nodes[0].dataType == null) {
                    nodes[0].dataType = Type.SQL_VARCHAR_DEFAULT;
                } else if (!nodes[0].dataType.isCharacterType() && ((funcType == FUNC_CHAR_LENGTH) || (!nodes[0].dataType.isBinaryType() && (funcType == FUNC_OCTET_LENGTH)))) {
                    throw Error.error(ErrorCode.X_42565);
                }
                dataType = Type.SQL_BIGINT;
                break;
            }
        case FUNC_CARDINALITY:
            {
                dataType = Type.SQL_BIGINT;
                break;
            }
        case FUNC_MOD:
            {
                if (nodes[0].dataType == null) {
                    if (nodes[1].dataType == null) {
                        // Data types for both operands are unknown, throw exception.
                        throw Error.error(ErrorCode.X_42567);
                    }
                    nodes[0].dataType = nodes[1].dataType;
                }
                if (nodes[0].dataType.isIntegralType()) {
                    // Promote the data type to BIGINT for integral data types.
                    nodes[0].dataType = Type.SQL_BIGINT;
                }
                if (nodes[1].dataType == null) {
                    nodes[1].dataType = nodes[0].dataType;
                }
                // "scale != 0", supported by customer request).
                if (!(nodes[0].dataType.isIntegralType() || nodes[0].dataType.typeCode == Types.SQL_DECIMAL)) {
                    throw Error.error(ErrorCode.X_42565);
                }
                if (!(nodes[1].dataType.isIntegralType() || nodes[1].dataType.typeCode == Types.SQL_DECIMAL)) {
                    throw Error.error(ErrorCode.X_42565);
                }
                // (by the decision of the requesting customer).
                if (nodes[0].dataType.isIntegralType() != nodes[1].dataType.isIntegralType()) {
                    throw Error.error(ErrorCode.X_42565);
                }
                parameterArg = 1;
                dataType = nodes[1].dataType;
                break;
            }
        case FUNC_POWER:
            {
                if (nodes[0].dataType == null) {
                    // A VoltDB extension to customize the SQL function set support
                    // VoltDB swapped out this odd propagation of nulls.
                    // VoltDB simply gives missing types the benefit of the doubt.
                    nodes[0].dataType = Type.SQL_DOUBLE;
                // For VoltDB, the retest for null below is now redundant.
                /* disable 1 line ...
                    nodes[1].dataType = nodes[0].dataType;
                    ... disabled 1 line */
                // End of VoltDB extension
                }
                if (nodes[1].dataType == null) {
                    // VoltDB swapped out this odd propagation of nulls.
                    // ORIGINAL HSQL CODE: nodes[0].dataType = nodes[1].dataType;
                    // VoltDB simply gives missing types the benefit of the doubt.
                    nodes[1].dataType = Type.SQL_DOUBLE;
                // A VoltDB extension to customize the SQL function set support
                // VoltDB swapped out this odd propagation of nulls.
                /* disable 1 line ...
                    nodes[0].dataType = nodes[1].dataType;
                    ... disabled 1 line */
                // End of VoltDB extension
                }
                if (nodes[0].dataType == null) {
                    throw Error.error(ErrorCode.X_42567);
                }
                if (!nodes[0].dataType.isNumberType() || !nodes[1].dataType.isNumberType()) {
                    throw Error.error(ErrorCode.X_42565);
                }
                nodes[0].dataType = Type.SQL_DOUBLE;
                nodes[1].dataType = Type.SQL_DOUBLE;
                dataType = Type.SQL_DOUBLE;
                break;
            }
        case FUNC_LN:
        case FUNC_EXP:
        case FUNC_SQRT:
            {
                if (nodes[0].dataType == null) {
                    nodes[0].dataType = Type.SQL_DOUBLE;
                }
                if (!nodes[0].dataType.isNumberType()) {
                    throw Error.error(ErrorCode.X_42565);
                }
                nodes[0].dataType = Type.SQL_DOUBLE;
                dataType = Type.SQL_DOUBLE;
                break;
            }
        case FUNC_ABS:
            if (nodes[0].dataType != null && nodes[0].dataType.isIntervalType()) {
                dataType = nodes[0].dataType;
                // A VoltDB extension to customize the SQL function set support
                parameterArg = 0;
                break;
            }
        // $FALL-THROUGH$
        case FUNC_FLOOR:
        case FUNC_CEILING:
            {
                if (nodes[0].dataType == null) {
                    nodes[0].dataType = Type.SQL_DOUBLE;
                }
                if (!nodes[0].dataType.isNumberType()) {
                    throw Error.error(ErrorCode.X_42565);
                }
                dataType = nodes[0].dataType;
                // A VoltDB extension to customize the SQL function set support
                parameterArg = 0;
                break;
            }
        case FUNC_WIDTH_BUCKET:
            {
                if (nodes[0].dataType == null || nodes[1].dataType == null || nodes[2].dataType == null || nodes[3].dataType == null) {
                    throw Error.error(ErrorCode.X_42567);
                }
                if (!nodes[0].dataType.isNumberType() || !nodes[1].dataType.isNumberType() || !nodes[2].dataType.isNumberType() || !nodes[3].dataType.isIntegralType()) {
                    throw Error.error(ErrorCode.X_42565);
                }
                dataType = nodes[3].dataType;
                // A VoltDB extension to customize the SQL function set support
                parameterArg = 3;
                break;
            }
        case FUNC_SUBSTRING_CHAR:
        case FUNC_SUBSTRING_BINARY:
            {
                if (nodes[0].dataType == null) {
                    // in 20.6 parameter not allowed as type cannot be determined as binary or char
                    throw Error.error(ErrorCode.X_42567);
                }
                if (nodes[1].dataType == null) {
                    nodes[1].dataType = NumberType.SQL_NUMERIC_DEFAULT_INT;
                }
                if (!nodes[1].dataType.isNumberType()) {
                    throw Error.error(ErrorCode.X_42565);
                }
                /* disable 1 line ...
                if (nodes[2] != null) {
                ... disabled 1 line */
                if (nodes.length > 2 && nodes[2] != null) {
                    // End of VoltDB extension
                    if (nodes[2].dataType == null) {
                        nodes[2].dataType = NumberType.SQL_NUMERIC_DEFAULT_INT;
                    }
                    if (!nodes[2].dataType.isNumberType()) {
                        throw Error.error(ErrorCode.X_42565);
                    }
                    nodes[2].dataType = ((NumberType) nodes[2].dataType).getIntegralType();
                }
                dataType = nodes[0].dataType;
                // A VoltDB extension to customize the SQL function set support
                parameterArg = 0;
                if (dataType.isCharacterType()) {
                    funcType = FUNC_SUBSTRING_CHAR;
                    if (dataType.typeCode == Types.SQL_CHAR) {
                        dataType = CharacterType.getCharacterType(Types.SQL_VARCHAR, dataType.precision);
                    }
                } else if (dataType.isBinaryType()) {
                    funcType = FUNC_SUBSTRING_BINARY;
                } else {
                    throw Error.error(ErrorCode.X_42565);
                }
                if (nodes.length > 3 && nodes[3] != null) {
                // always boolean constant if defined
                }
                break;
            }
        /*
            case FUNCTION_SUBSTRING_REG_EXPR :
                break;
            case FUNCTION_SUBSTRING_REGEX :
                break;
            */
        case FUNC_FOLD_LOWER:
        case FUNC_FOLD_UPPER:
            if (nodes[0].dataType == null) {
                throw Error.error(ErrorCode.X_42567);
            }
            dataType = nodes[0].dataType;
            // A VoltDB extension to customize the SQL function set support
            parameterArg = 0;
            if (!dataType.isCharacterType()) {
                throw Error.error(ErrorCode.X_42565);
            }
            break;
        /*
            case FUNCTION_TRANSCODING :
                break;
            case FUNCTION_TRANSLITERATION :
                break;
            case FUNCTION_REGEX_TRANSLITERATION :
                break;
             */
        case FUNC_TRIM_CHAR:
        case FUNC_TRIM_BINARY:
            if (nodes[0] == null) {
                nodes[0] = new ExpressionValue(ValuePool.getInt(Tokens.BOTH), Type.SQL_INTEGER);
            }
            // with the default value ' '.
            if (nodes[2] == null) {
                nodes[2] = nodes[1];
                nodes[1] = null;
            }
            // End of VoltDB extension
            if (nodes[2].dataType == null) {
                throw Error.error(ErrorCode.X_42567);
            }
            dataType = nodes[2].dataType;
            if (dataType.isCharacterType()) {
                funcType = FUNC_TRIM_CHAR;
                if (dataType.typeCode == Types.SQL_CHAR) {
                    dataType = CharacterType.getCharacterType(Types.SQL_VARCHAR, dataType.precision);
                }
                if (nodes[1] == null) {
                    nodes[1] = new ExpressionValue(" ", Type.SQL_CHAR);
                } else // A VoltDB extension to customize the SQL function set support
                if (nodes[1].dataType != Type.SQL_CHAR) {
                    nodes[1].dataType = Type.SQL_CHAR;
                }
            // End of VoltDB extension
            } else if (dataType.isBinaryType()) {
                funcType = FUNC_TRIM_BINARY;
                if (nodes[1] == null) {
                    nodes[1] = new ExpressionValue(new BinaryData(new byte[] { 0 }, false), Type.SQL_BINARY);
                }
            } else {
                throw Error.error(ErrorCode.X_42565);
            }
            break;
        case FUNC_OVERLAY_CHAR:
        case FUNC_OVERLAY_BINARY:
            {
                if (nodes[0].dataType == null) {
                    if (nodes[1].dataType == null) {
                        throw Error.error(ErrorCode.X_42567);
                    }
                    if (nodes[1].dataType.typeCode == Types.SQL_CLOB || nodes[1].dataType.isBinaryType()) {
                        nodes[0].dataType = nodes[1].dataType;
                    } else {
                        nodes[0].dataType = Type.SQL_VARCHAR_DEFAULT;
                    }
                }
                if (nodes[1].dataType == null) {
                    if (nodes[0].dataType.typeCode == Types.SQL_CLOB || nodes[0].dataType.isBinaryType()) {
                        nodes[1].dataType = nodes[0].dataType;
                    } else {
                        nodes[1].dataType = Type.SQL_VARCHAR_DEFAULT;
                    }
                }
                if (nodes[0].dataType.isCharacterType() && nodes[1].dataType.isCharacterType()) {
                    funcType = FUNC_OVERLAY_CHAR;
                    if (nodes[0].dataType.typeCode == Types.SQL_CLOB || nodes[1].dataType.typeCode == Types.SQL_CLOB) {
                        dataType = CharacterType.getCharacterType(Types.SQL_CLOB, nodes[0].dataType.precision + nodes[1].dataType.precision);
                    } else {
                        dataType = CharacterType.getCharacterType(Types.SQL_VARCHAR, nodes[0].dataType.precision + nodes[1].dataType.precision);
                    }
                } else if (nodes[0].dataType.isBinaryType() && nodes[1].dataType.isBinaryType()) {
                    funcType = FUNC_OVERLAY_BINARY;
                    if (nodes[0].dataType.typeCode == Types.SQL_BLOB || nodes[1].dataType.typeCode == Types.SQL_BLOB) {
                        dataType = BinaryType.getBinaryType(Types.SQL_BLOB, nodes[0].dataType.precision + nodes[1].dataType.precision);
                    } else {
                        dataType = BinaryType.getBinaryType(Types.SQL_VARBINARY, nodes[0].dataType.precision + nodes[1].dataType.precision);
                    }
                } else {
                    throw Error.error(ErrorCode.X_42565);
                }
                // A VoltDB extension to customize the SQL function set support
                parameterArg = 0;
                if (nodes[2].dataType == null) {
                    nodes[2].dataType = NumberType.SQL_NUMERIC_DEFAULT_INT;
                }
                if (!nodes[2].dataType.isNumberType()) {
                    throw Error.error(ErrorCode.X_42565);
                }
                nodes[2].dataType = ((NumberType) nodes[2].dataType).getIntegralType();
                if (nodes[3] != null) {
                    if (nodes[3].dataType == null) {
                        nodes[3].dataType = NumberType.SQL_NUMERIC_DEFAULT_INT;
                    }
                    if (!nodes[3].dataType.isNumberType()) {
                        throw Error.error(ErrorCode.X_42565);
                    }
                    nodes[3].dataType = ((NumberType) nodes[3].dataType).getIntegralType();
                }
                break;
            }
        /*
            case FUNCTION_CHAR_NORMALIZE :
                break;
            */
        case FUNC_CURRENT_CATALOG:
        case FUNC_CURRENT_DEFAULT_TRANSFORM_GROUP:
        case FUNC_CURRENT_PATH:
        case FUNC_CURRENT_ROLE:
        case FUNC_CURRENT_SCHEMA:
        case FUNC_CURRENT_TRANSFORM_GROUP_FOR_TYPE:
        case FUNC_CURRENT_USER:
        case FUNC_SESSION_USER:
        case FUNC_SYSTEM_USER:
        case FUNC_USER:
            dataType = SqlInvariants.SQL_IDENTIFIER;
            break;
        case FUNC_VALUE:
            break;
        case FUNC_CURRENT_DATE:
            dataType = CharacterType.SQL_DATE;
            break;
        case FUNC_CURRENT_TIME:
            {
                int precision = DateTimeType.defaultTimeFractionPrecision;
                if (nodes[0] != null) {
                    precision = ((Integer) nodes[0].valueData).intValue();
                }
                dataType = DateTimeType.getDateTimeType(Types.SQL_TIME_WITH_TIME_ZONE, precision);
                break;
            }
        case FUNC_CURRENT_TIMESTAMP:
            {
                // A VoltDB extension to disable TIME ZONE support
                dataType = Type.SQL_TIMESTAMP;
                break;
            }
        case FUNC_LOCALTIME:
            {
                int precision = DateTimeType.defaultTimeFractionPrecision;
                if (nodes.length > 0 && nodes[0] != null) {
                    precision = ((Integer) nodes[0].valueData).intValue();
                }
                dataType = DateTimeType.getDateTimeType(Types.SQL_TIME, precision);
                break;
            }
        case FUNC_LOCALTIMESTAMP:
            {
                int precision = DateTimeType.defaultTimestampFractionPrecision;
                if (nodes[0] != null) {
                    precision = ((Integer) nodes[0].valueData).intValue();
                }
                dataType = DateTimeType.getDateTimeType(Types.SQL_TIMESTAMP, precision);
                break;
            }
        default:
            throw Error.runtimeError(ErrorCode.U_S0500, "FunctionSQL");
    }
}
Also used : NumberType(org.hsqldb_voltpatches.types.NumberType) DTIType(org.hsqldb_voltpatches.types.DTIType) BinaryData(org.hsqldb_voltpatches.types.BinaryData)

Example 4 with BinaryData

use of org.hsqldb_voltpatches.types.BinaryData in project voltdb by VoltDB.

the class Expression method voltGetXML.

/**
     * VoltDB added method to get a non-catalog-dependent
     * representation of this HSQLDB object.
     * @param context The context encapsulates the current Session object and (optionally)
     * select statement display columns that may be needed to resolve some names.
     * @return A VoltXML tree structure.
     * @throws HSQLParseException
     */
VoltXMLElement voltGetXML(SimpleColumnContext context, String realAlias) throws HSQLParseException {
    // The voltXML representations of expressions tends to be driven much more by the expression's opType
    // than its Expression class.
    int exprOp = getType();
    // That case gets explicitly enabled here by fudging the opType from SIMPLE_COLUMN to COLUMN.
    if (exprOp == OpTypes.SIMPLE_COLUMN) {
        VoltXMLElement asResolved = context.resolveSimpleColumn(this);
        if (asResolved != null) {
            return asResolved;
        }
        // ENG-10429 moved the following two lines here. See fix note https://issues.voltdb.com/browse/ENG-10429.
        // convert the SIMPLE_COLUMN into a COLUMN
        opType = OpTypes.COLUMN;
        exprOp = OpTypes.COLUMN;
    }
    // Use the opType to find a pre-initialized prototype VoltXMLElement with the correct
    // name and any required hard-coded values pre-set.
    VoltXMLElement exp = prototypes.get(exprOp);
    if (exp == null) {
        // Must have found an unsupported opType.
        throwForUnsupportedExpression(exprOp);
    }
    // Duplicate the prototype and add any expression particulars needed for the specific opType value,
    // as well as a unique identifier, a possible alias, and child nodes.
    exp = exp.duplicate();
    exp.attributes.put("id", getUniqueId(context.m_session));
    if (realAlias != null) {
        exp.attributes.put("alias", realAlias);
    } else if ((alias != null) && (getAlias().length() > 0)) {
        exp.attributes.put("alias", getAlias());
    }
    // Add expression sub type
    if (exprSubType == OpTypes.ANY_QUANTIFIED) {
        exp.attributes.put("opsubtype", "any");
    } else if (exprSubType == OpTypes.ALL_QUANTIFIED) {
        exp.attributes.put("opsubtype", "all");
    }
    for (Expression expr : nodes) {
        if (expr != null) {
            VoltXMLElement vxmle = expr.voltGetXML(context, null);
            exp.children.add(vxmle);
            assert (vxmle != null);
        }
    }
    // VoltXMLElement.
    switch(exprOp) {
        case OpTypes.VALUE:
            // (I'm not sure why this MUST be the case --paul.)
            if (valueData == null) {
                String valueType = (dataType == null) ? "NULL" : Types.getTypeName(dataType.typeCode);
                exp.attributes.put("valuetype", valueType);
                return exp;
            }
            exp.attributes.put("valuetype", Types.getTypeName(dataType.typeCode));
            if (valueData instanceof TimestampData) {
                // When we get the default from the DDL,
                // it gets jammed into a TimestampData object.  If we
                // don't do this, we get a Java class/reference
                // string in the output schema for the DDL.
                // EL HACKO: I'm just adding in the timezone seconds
                // at the moment, hope this is right --izzy
                TimestampData time = (TimestampData) valueData;
                exp.attributes.put("value", Long.toString(Math.round((time.getSeconds() + time.getZone()) * 1e6) + time.getNanos() / 1000));
                return exp;
            }
            // convert binary values to hex
            if (valueData instanceof BinaryData) {
                BinaryData bd = (BinaryData) valueData;
                exp.attributes.put("value", hexEncode(bd.getBytes()));
                return exp;
            }
            // Otherwise just string format the value.
            if (dataType instanceof NumberType && !dataType.isIntegralType()) {
                // remove the scentific exponent notation
                exp.attributes.put("value", new BigDecimal(valueData.toString()).toPlainString());
                return exp;
            }
            exp.attributes.put("value", valueData.toString());
            return exp;
        case OpTypes.COLUMN:
            ExpressionColumn ec = (ExpressionColumn) this;
            return ec.voltAnnotateColumnXML(exp);
        case OpTypes.COALESCE:
            return convertUsingColumnrefToCoaleseExpression(context.m_session, exp, dataType);
        case OpTypes.SQL_FUNCTION:
            FunctionSQL fn = (FunctionSQL) this;
            return fn.voltAnnotateFunctionXML(exp);
        case OpTypes.COUNT:
        case OpTypes.SUM:
        case OpTypes.AVG:
            if (((ExpressionAggregate) this).isDistinctAggregate) {
                exp.attributes.put("distinct", "true");
            }
            return exp;
        case OpTypes.ORDER_BY:
            if (((ExpressionOrderBy) this).isDescending()) {
                exp.attributes.put("desc", "true");
            }
            return exp;
        case OpTypes.CAST:
            if (dataType == null) {
                throw new HSQLParseException("VoltDB could not determine the type in a CAST operation");
            }
            exp.attributes.put("valuetype", dataType.getNameString());
            return exp;
        case OpTypes.TABLE_SUBQUERY:
            if (subQuery == null || subQuery.queryExpression == null) {
                throw new HSQLParseException("VoltDB could not determine the subquery");
            }
            ExpressionColumn[] parameters = new ExpressionColumn[0];
            exp.children.add(StatementQuery.voltGetXMLExpression(subQuery.queryExpression, parameters, context.m_session));
            return exp;
        case OpTypes.ALTERNATIVE:
            assert (nodes.length == 2);
            // If with ELSE clause, pad NULL with it.
            if (nodes[RIGHT] instanceof ExpressionValue) {
                ExpressionValue val = (ExpressionValue) nodes[RIGHT];
                if (val.valueData == null && val.dataType == Type.SQL_ALL_TYPES) {
                    exp.children.get(RIGHT).attributes.put("valuetype", dataType.getNameString());
                }
            }
        case OpTypes.CASEWHEN:
            // Hsql has check dataType can not be null.
            assert (dataType != null);
            exp.attributes.put("valuetype", dataType.getNameString());
            return exp;
        case OpTypes.WINDOWED_RANK:
        case OpTypes.WINDOWED_DENSE_RANK:
        case OpTypes.WINDOWED_COUNT:
        case OpTypes.WINDOWED_MIN:
        case OpTypes.WINDOWED_MAX:
        case OpTypes.WINDOWED_SUM:
            assert (dataType != null);
            assert (this instanceof ExpressionWindowed);
            exp.attributes.put("valuetype", dataType.getNameString());
            ExpressionWindowed erank = (ExpressionWindowed) this;
            return erank.voltAnnotateWindowedAggregateXML(exp, context);
        default:
            return exp;
    }
}
Also used : TimestampData(org.hsqldb_voltpatches.types.TimestampData) BigDecimal(java.math.BigDecimal) HSQLParseException(org.hsqldb_voltpatches.HSQLInterface.HSQLParseException) NumberType(org.hsqldb_voltpatches.types.NumberType) BinaryData(org.hsqldb_voltpatches.types.BinaryData)

Example 5 with BinaryData

use of org.hsqldb_voltpatches.types.BinaryData in project voltdb by VoltDB.

the class Like method getStartsWith.

private Object getStartsWith() {
    if (iLen == 0) {
        return isBinary ? BinaryData.zeroLengthBinary : "";
    }
    StringBuffer sb = null;
    HsqlByteArrayOutputStream os = null;
    if (isBinary) {
        os = new HsqlByteArrayOutputStream();
    } else {
        sb = new StringBuffer();
    }
    int i = 0;
    for (; i < iLen && wildCardType[i] == 0; i++) {
        if (isBinary) {
            os.writeByte(cLike[i]);
        } else {
            sb.append(cLike[i]);
        }
    }
    if (i == 0) {
        return null;
    }
    return isBinary ? new BinaryData(os.toByteArray(), false) : sb.toString();
}
Also used : BinaryData(org.hsqldb_voltpatches.types.BinaryData) HsqlByteArrayOutputStream(org.hsqldb_voltpatches.lib.HsqlByteArrayOutputStream)

Aggregations

BinaryData (org.hsqldb_voltpatches.types.BinaryData)12 BitMap (org.hsqldb_voltpatches.store.BitMap)2 JavaObjectData (org.hsqldb_voltpatches.types.JavaObjectData)2 NumberType (org.hsqldb_voltpatches.types.NumberType)2 Serializable (java.io.Serializable)1 BigDecimal (java.math.BigDecimal)1 HSQLParseException (org.hsqldb_voltpatches.HSQLInterface.HSQLParseException)1 HsqlException (org.hsqldb_voltpatches.HsqlException)1 HsqlByteArrayOutputStream (org.hsqldb_voltpatches.lib.HsqlByteArrayOutputStream)1 DTIType (org.hsqldb_voltpatches.types.DTIType)1 TimestampData (org.hsqldb_voltpatches.types.TimestampData)1 Type (org.hsqldb_voltpatches.types.Type)1