Java Code Examples for org.apache.calcite.avatica.util.TimeUnit#MINUTE

The following examples show how to use org.apache.calcite.avatica.util.TimeUnit#MINUTE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExpressionConverter.java    From flink with Apache License 2.0 6 votes vote down vote up
private static TimeUnit timePointUnitToTimeUnit(TimePointUnit unit) {
	switch (unit) {
		case YEAR:
			return TimeUnit.YEAR;
		case MONTH:
			return TimeUnit.MONTH;
		case DAY:
			return TimeUnit.DAY;
		case HOUR:
			return TimeUnit.HOUR;
		case MINUTE:
			return TimeUnit.MINUTE;
		case SECOND:
			return TimeUnit.SECOND;
		case QUARTER:
			return TimeUnit.QUARTER;
		case WEEK:
			return TimeUnit.WEEK;
		case MILLISECOND:
			return TimeUnit.MILLISECOND;
		case MICROSECOND:
			return TimeUnit.MICROSECOND;
		default:
			throw new UnsupportedOperationException("TimePointUnit is: " + unit);
	}
}
 
Example 2
Source File: MycatCalciteMySqlNodeVisitor.java    From Mycat2 with GNU General Public License v3.0 4 votes vote down vote up
public static TimeUnit[] getTimeUnit(SQLIntervalUnit unit) {
    TimeUnit[] timeUnits = new TimeUnit[2];
    switch (unit) {
        // case MICROSECOND:
        // timeUnits[0] = TimeUnit.MICROSECOND;
        // timeUnits[1] = TimeUnit.MICROSECOND;
        // break;
        case SECOND:
            timeUnits[0] = TimeUnit.SECOND;
            timeUnits[1] = TimeUnit.SECOND;
            break;
        case MINUTE:
            timeUnits[0] = TimeUnit.MINUTE;
            timeUnits[1] = TimeUnit.MINUTE;
            break;
        case HOUR:
            timeUnits[0] = TimeUnit.HOUR;
            timeUnits[1] = TimeUnit.HOUR;
            break;
        case DAY:
            timeUnits[0] = TimeUnit.DAY;
            timeUnits[1] = TimeUnit.DAY;
            break;
        case WEEK:
            timeUnits[0] = TimeUnit.WEEK;
            timeUnits[1] = TimeUnit.WEEK;
            break;
        case MONTH:
            timeUnits[0] = TimeUnit.MONTH;
            timeUnits[1] = TimeUnit.MONTH;
            break;
        case QUARTER:
            timeUnits[0] = TimeUnit.QUARTER;
            timeUnits[1] = TimeUnit.QUARTER;
            break;
        case YEAR:
            timeUnits[0] = TimeUnit.YEAR;
            timeUnits[1] = TimeUnit.YEAR;
            break;
        // case MINUTE_MICROSECOND:
        // timeUnits[0] = TimeUnit.MINUTE;
        // timeUnits[1] = TimeUnit.MICROSECOND;
        // break;
        case MINUTE_SECOND:
            timeUnits[0] = TimeUnit.MINUTE;
            timeUnits[1] = TimeUnit.SECOND;
            break;
        // case HOUR_MICROSECOND:
        // timeUnits[0] = TimeUnit.HOUR;
        // timeUnits[1] = TimeUnit.MICROSECOND;
        // break;
        case HOUR_SECOND:
            timeUnits[0] = TimeUnit.HOUR;
            timeUnits[1] = TimeUnit.SECOND;
            break;
        case HOUR_MINUTE:
            timeUnits[0] = TimeUnit.HOUR;
            timeUnits[1] = TimeUnit.MINUTE;
            break;
        // case DAY_MICROSECOND:
        // timeUnits[0] = TimeUnit.DAY;
        // timeUnits[1] = TimeUnit.MICROSECOND;
        // break;
        case DAY_SECOND:
            timeUnits[0] = TimeUnit.DAY;
            timeUnits[1] = TimeUnit.SECOND;
            break;
        case DAY_MINUTE:
            timeUnits[0] = TimeUnit.DAY;
            timeUnits[1] = TimeUnit.MINUTE;
            break;
        case DAY_HOUR:
            timeUnits[0] = TimeUnit.DAY;
            timeUnits[1] = TimeUnit.HOUR;
            break;
        case YEAR_MONTH:
            timeUnits[0] = TimeUnit.YEAR;
            timeUnits[1] = TimeUnit.MONTH;
            break;
        default:
            throw new ParserException("Unsupported time unit");
    }
    return timeUnits;
}