presto-main/src/main/java/io/prestosql/sql/planner/iterative/rule/CanonicalizeExpressionRewriter.java/CanonicalizeExpressionRewriter/rewriteExtract
class CanonicalizeExpressionRewriter:        @Override
        public Expression rewriteExtract(Extract node, Void context, ExpressionTreeRewriter<Void> treeRewriter)
        {
            Expression value = treeRewriter.rewrite(node.getExpression(), context);
            Type type = expressionTypes.get(NodeRef.of(node.getExpression()));

            switch (node.getField()) {
                case YEAR:
                    return new FunctionCallBuilder(metadata)
                            .setName(QualifiedName.of("year"))
                            .addArgument(type, value)
                            .build();
                case QUARTER:
                    return new FunctionCallBuilder(metadata)
                            .setName(QualifiedName.of("quarter"))
                            .addArgument(type, value)
                            .build();
                case MONTH:
                    return new FunctionCallBuilder(metadata)
                            .setName(QualifiedName.of("month"))
                            .addArgument(type, value)
                            .build();
                case WEEK:
                    return new FunctionCallBuilder(metadata)
                            .setName(QualifiedName.of("week"))
                            .addArgument(type, value)
                            .build();
                case DAY:
                case DAY_OF_MONTH:
                    return new FunctionCallBuilder(metadata)
                            .setName(QualifiedName.of("day"))
                            .addArgument(type, value)
                            .build();
                case DAY_OF_WEEK:
                case DOW:
                    return new FunctionCallBuilder(metadata)
                            .setName(QualifiedName.of("day_of_week"))
                            .addArgument(type, value)
                            .build();
                case DAY_OF_YEAR:
                case DOY:
                    return new FunctionCallBuilder(metadata)
                            .setName(QualifiedName.of("day_of_year"))
                            .addArgument(type, value)
                            .build();
                case YEAR_OF_WEEK:
                case YOW:
                    return new FunctionCallBuilder(metadata)
                            .setName(QualifiedName.of("year_of_week"))
                            .addArgument(type, value)
                            .build();
                case HOUR:
                    return new FunctionCallBuilder(metadata)
                            .setName(QualifiedName.of("hour"))
                            .addArgument(type, value)
                            .build();
                case MINUTE:
                    return new FunctionCallBuilder(metadata)
                            .setName(QualifiedName.of("minute"))
                            .addArgument(type, value)
                            .build();
                case SECOND:
                    return new FunctionCallBuilder(metadata)
                            .setName(QualifiedName.of("second"))
                            .addArgument(type, value)
                            .build();
                case TIMEZONE_MINUTE:
                    return new FunctionCallBuilder(metadata)
                            .setName(QualifiedName.of("timezone_minute"))
                            .addArgument(type, value)
                            .build();
                case TIMEZONE_HOUR:
                    return new FunctionCallBuilder(metadata)
                            .setName(QualifiedName.of("timezone_hour"))
                            .addArgument(type, value)
                            .build();
            }

            throw new UnsupportedOperationException("not yet implemented: " + node.getField());
        }