Date getDate()

in asterixdb-jdbc/asterix-jdbc-core/src/main/java/org/apache/asterix/jdbc/core/ADBRowStore.java [601:621]


    Date getDate(int columnIndex, Calendar cal) throws SQLException {
        ADBDatatype valueType = getColumnType(columnIndex);
        switch (valueType) {
            case MISSING:
            case NULL:
                return null;
            case DATE:
                return toDateFromDateChronon(getColumnRegister(columnIndex, 0), getTimeZone(cal, tzSystem));
            case DATETIME:
                return toDateFromDatetimeChronon(getColumnRegister(columnIndex, 0), getTimeZone(cal, tzSystem));
            case STRING:
                try {
                    LocalDate d = LocalDate.parse(getStringFromObjectStore(columnIndex)); // TODO:review
                    return new Date(d.getYear() - 1900, d.getMonthValue() - 1, d.getDayOfMonth());
                } catch (DateTimeParseException e) {
                    throw getErrorReporter().errorInvalidValueOfType(valueType);
                }
            default:
                throw getErrorReporter().errorUnexpectedType(valueType);
        }
    }