text:
<?php

namespace Sonata\AdminBundle\DependencyInjection;

use JMS\DiExtraBundle\DependencyInjection\Configuration as JMSDiExtraBundleDependencyInjectionConfiguration;
use Sonata\AdminBundle\Admin\AbstractAdmin;
use Sonata\AdminBundle\Admin\AbstractAdminExtension;
use Sonata\AdminBundle\Admin\AdminExtensionInterface;
use Sonata\AdminBundle\Admin\AdminHelper;
use Sonata\AdminBundle\Admin\AdminInterface;
use Sonata\AdminBundle\Admin\BaseFieldDescription;
use Sonata\AdminBundle\Admin\FieldDescriptionCollection;
use Sonata\AdminBundle\Admin\FieldDescriptionInterface;
use Sonata\AdminBundle\Admin\Pool;
use Sonata\AdminBundle\Block\AdminListBlockService;
use Sonata\AdminBundle\Builder\DatagridBuilderInterface;
use Sonata\AdminBundle\Builder\FormContractorInterface;
use Sonata\AdminBundle\Builder\ListBuilderInterface;
use Sonata\AdminBundle\Builder\RouteBuilderInterface;
use Sonata\AdminBundle\Builder\ShowBuilderInterface;
use Sonata\AdminBundle\Datagrid\Datagrid;
use Sonata\AdminBundle\Datagrid\DatagridInterface;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Datagrid\Pager;
use Sonata\AdminBundle\Datagrid\PagerInterface;
use Sonata\AdminBundle\Datagrid\ProxyQueryInterface;
use Sonata\AdminBundle\Exception\ModelManagerException;
use Sonata\AdminBundle\Exception\NoValueException;
use Sonata\AdminBundle\Filter\Filter;
use Sonata\AdminBundle\Filter\FilterFactory;
use Sonata\AdminBundle\Filter\FilterFactoryInterface;
use Sonata\AdminBundle\Filter\FilterInterface;
use Sonata\AdminBundle\Form\DataTransformer\ArrayToModelTransformer;
use Sonata\AdminBundle\Form\DataTransformer\ModelsToArrayTransformer;
use Sonata\AdminBundle\Form\DataTransformer\ModelToIdTransformer;
use Sonata\AdminBundle\Form\EventListener\MergeCollectionListener;
use Sonata\AdminBundle\Form\Extension\Field\Type\FormTypeFieldExtension;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Form\Type\AdminType;
use Sonata\AdminBundle\Form\Type\Filter\ChoiceType;
use Sonata\AdminBundle\Form\Type\Filter\DateRangeType;
use Sonata\AdminBundle\Form\Type\Filter\DateTimeRangeType;
use Sonata\AdminBundle\Form\Type\Filter\DateTimeType;
use Sonata\AdminBundle\Form\Type\Filter\DateType;
use Sonata\AdminBundle\Form\Type\Filter\DefaultType;
use Sonata\AdminBundle\Form\Type\Filter\NumberType;
use Sonata\AdminBundle\Form\Type\ModelListType;
use Sonata\AdminBundle\Form\Type\ModelReferenceType;
use Sonata\AdminBundle\Form\Type\ModelType;
use Sonata\AdminBundle\Guesser\TypeGuesserChain;
use Sonata\AdminBundle\Guesser\TypeGuesserInterface;
use Sonata\AdminBundle\Model\AuditManager;
use Sonata\AdminBundle\Model\AuditManagerInterface;
use Sonata\AdminBundle\Model\AuditReaderInterface;
use Sonata\AdminBundle\Model\ModelManagerInterface;
use Sonata\AdminBundle\Route\AdminPoolLoader;
use Sonata\AdminBundle\Route\DefaultRouteGenerator;
use Sonata\AdminBundle\Route\PathInfoBuilder;
use Sonata\AdminBundle\Route\QueryStringBuilder;
use Sonata\AdminBundle\Route\RouteCollection;
use Sonata\AdminBundle\Route\RouteGeneratorInterface;
use Sonata\AdminBundle\Security\Acl\Permission\AdminPermissionMap;
use Sonata\AdminBundle\Security\Acl\Permission\MaskBuilder;
use Sonata\AdminBundle\Security\Handler\AclSecurityHandler;
use Sonata\AdminBundle\Security\Handler\AclSecurityHandlerInterface;
use Sonata\AdminBundle\Security\Handler\NoopSecurityHandler;
use Sonata\AdminBundle\Security\Handler\RoleSecurityHandler;
use Sonata\AdminBundle\Security\Handler\SecurityHandlerInterface;
use Sonata\AdminBundle\Show\ShowMapper;
use Sonata\AdminBundle\Translator\BCLabelTranslatorStrategy;
use Sonata\AdminBundle\Translator\FormLabelTranslatorStrategy;
use Sonata\AdminBundle\Translator\LabelTranslatorStrategyInterface;
use Sonata\AdminBundle\Translator\NativeLabelTranslatorStrategy;
use Sonata\AdminBundle\Translator\NoopLabelTranslatorStrategy;
use Sonata\AdminBundle\Translator\UnderscoreLabelTranslatorStrategy;
use Sonata\AdminBundle\Twig\Extension\SonataAdminExtension as TwigSonataAdminExtension;
use Sonata\AdminBundle\Util\AdminAclManipulator;
use Sonata\AdminBundle\Util\AdminAclManipulatorInterface;
use Sonata\AdminBundle\Util\FormBuilderIterator;
use Sonata\AdminBundle\Util\FormViewIterator;
use Sonata\AdminBundle\Util\ObjectAclManipulator;
use Sonata\AdminBundle\Util\ObjectAclManipulatorInterface;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType as SymfonyChoiceType;
use Symfony\Component\Form\Extension\Core\Type\DateTimeType as SymfonyDateTimeType;
use Symfony\Component\Form\Extension\Core\Type\DateType as SymfonyDateType;
use Symfony\Component\Form\Extension\Core\Type\EmailType as SymfonyEmailType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType as SymfonyIntegerType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType as SymfonyTextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType as SymfonyTextType;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
 * @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
 * @author Michael Williams <michael.williams@funsational.com>
 */
class SonataAdminExtension extends Extension implements PrependExtensionInterface
{
    public function load(array $configs, ContainerBuilder $container)
    {
        $bundles = $container->getParameter('kernel.bundles');

        if (isset($bundles['SonataUserBundle'])) {
            // integrate the SonataUserBundle / FOSUserBundle if the bundle exists
            array_unshift($configs, [
                'templates' => [
                    'user_block' => '@SonataUser/Admin/Core/user_block.html.twig',
                ],
            ]);
        }

        if (isset($bundles['SonataIntlBundle'])) {
            // integrate the SonataUserBundle if the bundle exists
            array_unshift($configs, [
                'templates' => [
                    'history_revision_timestamp' => '@SonataIntl/CRUD/history_revision_timestamp.html.twig',
                ],
            ]);
        }

        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
        $loader->load('twig.xml');
        $loader->load('core.xml');
        $loader->load('form_types.xml');
        $loader->load('validator.xml');
        $loader->load('route.xml');
        $loader->load('block.xml');
        $loader->load('menu.xml');
        $loader->load('commands.xml');

        if (isset($bundles['SonataExporterBundle'])) {
            $loader->load('exporter.xml');
        }

        $configuration = $this->getConfiguration($configs, $container);
        $config = $this->processConfiguration($configuration, $configs);

        $config['options']['javascripts'] = $this->buildJavascripts($config);
        $config['options']['stylesheets'] = $this->buildStylesheets($config);
        $config['options']['role_admin'] = $config['security']['role_admin'];
        $config['options']['role_super_admin'] = $config['security']['role_super_admin'];
        $config['options']['search'] = $config['search'];

        $pool = $container->getDefinition('sonata.admin.pool');
        $pool->replaceArgument(1, $config['title']);
        $pool->replaceArgument(2, $config['title_logo']);
        $pool->replaceArgument(3, $config['options']);

        if (false === $config['options']['lock_protection']) {
            $container->removeDefinition('sonata.admin.lock.extension');
        }

        $container->setParameter('sonata.admin.configuration.global_search.empty_boxes', $config['global_search']['empty_boxes']);
        $container->setParameter('sonata.admin.configuration.templates', $config['templates'] + [
            'user_block' => '@SonataAdmin/Core/user_block.html.twig',
            'add_block' => '@SonataAdmin/Core/add_block.html.twig',
            'layout' => '@SonataAdmin/standard_layout.html.twig',
            'ajax' => '@SonataAdmin/ajax_layout.html.twig',
            'dashboard' => '@SonataAdmin/Core/dashboard.html.twig',
            'list' => '@SonataAdmin/CRUD/list.html.twig',
            'filter' => '@SonataAdmin/Form/filter_admin_fields.html.twig',
            'show' => '@SonataAdmin/CRUD/show.html.twig',
            'show_compare' => '@SonataAdmin/CRUD/show_compare.html.twig',
            'edit' => '@SonataAdmin/CRUD/edit.html.twig',
            'history' => '@SonataAdmin/CRUD/history.html.twig',
            'history_revision_timestamp' => '@SonataAdmin/CRUD/history_revision_timestamp.html.twig',
            'acl' => '@SonataAdmin/CRUD/acl.html.twig',
            'action' => '@SonataAdmin/CRUD/action.html.twig',
            'short_object_description' => '@SonataAdmin/Helper/short-object-description.html.twig',
            'preview' => '@SonataAdmin/CRUD/preview.html.twig',
            'list_block' => '@SonataAdmin/Block/block_admin_list.html.twig',
            'delete' => '@SonataAdmin/CRUD/delete.html.twig',
            'batch' => '@SonataAdmin/CRUD/list__batch.html.twig',
            'select' => '@SonataAdmin/CRUD/list__select.html.twig',
            'batch_confirmation' => '@SonataAdmin/CRUD/batch_confirmation.html.twig',
            'inner_list_row' => '@SonataAdmin/CRUD/list_inner_row.html.twig',
            'base_list_field' => '@SonataAdmin/CRUD/base_list_field.html.twig',
            'pager_links' => '@SonataAdmin/Pager/links.html.twig',
            'pager_results' => '@SonataAdmin/Pager/results.html.twig',
            'tab_menu_template' => '@SonataAdmin/Core/tab_menu_template.html.twig',
            'knp_menu_template' => '@SonataAdmin/Menu/sonata_menu.html.twig',
            'outer_list_rows_mosaic' => '@SonataAdmin/CRUD/list_outer_rows_mosaic.html.twig',
            'outer_list_rows_list' => '@SonataAdmin/CRUD/list_outer_rows_list.html.twig',
            'outer_list_rows_tree' => '@SonataAdmin/CRUD/list_outer_rows_tree.html.twig',
        ]);
        $container->setParameter('sonata.admin.configuration.admin_services', $config['admin_services']);
        $container->setParameter('sonata.admin.configuration.dashboard_groups', $config['dashboard']['groups']);
        $container->setParameter('sonata.admin.configuration.dashboard_blocks', $config['dashboard']['blocks']);
        $container->setParameter('sonata.admin.configuration.sort_admins', $config['options']['sort_admins']);
        $container->setParameter('sonata.admin.configuration.breadcrumbs', $config['breadcrumbs']);

        if (null === $config['security']['acl_user_manager'] && isset($bundles['FOSUserBundle'])) {
            $container->setParameter('sonata.admin.security.acl_user_manager', 'fos_user.user_manager');
        } else {
            $container->setParameter('sonata.admin.security.acl_user_manager', $config['security']['acl_user_manager']);
        }

        $container->setAlias('sonata.admin.security.handler', $config['security']['handler']);

        switch ($config['security']['handler']) {
            case 'sonata.admin.security.handler.role':
                if (0 === count($config['security']['information'])) {
                    $config['security']['information'] = [
                        'EDIT' => ['EDIT'],
                        'LIST' => ['LIST'],
                        'CREATE' => ['CREATE'],
                        'VIEW' => ['VIEW'],
                        'DELETE' => ['DELETE'],
                        'EXPORT' => ['EXPORT'],
                        'ALL' => ['ALL'],
                    ];
                }

                break;
            case 'sonata.admin.security.handler.acl':
                if (0 === count($config['security']['information'])) {
                    $config['security']['information'] = [
                        'GUEST' => ['VIEW', 'LIST'],
                        'STAFF' => ['EDIT', 'LIST', 'CREATE'],
                        'EDITOR' => ['OPERATOR', 'EXPORT'],
                        'ADMIN' => ['MASTER'],
                    ];
                }

                break;
        }

        $container->setParameter('sonata.admin.configuration.security.role_admin', $config['security']['role_admin']);
        $container->setParameter('sonata.admin.configuration.security.role_super_admin', $config['security']['role_super_admin']);
        $container->setParameter('sonata.admin.configuration.security.information', $config['security']['information']);
        $container->setParameter('sonata.admin.configuration.security.admin_permissions', $config['security']['admin_permissions']);
        $container->setParameter('sonata.admin.configuration.security.object_permissions', $config['security']['object_permissions']);

        $loader->load('security.xml');

        $container->setParameter('sonata.admin.extension.map', $config['extensions']);

        /*
         * This is a work in progress, so for now it is hardcoded
         */
        $classes = [
            'email' => '',
            'textarea' => '',
            'text' => '',
            'choice' => '',
            'integer' => '',
            'datetime' => 'sonata-medium-date',
            'date' => 'sonata-medium-date',

            // SF3+
            SymfonyChoiceType::class => '',
            SymfonyDateType::class => 'sonata-medium-date',
            SymfonyDateTimeType::class => 'sonata-medium-date',
            SymfonyEmailType::class => '',
            SymfonyIntegerType::class => '',
            SymfonyTextareaType::class => '',
            SymfonyTextType::class => '',
        ];

        $container->getDefinition('sonata.admin.form.extension.field')
            ->replaceArgument(0, $classes)
            ->replaceArgument(1, $config['options']);

        // remove non used service
        if (!isset($bundles['JMSTranslationBundle'])) {
            $container->removeDefinition('sonata.admin.translator.extractor.jms_translator_bundle');
        }

        //remove non-Mopa compatibility layer
        if (isset($bundles['MopaBootstrapBundle'])) {
            $container->removeDefinition('sonata.admin.form.extension.field.mopa');
        }

        // set filter persistence
        $container->setParameter('sonata.admin.configuration.filters.persist', $config['persist_filters']);
        $container->setParameter('sonata.admin.configuration.filters.persister', $config['filter_persister']);

        $container->setParameter('sonata.admin.configuration.show.mosaic.button', $config['show_mosaic_button']);

        $container->setParameter('sonata.admin.configuration.translate_group_label', $config['translate_group_label']);

        if (\PHP_VERSION_ID < 70000) {
            $this->configureClassesToCompile();
        }

        $this->replacePropertyAccessor($container);
    }

    /**
     * Allow an extension to prepend the extension configurations.
     *
     * NEXT_MAJOR: remove all code that deals with JMSDiExtraBundle
     */
    public function prepend(ContainerBuilder $container)
    {
        $bundles = $container->getParameter('kernel.bundles');

        if (!isset($bundles['JMSDiExtraBundle'])) {
            return;
        }

        $configs = $container->getExtensionConfig($this->getAlias());
        $config = $this->processConfiguration(new Configuration(), $configs);
        if (!$config['options']['enable_jms_di_extra_autoregistration']) {
            return;
        }

        $sonataAdminPattern = 'Sonata\AdminBundle\Annotation';
        $annotationPatternsConfigured = false;

        $diExtraConfigs = $container->getExtensionConfig('jms_di_extra');
        foreach ($diExtraConfigs as $diExtraConfig) {
            if (isset($diExtraConfig['annotation_patterns'])) {
                // don't add our own pattern if user has already done so
                if (false !== array_search($sonataAdminPattern, $diExtraConfig['annotation_patterns'])) {
                    return;
                }
                $annotationPatternsConfigured = true;

                break;
            }
        }

        @trigger_error(
            'Automatic registration of annotations is deprecated since 3.14, to be removed in 4.0.',
            E_USER_DEPRECATED
        );

        if ($annotationPatternsConfigured) {
            $annotationPatterns = [$sonataAdminPattern];
        } else {
            // get annotation_patterns default from DiExtraBundle configuration
            $diExtraConfigDefinition = new JMSDiExtraBundleDependencyInjectionConfiguration();
            // FIXME: this will break if DiExtraBundle adds any mandatory configuration
            $diExtraConfig = $this->processConfiguration($diExtraConfigDefinition, []);

            $annotationPatterns = $diExtraConfig['annotation_patterns'];
            $annotationPatterns[] = $sonataAdminPattern;
        }

        $container->prependExtensionConfig(
            'jms_di_extra',
            [
                'annotation_patterns' => $annotationPatterns,
            ]
        );
    }

    public function configureClassesToCompile()
    {
        $this->addClassesToCompile([
            AbstractAdmin::class,
            AbstractAdminExtension::class,
            AdminExtensionInterface::class,
            AdminHelper::class,
            AdminInterface::class,
            BaseFieldDescription::class,
            FieldDescriptionCollection::class,
            FieldDescriptionInterface::class,
            Pool::class,
            AdminListBlockService::class,
            DatagridBuilderInterface::class,
            FormContractorInterface::class,
            ListBuilderInterface::class,
            RouteBuilderInterface::class,
            ShowBuilderInterface::class,
            Datagrid::class,
            DatagridInterface::class,
            DatagridMapper::class,
            ListMapper::class,
            Pager::class,
            PagerInterface::class,
            ProxyQueryInterface::class,
            ModelManagerException::class,
            NoValueException::class,
            Filter::class,
            FilterFactory::class,
            FilterFactoryInterface::class,
            FilterInterface::class,
            ArrayToModelTransformer::class,
            ModelsToArrayTransformer::class,
            ModelToIdTransformer::class,
            MergeCollectionListener::class,
            FormTypeFieldExtension::class,
            FormMapper::class,
            AdminType::class,
            ChoiceType::class,
            DateRangeType::class,
            DateTimeRangeType::class,
            DateTimeType::class,
            DateType::class,
            DefaultType::class,
            NumberType::class,
            ModelReferenceType::class,
            ModelType::class,
            ModelListType::class,
            TypeGuesserChain::class,
            TypeGuesserInterface::class,
            AuditManager::class,
            AuditManagerInterface::class,
            AuditReaderInterface::class,
            ModelManagerInterface::class,
            AdminPoolLoader::class,
            DefaultRouteGenerator::class,
            PathInfoBuilder::class,
            QueryStringBuilder::class,
            RouteCollection::class,
            RouteGeneratorInterface::class,
            AdminPermissionMap::class,
            MaskBuilder::class,
            AclSecurityHandler::class,
            AclSecurityHandlerInterface::class,
            NoopSecurityHandler::class,
            RoleSecurityHandler::class,
            SecurityHandlerInterface::class,
            ShowMapper::class,
            BCLabelTranslatorStrategy::class,
            FormLabelTranslatorStrategy::class,
            LabelTranslatorStrategyInterface::class,
            NativeLabelTranslatorStrategy::class,
            NoopLabelTranslatorStrategy::class,
            UnderscoreLabelTranslatorStrategy::class,
            TwigSonataAdminExtension::class,
            AdminAclManipulator::class,
            AdminAclManipulatorInterface::class,
            FormBuilderIterator::class,
            FormViewIterator::class,
            ObjectAclManipulator::class,
            ObjectAclManipulatorInterface::class,
        ]);
    }

    public function getNamespace()
    {
        return 'https://sonata-project.org/schema/dic/admin';
    }

    private function buildStylesheets($config)
    {
        return $this->mergeArray(
            $config['assets']['stylesheets'],
            $config['assets']['extra_stylesheets'],
            $config['assets']['remove_stylesheets']
        );
    }

    private function buildJavascripts($config)
    {
        return $this->mergeArray(
            $config['assets']['javascripts'],
            $config['assets']['extra_javascripts'],
            $config['assets']['remove_javascripts']
        );
    }

    private function mergeArray($array, $addArray, $removeArray = [])
    {
        foreach ($addArray as $toAdd) {
            array_push($array, $toAdd);
        }
        foreach ($removeArray as $toRemove) {
            if (in_array($toRemove, $array)) {
                array_splice($array, array_search($toRemove, $array), 1);
            }
        }

        return $array;
    }

    private function replacePropertyAccessor(ContainerBuilder $container)
    {
        if (!$container->has('form.property_accessor')) {
            return;
        }

        $pool = $container->getDefinition('sonata.admin.pool');
        $pool->replaceArgument(4, new Reference('form.property_accessor'));

        $modelChoice = $container->getDefinition('sonata.admin.form.type.model_choice');
        $modelChoice->replaceArgument(0, new Reference('form.property_accessor'));
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
  <entity name="Places" table="places">
    <id name="id" type="integer" column="id">
      <generator strategy="IDENTITY"/>
    </id>
    <field name="placesId" type="string" column="places_id" length="255" nullable="true"/>
    <field name="placesName" type="string" column="places_name" length="255" nullable="false"/>
    <field name="placesAddress" type="string" column="places_address" length="255" nullable="true"/>
    <field name="placesRating" type="integer" column="places_rating" nullable="true"/>
    <field name="placesLat" type="string" column="places_lat" length="255" nullable="true"/>
    <field name="placesLng" type="string" column="places_lng" length="255" nullable="true"/>
    <field name="placesOpenNow" type="string" column="places_open_now" length="255" nullable="true"/>
    <field name="placesReference" type="string" column="places_reference" length="255" nullable="true"/>
    <field name="placesTypes" type="string" column="places_types" length="255" nullable="true"/>
    <field name="placesIcon" type="string" column="places_icon" length="255" nullable="true"/>
    <field name="placePhoto" type="string" column="place_photo" length="255" nullable="true"/>
  </entity>
</doctrine-mapping>

redpajama_set_name: RedPajamaGithub


text:
require 'json'
require 'restclient'
require 'cgi'
require 'active_support/configurable'
require 'active_support/core_ext/hash'
require 'yaml'
require 'prawn-svg'
require 'erb'
require 'optparse'

module JiraCards
  PATH = File.expand_path '../..', __FILE__
  LIB_PATH = File.expand_path '..', __FILE__
  RESOURCES_PATH = File.expand_path '../../resources', __FILE__
  CONFIG_PATH = File.expand_path '../../config', __FILE__
end

Dir[JiraCards::LIB_PATH + '/**/*.rb'].each { |file| require file }


text:
package jsr310;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;

import lombok.Builder;
import lombok.Data;
import lombok.Value;

@Value
@Data
@Builder
@JsonInclude(Include.NON_EMPTY)
public class Dates implements Serializable {

    private static final long serialVersionUID = 3191068752500323145L;

    private LocalDate localDate;
    private LocalDateTime localDateTime;
    private LocalDateTime localDateTimeUTC;
    private OffsetDateTime offsetDateTime;
    private OffsetDateTime offsetDateTimeUTC;
}


text:
layout: page
title: "Hillary Ruth Fairbanks"
comments: true
description: "blanks"
keywords: "Hillary Ruth Fairbanks,CU,Boulder"
---
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://dl.dropboxusercontent.com/s/pc42nxpaw1ea4o9/highcharts.js?dl=0"></script>
<!-- <script src="../assets/js/highcharts.js"></script> -->
<style type="text/css">@font-face {
	font-family: "Bebas Neue";
	src: url(https://www.filehosting.org/file/details/544349/BebasNeue Regular.otf) format("opentype");
	}
	h1.Bebas {
		font-family: "Bebas Neue", Verdana, Tahoma;
	}
</style>
</head>

#### TEACHING INFORMATION

**College**: College of Engineering and Applied Science

**Classes taught**: GEEN 1360, GEEN 2350

#### GEEN 1360: Calculus 2 Work Group

**Terms taught**: Spring 2013, Spring 2013

**Instructor rating**: 5.0

**Standard deviation in instructor rating**: 0.16

**Average grade** (4.0 scale): 0.0

**Standard deviation in grades** (4.0 scale): 0.0

**Average workload** (raw): 1.28

**Standard deviation in workload** (raw): 0.12

#### GEEN 2350: Calculus 3 Work Group

**Terms taught**: Spring 2014

**Instructor rating**: 5.67

**Standard deviation in instructor rating**: 0.0

**Average grade** (4.0 scale): 0.0

**Standard deviation in grades** (4.0 scale): 0.0

**Average workload** (raw): 1.0

**Standard deviation in workload** (raw): 0.0


text:
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Linq;
using UnityEngine;
using UnityEditor;
using UMA;
using UnityEditorInternal;

namespace UMA.Editors
{
	[CustomPropertyDrawer(typeof(DNAEvaluator), true)]
	public class DNAEvaluatorPropertyDrawer : PropertyDrawer
	{
		private const string CALCOPTIONPROPERTY = "_calcOption";
		private const string DNANAMEPROPERTY = "_dnaName";
		private const string DNANAMEHASHPROPERTY = "_dnaNameHash";
		private const string EVALUATORPROPERTY = "_evaluator";
		private const string MULTIPLIERPROPERTY = "_multiplier";

		private const string DNANAMELABEL = "DNA Name";
		private const string EVALUATORLABEL = "Evaluator";
		private const string MULTIPLIERLABEL = "Multiplier";
		private const string CALCOPTIONMINILABEL = "\u01A9";

		private DNAEvaluator _target;

		private bool _drawLabels = true;
		private bool _alwaysExpanded = false;
		private bool _drawCalcOption = false;

		private float _calcOptionWidth = 25f;
		private GUIContent _calcOptionHeaderLabel = new GUIContent("\u03A3", "Define how the evaluated value will be combined with the previous Evaluator in the list.");
		private GUIContent[] _calcOptionMiniLabels = new GUIContent[] { new GUIContent("+", "Add"), new GUIContent("-", "Subtract"), new GUIContent("\u0078", "Multiply"), new GUIContent("\u00F7", "Divide") };

		private float _multiplierLabelWidth = 55f;
		private Vector2 _dnaToEvaluatorRatio = new Vector2(2f, 3f);
		private float _padding = 2f;
		private bool _manuallyConfigured = false;

		//if this is drawn in a DynamicDNAPlugin it should give us dna names to choose from
		private DynamicDNAPlugin _dynamicDNAPlugin;

		private bool initialized = false;

		public bool DrawLabels
		{
			set
			{
				_drawLabels = value;
				_manuallyConfigured = true;
			}
		}

		public bool AlwaysExpanded
		{
			set
			{
				_alwaysExpanded = value;
				_manuallyConfigured = true;
			}
		}

		public bool DrawCalcOption
		{
			set
			{
				_drawCalcOption = value;
				_manuallyConfigured = true;
			}
		}

		private void Init()
		{
			if (initialized)
				return;

			if (!_manuallyConfigured)
			{
				if (this.fieldInfo != null)
				{
					var attrib = this.fieldInfo.GetCustomAttributes(typeof(DNAEvaluator.ConfigAttribute), true).FirstOrDefault() as DNAEvaluator.ConfigAttribute;
					if (attrib != null)
					{
						_drawLabels = attrib.drawLabels;
						_alwaysExpanded = attrib.alwaysExpanded;
						_drawCalcOption = attrib.drawCalcOption;
					}
				}
			}
			initialized = true;
		}

		public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
		{
			Event current = Event.current;
			label = EditorGUI.BeginProperty(position, label, property);

			//Try and get a DNAAsset from the serializedObject- this is used for showing a popup in the dna field rather than a text field
			CheckDynamicDNAPlugin(property);

			Init();

			if (!_alwaysExpanded)
			{
				var foldoutPos = new Rect(position.xMin, position.yMin, position.width, EditorGUIUtility.singleLineHeight);
				property.isExpanded = EditorGUI.Foldout(foldoutPos, property.isExpanded, label);
			}
			var reorderableListDefaults = new ReorderableList.Defaults();

			if (property.isExpanded || _alwaysExpanded)
			{
				EditorGUI.indentLevel++;
				position = EditorGUI.IndentedRect(position);
				if (!_alwaysExpanded)
					position.yMin = position.yMin + EditorGUIUtility.singleLineHeight;
				else
					position.yMin += 2f;
				position.xMin -= 15f;//make it the same width as a reorderable list
				if (_drawLabels)
				{
					//can we draw this so it looks like the header of a reorderable List?
					if (current.type == EventType.Repaint)
						reorderableListDefaults.headerBackground.Draw(position, GUIContent.none, false, false, false, false);
					var rect1 = new Rect(position.xMin + 6f, position.yMin + 1f, position.width - 12f, position.height);
					if (_alwaysExpanded)
						position = DoLabelsInline(rect1, label);
					else
						position = DoLabelsInline(rect1, DNANAMELABEL);
					position.xMin -= 6f;
					position.width += 6f;
					position.yMin -= 1f;
					position.height -= 3f;
				}
				if (current.type == EventType.Repaint)
					reorderableListDefaults.boxBackground.Draw(position, GUIContent.none, false, false, false, false);
				var rect2 = new Rect(position.xMin + 6f, position.yMin + 3f, position.width - 12f, position.height);
				DoFieldsInline(rect2, property);
				EditorGUI.indentLevel--;
			}

			EditorGUI.EndProperty();
		}

		public Rect DoLabelsInline(Rect position, string label1 = DNANAMELABEL, string label2 = EVALUATORLABEL, string label3 = MULTIPLIERLABEL)
		{
			return DoLabelsInline(position, new GUIContent(label1, GetChildTooltip(DNANAMEPROPERTY)), new GUIContent(label2, GetChildTooltip(EVALUATORPROPERTY)), new GUIContent(label3, GetChildTooltip(MULTIPLIERPROPERTY)));
		}

		public Rect DoLabelsInline(Rect position, GUIContent label1, GUIContent label2 = null, GUIContent label3 = null)
		{
			if (label2 == null)
				label2 = new GUIContent(EVALUATORLABEL, GetChildTooltip(EVALUATORPROPERTY));
			if (label3 == null)
				label3 = new GUIContent(MULTIPLIERLABEL, GetChildTooltip(MULTIPLIERPROPERTY));

			var prevIndent = EditorGUI.indentLevel;
			EditorGUI.indentLevel = 0;

			Rect calcOptionRect = Rect.zero;
			if (_drawCalcOption)
			{
				calcOptionRect = new Rect(position.xMin+15f, position.yMin, _calcOptionWidth, EditorGUIUtility.singleLineHeight);
				position.xMin = calcOptionRect.xMax;
			}
			var fieldbaseRatio = (position.width - _multiplierLabelWidth) / (_dnaToEvaluatorRatio.x + _dnaToEvaluatorRatio.y);
			var dnafieldWidth = fieldbaseRatio * _dnaToEvaluatorRatio.x;
			var evaluatorFieldWidth = fieldbaseRatio * _dnaToEvaluatorRatio.y;

			var dnaNameLabelRect = new Rect(position.xMin, position.yMin, dnafieldWidth, EditorGUIUtility.singleLineHeight);
			var evaluatorLabelRect = new Rect(dnaNameLabelRect.xMax, position.yMin, evaluatorFieldWidth, EditorGUIUtility.singleLineHeight);
			var multiplierLabelRect = new Rect(evaluatorLabelRect.xMax, position.yMin, _multiplierLabelWidth, EditorGUIUtility.singleLineHeight);
			if (_drawCalcOption)
			{
				EditorGUI.LabelField(calcOptionRect, _calcOptionHeaderLabel, EditorStyles.centeredGreyMiniLabel);
			}
			EditorGUI.LabelField(dnaNameLabelRect, label1, EditorStyles.centeredGreyMiniLabel);
			EditorGUI.LabelField(evaluatorLabelRect, label2, EditorStyles.centeredGreyMiniLabel);
			EditorGUI.LabelField(multiplierLabelRect, label3, EditorStyles.centeredGreyMiniLabel);
			position.yMin = dnaNameLabelRect.yMax + 2f;

			EditorGUI.indentLevel = prevIndent;

			return position;
		}

		/// <summary>
		/// Draws a DNAEvaluator with inline styling
		/// </summary>
		/// <param name="position"></param>
		/// <param name="property"></param>
		/// <param name="label"></param>
		public void DoFieldsInline(Rect position, SerializedProperty property)
		{
			CheckDynamicDNAPlugin(property);

			Init();

			var prevIndent = EditorGUI.indentLevel;
			EditorGUI.indentLevel = 0;

			Rect calcOptionRect = Rect.zero;
			if (_drawCalcOption)
			{
				calcOptionRect = new Rect(position.xMin, position.yMin, _calcOptionWidth, EditorGUIUtility.singleLineHeight);
				position.xMin = calcOptionRect.xMax;
			}
			var calcOptionProp = property.FindPropertyRelative(CALCOPTIONPROPERTY);
			var dnaNameProp = property.FindPropertyRelative(DNANAMEPROPERTY);
			var dnaNameHashProp = property.FindPropertyRelative(DNANAMEHASHPROPERTY);
			var evaluatorProp = property.FindPropertyRelative(EVALUATORPROPERTY);
			var intensityProp = property.FindPropertyRelative(MULTIPLIERPROPERTY);
			var fieldbaseRatio = (position.width - _multiplierLabelWidth) / (_dnaToEvaluatorRatio.x + _dnaToEvaluatorRatio.y);
			var dnafieldWidth = fieldbaseRatio * _dnaToEvaluatorRatio.x;
			var evaluatorFieldWidth = fieldbaseRatio * _dnaToEvaluatorRatio.y;

			position.height = EditorGUIUtility.singleLineHeight;//theres a space at the bottom so cut that off

			var dnaNameRect = new Rect(position.xMin + _padding, position.yMin, dnafieldWidth - (_padding * 2), position.height);
			var evaluatorRect = new Rect(dnaNameRect.xMax + (_padding * 2), position.yMin, evaluatorFieldWidth - (_padding * 2), position.height);
			var multiplierRect = new Rect(evaluatorRect.xMax + (_padding * 2), position.yMin, _multiplierLabelWidth - (_padding * 2), position.height);

			if (_drawCalcOption)
			{
				calcOptionProp.enumValueIndex = EditorGUI.Popup(calcOptionRect, calcOptionProp.enumValueIndex, _calcOptionMiniLabels);
			}
			EditorGUI.BeginChangeCheck();
			if (_dynamicDNAPlugin == null)
				EditorGUI.PropertyField(dnaNameRect, dnaNameProp, GUIContent.none);
			else
			{
				DynamicDNAConverterControllerInspector.DNANamesPopup(dnaNameRect, dnaNameProp, dnaNameProp.stringValue, _dynamicDNAPlugin.converterController.DNAAsset);
			}
			if (EditorGUI.EndChangeCheck())
			{
				if (!string.IsNullOrEmpty(dnaNameProp.stringValue))
					dnaNameHashProp.intValue = UMAUtils.StringToHash(dnaNameProp.stringValue);
				else
					dnaNameHashProp.intValue = -1;
			}
			EditorGUI.BeginDisabledGroup(string.IsNullOrEmpty(dnaNameProp.stringValue));
			EditorGUI.BeginChangeCheck();
			EditorGUI.PropertyField(evaluatorRect, evaluatorProp, GUIContent.none);
			if (EditorGUI.EndChangeCheck())
			{
				InspectorUtlity.RepaintAllInspectors();
				GUI.changed = true;
			}
			EditorGUI.PropertyField(multiplierRect, intensityProp, GUIContent.none);
			EditorGUI.EndDisabledGroup();

			EditorGUI.indentLevel = prevIndent;
		}

		public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
		{
			if (!_manuallyConfigured)
			{
				if (this.fieldInfo != null)
				{
					var attrib = this.fieldInfo.GetCustomAttributes(typeof(DNAEvaluator.ConfigAttribute), true).FirstOrDefault() as DNAEvaluator.ConfigAttribute;
					if (attrib != null)
					{
						_drawLabels = attrib.drawLabels;
						_alwaysExpanded = attrib.alwaysExpanded;
						_drawCalcOption = attrib.drawCalcOption;
					}

				}
			}
			if (property.isExpanded || _alwaysExpanded)
			{
				if (_drawLabels)
					return EditorGUIUtility.singleLineHeight * (_alwaysExpanded ? 2f : 3f) + (_padding * 4f) + 6f;
				else
					return EditorGUIUtility.singleLineHeight * (_alwaysExpanded ? 1f : 2f) + (_padding * 4f);
			}
			else
				return EditorGUI.GetPropertyHeight(property, true);
		}

		/// <summary>
		/// if this property is in a DynamicDNAPlugin this will find it so we can use its DNAAsset etc
		/// </summary>
		/// <param name="property"></param>
		private void CheckDynamicDNAPlugin(SerializedProperty property)
		{
			if (typeof(DynamicDNAPlugin).IsAssignableFrom((property.serializedObject.targetObject).GetType()))
			{
				_dynamicDNAPlugin = (DynamicDNAPlugin)property.serializedObject.targetObject;
			}
		}

		/// <summary>
		/// Gets the tooltip from the 'Tooltip' attribute defined in the type class (if set)
		/// </summary>
		private string GetChildTooltip(SerializedProperty property)
		{

			return GetChildTooltip(property.name);
		}
		/// <summary>
		/// Gets the tooltip from the 'Tooltip' attribute defined in the type class (if set)
		/// </summary>
		private string GetChildTooltip(string propertyName)
		{

			TooltipAttribute[] attributes = typeof(DNAEvaluator).GetField(propertyName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance).GetCustomAttributes(typeof(TooltipAttribute), true) as TooltipAttribute[];

			return attributes.Length > 0 ? attributes[0].tooltip : "";
		}

	}
}


text: declare module 'react-vis';


text:
<?php

namespace Kateglo\PusbaBundle\Service\Kbbi;

use JMS\DiExtraBundle\Annotation\Service;
use JMS\DiExtraBundle\Annotation\Inject;
use JMS\DiExtraBundle\Annotation\InjectParams;
use Kateglo\PusbaBundle\Service\Kbbi\Exception\KbbiRequestStatusException;
use Kateglo\PusbaBundle\Service\Kbbi\Extractor;
use Kateglo\PusbaBundle\Service\Kbbi\Parser;
use Kateglo\PusbaBundle\Service\Curl;

/**
 *
 * @author  Arthur Purnama <arthur@purnama.de>
 * @Service
 */
class Requester
{
    const SEARCH = 'OPKODE=%1$d&PARAM=%2$s&PERINTAH=Cari&PERINTAH2=&KATA=&DFTKATA=&MORE=0&HEAD=0';

    const DEFINITION = 'DFTKATA=%1$s&HEAD=0&KATA=%2$s&MORE=0&OPKODE=%3$d&PARAM=%4$s&PERINTAH2=Tampilkan';

    /**
     * @var string url to kbbi
     */
    private $url;

    /**
     * @var Curl
     */
    private $curl;

    /**
     * @var Kbbi\Extractor
     */
    private $extractor;

    /**
     * @var Kbbi\Parser
     */
    private $parser;

    /**
     * @var string
     */
    private $param;

    /**
     * @var int
     */
    private $opCode;

    /**
     * @var string
     */
    private $listString;

    /**
     * @param $url
     * @param Curl $curl
     * @param Extractor $extractor
     * @param Parser $parser
     *
     * @InjectParams({
     *  "url" = @Inject("%kateglo_pusba.kbbi.url%"),
     *  "curl" = @Inject("kateglo.pusba_bundle.service.curl"),
     *  "extractor" = @Inject("kateglo.pusba_bundle.service.kbbi.extractor"),
     *  "parser" = @Inject("kateglo.pusba_bundle.service.kbbi.parser")
     * })
     */
    public function __construct($url, Curl $curl, Extractor $extractor, Parser $parser)
    {
        $this->url = $url;
        $this->curl = $curl;
        $this->extractor = $extractor;
        $this->parser = $parser;
        $this->curl->setUrl($this->url);
        $this->curl->setPost(true);
    }

    /**
     * @param string $param
     */
    public function setParam($param)
    {
        $this->param = $param;
    }

    /**
     * @param int $opCode
     */
    public function setOpCode($opCode)
    {
        $this->opCode = $opCode;
    }

    public function request()
    {
        $wordList = $this->getWordList();
        foreach ($wordList as $word) {
            $rawDefinition = $this->extractor->extractDefinition($this->requestDefinition($word));
            $this->parser->parse($rawDefinition);

            return json_encode($this->parser->getResult()->toArray());
        }

    }

    public function getRaw()
    {
        return $this->requestSearch();
    }

    public function getRawDefinition()
    {
        $wordList = $this->getWordList();
        $resultText = array();
        foreach ($wordList as $word) {
            $resultText[$word] = $this->requestDefinition($word);
        }

        return $resultText;
    }

    public function getRawExtracted()
    {
        $wordList = $this->getWordList();
        $resultText = array();
        foreach ($wordList as $word) {
            $resultText[$word] = $this->extractor->extractDefinition($this->requestDefinition($word));
        }

        return $resultText;
    }

    protected function getWordList()
    {
        //Extract the Result List
        $this->listString = $this->extractor->extractList($this->requestSearch());

        //For each words in the list get the Definition
        return explode(';', $this->listString);
    }

    protected function requestSearch()
    {
        if (empty($this->opCode) || empty($this->param)) {
            throw new \Exception('requestSearch(): Parameter can not be empty opcode:'.$this->opCode.' param:'.$this->param);
        }
        $this->curl->setPostFields(sprintf(static::SEARCH, $this->opCode, $this->param));
        $this->execute();

        return $this->curl->getResult();
    }

    protected function requestDefinition($word)
    {
        if (empty($this->listString) || empty($word) || empty($this->opCode) || empty($this->param)) {
            throw new \Exception('requestDefinition(): Parameter can not be empty');
        }
        $this->curl->setPostFields(sprintf(static::DEFINITION, $this->listString, $word, $this->opCode, $this->param));
        $this->execute();

        return $this->curl->getResult();
    }

    protected function execute()
    {
        $this->curl->execute();
        if ($this->curl->getStatus() !== 200) {
            throw new KbbiRequestStatusException('Status: ' . $this->curl->getStatus());
        }
    }

}


text:
import ConfigParser
import bottle

class AuthService(object):

    def __init__(self, server_mgr, args):
        self._conf_info = {
            'auth_host': args.auth_host,
            'auth_protocol': args.auth_protocol,
            'admin_user': args.admin_user,
            'admin_password': args.admin_password,
        }
        self._server_mgr = server_mgr
        self._auth_method = args.auth
        self._auth_token = None
        self._auth_middleware = None
    # end __init__

    def json_request(self, method, path):
        return {}
    # end json_request

    def get_projects(self):
        return {}
    # end get_projects

    def get_middleware_app(self):
        return None
    # end get_middleware_app

# end class AuthService


text:
title: Thaaaannnks
intonation: Deep raspy voice
meaning: Sarcastic expression of non-approval of a situation
---


text:
<!DOCTYPE html>

    <meta http-equiv="refresh" content="0;URL=../../libc/constant.ERANGE.html">

Redirecting to ../../libc/constant.ERANGE.html...


text:
<!DOCTYPE html>

    <meta http-equiv="refresh" content="0;URL=type.N50.html">

Redirecting to type.N50.html...


text:
package org.apache.calcite.sql.fun;

import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.rel.type.RelDataTypeFactory;
import org.apache.calcite.sql.SqlAggFunction;
import org.apache.calcite.sql.SqlCall;
import org.apache.calcite.sql.SqlFunction;
import org.apache.calcite.sql.SqlFunctionCategory;
import org.apache.calcite.sql.SqlKind;
import org.apache.calcite.sql.SqlOperator;
import org.apache.calcite.sql.SqlOperatorBinding;
import org.apache.calcite.sql.SqlOperatorTable;
import org.apache.calcite.sql.SqlSyntax;
import org.apache.calcite.sql.SqlWriter;
import org.apache.calcite.sql.type.InferTypes;
import org.apache.calcite.sql.type.OperandTypes;
import org.apache.calcite.sql.type.ReturnTypes;
import org.apache.calcite.sql.type.SameOperandTypeChecker;
import org.apache.calcite.sql.type.SqlOperandCountRanges;
import org.apache.calcite.sql.type.SqlReturnTypeInference;
import org.apache.calcite.sql.type.SqlTypeFamily;
import org.apache.calcite.sql.type.SqlTypeName;
import org.apache.calcite.sql.type.SqlTypeTransforms;
import org.apache.calcite.util.Optionality;

import com.google.common.collect.ImmutableList;

import org.checkerframework.checker.nullness.qual.Nullable;

import java.util.ArrayList;
import java.util.List;

import static org.apache.calcite.sql.fun.SqlLibrary.BIG_QUERY;
import static org.apache.calcite.sql.fun.SqlLibrary.HIVE;
import static org.apache.calcite.sql.fun.SqlLibrary.MSSQL;
import static org.apache.calcite.sql.fun.SqlLibrary.MYSQL;
import static org.apache.calcite.sql.fun.SqlLibrary.NETEZZA;
import static org.apache.calcite.sql.fun.SqlLibrary.ORACLE;
import static org.apache.calcite.sql.fun.SqlLibrary.POSTGRESQL;
import static org.apache.calcite.sql.fun.SqlLibrary.SNOWFLAKE;
import static org.apache.calcite.sql.fun.SqlLibrary.SPARK;
import static org.apache.calcite.sql.fun.SqlLibrary.STANDARD;
import static org.apache.calcite.sql.fun.SqlLibrary.TERADATA;
import static org.apache.calcite.sql.type.OperandTypes.DATETIME_INTEGER;
import static org.apache.calcite.sql.type.OperandTypes.DATETIME_INTERVAL;

/**
 * Defines functions and operators that are not part of standard SQL but
 * belong to one or more other dialects of SQL.
 *
 *
They are read by {@link SqlLibraryOperatorTableFactory} into instances
 * of {@link SqlOperatorTable} that contain functions and operators for
 * particular libraries.
 */
public abstract class SqlLibraryOperators {
  private SqlLibraryOperators() {
  }

  /** The "CONVERT_TIMEZONE(tz1, tz2, datetime)" function;
   * converts the timezone of {@code datetime} from {@code tz1} to {@code tz2}.
   * This function is only on Redshift, but we list it in PostgreSQL
   * because Redshift does not have its own library. */
  @LibraryOperator(libraries = {POSTGRESQL})
  public static final SqlFunction CONVERT_TIMEZONE =
      new SqlFunction("CONVERT_TIMEZONE",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.DATE_NULLABLE,
          null,
          OperandTypes.CHARACTER_CHARACTER_DATETIME,
          SqlFunctionCategory.TIMEDATE);

  /** Return type inference for {@code DECODE}. */
  private static final SqlReturnTypeInference DECODE_RETURN_TYPE =
      opBinding -> {
        final List<RelDataType> list = new ArrayList<>();
        for (int i = 1, n = opBinding.getOperandCount(); i < n; i++) {
          if (i < n - 1) {
            ++i;
          }
          list.add(opBinding.getOperandType(i));
        }
        final RelDataTypeFactory typeFactory = opBinding.getTypeFactory();
        RelDataType type = typeFactory.leastRestrictive(list);
        if (type != null && opBinding.getOperandCount() % 2 == 1) {
          type = typeFactory.createTypeWithNullability(type, true);
        }
        return type;
      };

  /** The "DECODE(v, v1, result1, [v2, result2, ...], resultN)" function. */
  @LibraryOperator(libraries = {ORACLE})
  public static final SqlFunction DECODE =
      new SqlFunction("DECODE", SqlKind.DECODE, DECODE_RETURN_TYPE, null,
          OperandTypes.VARIADIC, SqlFunctionCategory.SYSTEM);

  /** The "IF(condition, thenValue, elseValue)" function. */
  @LibraryOperator(libraries = {BIG_QUERY, HIVE, SPARK, SNOWFLAKE})
  public static final SqlFunction IF =
      new SqlFunction("IF", SqlKind.IF, SqlLibraryOperators::inferIfReturnType,
          null,
          OperandTypes.and(
              OperandTypes.family(SqlTypeFamily.BOOLEAN, SqlTypeFamily.ANY,
                  SqlTypeFamily.ANY),
              // Arguments 1 and 2 must have same type
              new SameOperandTypeChecker(3) {
                @Override protected List<Integer>
                getOperandList(int operandCount) {
                  return ImmutableList.of(1, 2);
                }
              }),
          SqlFunctionCategory.SYSTEM) {
        /***
         * Commenting this part as we create RexCall using this function
         */

//        @Override public boolean validRexOperands(int count, Litmus litmus) {
//          // IF is translated to RexNode by expanding to CASE.
//          return litmus.fail("not a rex operator");
//        }
      };

  /** Infers the return type of {@code IF(b, x, y)},
   * namely the least restrictive of the types of x and y.
   * Similar to {@link ReturnTypes#LEAST_RESTRICTIVE}. */
  private static @Nullable RelDataType inferIfReturnType(SqlOperatorBinding opBinding) {
    return opBinding.getTypeFactory()
        .leastRestrictive(opBinding.collectOperandTypes().subList(1, 3));
  }

  /** The "NVL(value, value)" function. */
  @LibraryOperator(libraries = {ORACLE, HIVE, SPARK})
  public static final SqlFunction NVL =
      new SqlFunction("NVL", SqlKind.NVL,
        ReturnTypes.LEAST_RESTRICTIVE
          .andThen(SqlTypeTransforms.TO_NULLABLE_ALL),
        null, OperandTypes.SAME_SAME, SqlFunctionCategory.SYSTEM);

  /** The "IFNULL(value, value)" function. */
  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction IFNULL =
      new SqlFunction("IFNULL", SqlKind.OTHER_FUNCTION,
          ReturnTypes.cascade(ReturnTypes.LEAST_RESTRICTIVE,
              SqlTypeTransforms.TO_NULLABLE_ALL),
          null, OperandTypes.SAME_SAME, SqlFunctionCategory.SYSTEM);

  /** The "ISNULL(value, value)" function. */
  @LibraryOperator(libraries = {MSSQL})
  public static final SqlFunction ISNULL =
      new SqlFunction("ISNULL", SqlKind.OTHER_FUNCTION,
          ReturnTypes.cascade(ReturnTypes.LEAST_RESTRICTIVE,
              SqlTypeTransforms.TO_NULLABLE_ALL),
          null, OperandTypes.SAME_SAME, SqlFunctionCategory.SYSTEM);

  /** The "LTRIM(string)" function. */
  @LibraryOperator(libraries = {ORACLE})
  public static final SqlFunction LTRIM =
      new SqlFunction("LTRIM", SqlKind.LTRIM,
          ReturnTypes.ARG0.andThen(SqlTypeTransforms.TO_NULLABLE)
              .andThen(SqlTypeTransforms.TO_VARYING), null,
          OperandTypes.STRING, SqlFunctionCategory.STRING);

  /** The "RTRIM(string)" function. */
  @LibraryOperator(libraries = {ORACLE})
  public static final SqlFunction RTRIM =
      new SqlFunction("RTRIM", SqlKind.RTRIM,
          ReturnTypes.ARG0.andThen(SqlTypeTransforms.TO_NULLABLE)
              .andThen(SqlTypeTransforms.TO_VARYING), null,
          OperandTypes.STRING, SqlFunctionCategory.STRING);

  /** BIG_QUERY's "SUBSTR(string, position [, substringLength ])" function. */
  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction SUBSTR_BIG_QUERY =
      new SqlFunction("SUBSTR", SqlKind.SUBSTR_BIG_QUERY,
          ReturnTypes.ARG0_NULLABLE_VARYING, null,
          OperandTypes.STRING_INTEGER_OPTIONAL_INTEGER,
          SqlFunctionCategory.STRING);

  /** MySQL's "SUBSTR(string, position [, substringLength ])" function. */
  @LibraryOperator(libraries = {MYSQL})
  public static final SqlFunction SUBSTR_MYSQL =
      new SqlFunction("SUBSTR", SqlKind.SUBSTR_MYSQL,
          ReturnTypes.ARG0_NULLABLE_VARYING, null,
          OperandTypes.STRING_INTEGER_OPTIONAL_INTEGER,
          SqlFunctionCategory.STRING);

  /** Oracle's "SUBSTR(string, position [, substringLength ])" function.
   *
   *
It has different semantics to standard SQL's
   * {@link SqlStdOperatorTable#SUBSTRING} function:
   *
   *

   *
If {@code substringLength} ≤ 0, result is the empty string
   *   (Oracle would return null, because it treats the empty string as null,
   *   but Calcite does not have these semantics);
   *
If {@code position} = 0, treat {@code position} as 1;
   *
If {@code position} < 0, treat {@code position} as
   *       "length(string) + position + 1".
   *

   */
  @LibraryOperator(libraries = {ORACLE})
  public static final SqlFunction SUBSTR_ORACLE =
      new SqlFunction("SUBSTR", SqlKind.SUBSTR_ORACLE,
          ReturnTypes.ARG0_NULLABLE_VARYING, null,
          OperandTypes.STRING_INTEGER_OPTIONAL_INTEGER,
          SqlFunctionCategory.STRING);

  /** PostgreSQL's "SUBSTR(string, position [, substringLength ])" function. */
  @LibraryOperator(libraries = {POSTGRESQL})
  public static final SqlFunction SUBSTR_POSTGRESQL =
      new SqlFunction("SUBSTR", SqlKind.SUBSTR_POSTGRESQL,
          ReturnTypes.ARG0_NULLABLE_VARYING, null,
          OperandTypes.STRING_INTEGER_OPTIONAL_INTEGER,
          SqlFunctionCategory.STRING);

  /** The "GREATEST(value, value)" function. */
  @LibraryOperator(libraries = {ORACLE})
  public static final SqlFunction GREATEST =
      new SqlFunction("GREATEST", SqlKind.GREATEST,
        ReturnTypes.LEAST_RESTRICTIVE.andThen(
          SqlTypeTransforms.TO_NULLABLE), null,
        OperandTypes.SAME_VARIADIC, SqlFunctionCategory.SYSTEM);

  /** The "LEAST(value, value)" function. */
  @LibraryOperator(libraries = {ORACLE})
  public static final SqlFunction LEAST =
      new SqlFunction("LEAST", SqlKind.LEAST,
        ReturnTypes.LEAST_RESTRICTIVE.andThen(
          SqlTypeTransforms.TO_NULLABLE), null,
        OperandTypes.SAME_VARIADIC, SqlFunctionCategory.SYSTEM);

  /**
   * The TRANSLATE(string_expr, search_chars,
   * replacement_chars) function returns string_expr with
   * all occurrences of each character in search_chars replaced by its
   * corresponding character in replacement_chars.
   *
   *
It is not defined in the SQL standard, but occurs in Oracle and
   * PostgreSQL.
   */
  @LibraryOperator(libraries = {ORACLE, POSTGRESQL})
  public static final SqlFunction TRANSLATE3 = new SqlTranslate3Function();

  @LibraryOperator(libraries = {MYSQL})
  public static final SqlFunction JSON_TYPE = new SqlJsonTypeFunction();

  @LibraryOperator(libraries = {MYSQL})
  public static final SqlFunction JSON_DEPTH = new SqlJsonDepthFunction();

  @LibraryOperator(libraries = {MYSQL})
  public static final SqlFunction JSON_LENGTH = new SqlJsonLengthFunction();

  @LibraryOperator(libraries = {MYSQL})
  public static final SqlFunction JSON_KEYS = new SqlJsonKeysFunction();

  @LibraryOperator(libraries = {MYSQL})
  public static final SqlFunction JSON_PRETTY = new SqlJsonPrettyFunction();

  @LibraryOperator(libraries = {MYSQL})
  public static final SqlFunction JSON_REMOVE = new SqlJsonRemoveFunction();

  @LibraryOperator(libraries = {MYSQL})
  public static final SqlFunction JSON_STORAGE_SIZE = new SqlJsonStorageSizeFunction();

  @LibraryOperator(libraries = {MYSQL, ORACLE})
  public static final SqlFunction REGEXP_REPLACE = new SqlRegexpReplaceFunction();

  @LibraryOperator(libraries = {MYSQL})
  public static final SqlFunction COMPRESS =
      new SqlFunction("COMPRESS", SqlKind.OTHER_FUNCTION,
          ReturnTypes.explicit(SqlTypeName.VARBINARY)
              .andThen(SqlTypeTransforms.TO_NULLABLE),
          null, OperandTypes.STRING, SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {MYSQL})
  public static final SqlFunction EXTRACT_VALUE =
      new SqlFunction("EXTRACTVALUE", SqlKind.OTHER_FUNCTION,
          ReturnTypes.VARCHAR_2000.andThen(SqlTypeTransforms.FORCE_NULLABLE),
          null, OperandTypes.STRING_STRING, SqlFunctionCategory.SYSTEM);

  @LibraryOperator(libraries = {ORACLE})
  public static final SqlFunction XML_TRANSFORM =
      new SqlFunction("XMLTRANSFORM", SqlKind.OTHER_FUNCTION,
          ReturnTypes.VARCHAR_2000.andThen(SqlTypeTransforms.FORCE_NULLABLE),
          null, OperandTypes.STRING_STRING, SqlFunctionCategory.SYSTEM);

  @LibraryOperator(libraries = {ORACLE})
  public static final SqlFunction EXTRACT_XML =
      new SqlFunction("EXTRACT", SqlKind.OTHER_FUNCTION,
          ReturnTypes.VARCHAR_2000.andThen(SqlTypeTransforms.FORCE_NULLABLE),
          null, OperandTypes.STRING_STRING_OPTIONAL_STRING,
          SqlFunctionCategory.SYSTEM);

  @LibraryOperator(libraries = {ORACLE})
  public static final SqlFunction EXISTS_NODE =
      new SqlFunction("EXISTSNODE", SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER_NULLABLE
              .andThen(SqlTypeTransforms.FORCE_NULLABLE), null,
          OperandTypes.STRING_STRING_OPTIONAL_STRING, SqlFunctionCategory.SYSTEM);

  /** The "BOOL_AND(condition)" aggregate function, PostgreSQL and Redshift's
   * equivalent to {@link SqlStdOperatorTable#EVERY}. */
  @LibraryOperator(libraries = {POSTGRESQL})
  public static final SqlAggFunction BOOL_AND =
      new SqlMinMaxAggFunction("BOOL_AND", SqlKind.MIN, OperandTypes.BOOLEAN);

  /** The "BOOL_OR(condition)" aggregate function, PostgreSQL and Redshift's
   * equivalent to {@link SqlStdOperatorTable#SOME}. */
  @LibraryOperator(libraries = {POSTGRESQL})
  public static final SqlAggFunction BOOL_OR =
      new SqlMinMaxAggFunction("BOOL_OR", SqlKind.MAX, OperandTypes.BOOLEAN);

  /** The "LOGICAL_AND(condition)" aggregate function, BIG_QUERY's
   * equivalent to {@link SqlStdOperatorTable#EVERY}. */
  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlAggFunction LOGICAL_AND =
      new SqlMinMaxAggFunction("LOGICAL_AND", SqlKind.MIN, OperandTypes.BOOLEAN);

  /** The "LOGICAL_OR(condition)" aggregate function, BIG_QUERY's
   * equivalent to {@link SqlStdOperatorTable#SOME}. */
  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlAggFunction LOGICAL_OR =
      new SqlMinMaxAggFunction("LOGICAL_OR", SqlKind.MAX, OperandTypes.BOOLEAN);

  /** The "COUNTIF(condition) [OVER (...)]" function, in BIG_QUERY,
   * returns the count of TRUE values for expression.
   *
   *
{@code COUNTIF(b)} is equivalent to
   * {@code COUNT(*) FILTER (WHERE b)}. */
  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlAggFunction COUNTIF =
      SqlBasicAggFunction
          .create(SqlKind.COUNTIF, ReturnTypes.BIGINT, OperandTypes.BOOLEAN)
          .withDistinct(Optionality.FORBIDDEN);

  /** The "ARRAY_AGG(value [ ORDER BY ...])" aggregate function,
   * in BIG_QUERY and PostgreSQL, gathers values into arrays. */
  @LibraryOperator(libraries = {POSTGRESQL, BIG_QUERY})
  public static final SqlAggFunction ARRAY_AGG =
      SqlBasicAggFunction
          .create(SqlKind.ARRAY_AGG,
              ReturnTypes.andThen(ReturnTypes::stripOrderBy,
                  ReturnTypes.TO_ARRAY), OperandTypes.ANY)
          .withFunctionType(SqlFunctionCategory.SYSTEM)
          .withSyntax(SqlSyntax.ORDERED_FUNCTION)
          .withAllowsNullTreatment(true);

  /** The "ARRAY_CONCAT_AGG(value [ ORDER BY ...])" aggregate function,
   * in BIG_QUERY and PostgreSQL, concatenates array values into arrays. */
  @LibraryOperator(libraries = {POSTGRESQL, BIG_QUERY})
  public static final SqlAggFunction ARRAY_CONCAT_AGG =
      SqlBasicAggFunction
          .create(SqlKind.ARRAY_CONCAT_AGG, ReturnTypes.ARG0,
              OperandTypes.ARRAY)
          .withFunctionType(SqlFunctionCategory.SYSTEM)
          .withSyntax(SqlSyntax.ORDERED_FUNCTION);

  /** The "STRING_AGG(value [, separator ] [ ORDER BY ...])" aggregate function,
   * BIG_QUERY and PostgreSQL's equivalent of
   * {@link SqlStdOperatorTable#LISTAGG}.
   *
   *
{@code STRING_AGG(v, sep ORDER BY x, y)} is implemented by
   * rewriting to {@code LISTAGG(v, sep) WITHIN GROUP (ORDER BY x, y)}. */
  @LibraryOperator(libraries = {POSTGRESQL, BIG_QUERY})
  public static final SqlAggFunction STRING_AGG =
      SqlBasicAggFunction
          .create(SqlKind.STRING_AGG, ReturnTypes.ARG0_NULLABLE,
              OperandTypes.or(OperandTypes.STRING, OperandTypes.STRING_STRING))
          .withFunctionType(SqlFunctionCategory.SYSTEM)
          .withSyntax(SqlSyntax.ORDERED_FUNCTION);

  /** The "DATE(string)" function, equivalent to "CAST(string AS DATE). */
  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction DATE =
      new SqlFunction("DATE", SqlKind.OTHER_FUNCTION,
          ReturnTypes.DATE_NULLABLE, null, OperandTypes.STRING,
          SqlFunctionCategory.TIMEDATE);

  /** The "CURRENT_DATETIME([timezone])" function. */
  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction CURRENT_DATETIME =
      new SqlFunction("CURRENT_DATETIME", SqlKind.OTHER_FUNCTION,
          ReturnTypes.TIMESTAMP.andThen(SqlTypeTransforms.TO_NULLABLE), null,
          OperandTypes.or(OperandTypes.NILADIC, OperandTypes.STRING),
          SqlFunctionCategory.TIMEDATE);

  /** The "DATE_FROM_UNIX_DATE(integer)" function; returns a DATE value
   * a given number of seconds after 1970-01-01. */
  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction DATE_FROM_UNIX_DATE =
      new SqlFunction("DATE_FROM_UNIX_DATE", SqlKind.OTHER_FUNCTION,
          ReturnTypes.DATE_NULLABLE, null, OperandTypes.INTEGER,
          SqlFunctionCategory.TIMEDATE);

  /** The "UNIX_DATE(date)" function; returns the number of days since
   * 1970-01-01. */
  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction UNIX_DATE =
      new SqlFunction("UNIX_DATE", SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER_NULLABLE, null, OperandTypes.DATE,
          SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {BIG_QUERY, HIVE, SPARK})
  public static final SqlFunction CURRENT_TIMESTAMP = new SqlCurrentTimestampFunction(
      "CURRENT_TIMESTAMP", SqlTypeName.TIMESTAMP);

  /**
   * The REGEXP_EXTRACT(source_string, regex_pattern) returns the first substring in source_string
   * that matches the regex_pattern. Returns NULL if there is no match.
   *
   * The REGEXP_EXTRACT_ALL(source_string, regex_pattern) returns an array of all substrings of
   * source_string that match the regex_pattern.
   */
  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction REGEXP_EXTRACT = new SqlFunction("REGEXP_EXTRACT",
        SqlKind.OTHER_FUNCTION,
        ReturnTypes.cascade(ReturnTypes.explicit(SqlTypeName.VARCHAR),
          SqlTypeTransforms.TO_NULLABLE),
      null, OperandTypes.family(
      ImmutableList.of(SqlTypeFamily.STRING, SqlTypeFamily.STRING,
          SqlTypeFamily.NUMERIC, SqlTypeFamily.NUMERIC),
          number -> number == 2 || number == 3),
      SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction REGEXP_EXTRACT_ALL = new SqlFunction("REGEXP_EXTRACT_ALL",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.cascade(ReturnTypes.explicit(SqlTypeName.VARCHAR),
        SqlTypeTransforms.TO_NULLABLE),
      null, OperandTypes.STRING_STRING,
      SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction FORMAT_TIMESTAMP = new SqlFunction("FORMAT_TIMESTAMP",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.VARCHAR_2000_NULLABLE, null,
      OperandTypes.family(SqlTypeFamily.STRING, SqlTypeFamily.TIMESTAMP),
      SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {HIVE, SPARK})
  public static final SqlFunction DATE_FORMAT = new SqlFunction("DATE_FORMAT",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.VARCHAR_2000_NULLABLE, null,
      OperandTypes.family(SqlTypeFamily.DATETIME, SqlTypeFamily.STRING),
      SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {STANDARD})
  public static final SqlFunction FORMAT_DATE = new SqlFunction("FORMAT_DATE",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.VARCHAR_2000_NULLABLE, null,
      OperandTypes.family(SqlTypeFamily.STRING, SqlTypeFamily.DATE),
      SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {STANDARD})
  public static final SqlFunction FORMAT_TIME = new SqlFunction("FORMAT_TIME",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.VARCHAR_2000_NULLABLE, null,
      OperandTypes.family(SqlTypeFamily.STRING, SqlTypeFamily.TIME),
      SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction TIME_ADD =
      new SqlFunction("TIME_ADD",
          SqlKind.PLUS,
          ReturnTypes.TIME, null,
          OperandTypes.family(SqlTypeFamily.ANY, SqlTypeFamily.TIME),
          SqlFunctionCategory.TIMEDATE) {

    @Override public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) {
      writer.getDialect().unparseIntervalOperandsBasedFunctions(
          writer, call, leftPrec, rightPrec);
    }
  };

  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction INTERVAL_SECONDS = new SqlFunction("INTERVAL_SECONDS",
        SqlKind.OTHER_FUNCTION,
        ReturnTypes.INTEGER, null,
        OperandTypes.ANY, SqlFunctionCategory.TIMEDATE);

  /** The "MONTHNAME(datetime)" function; returns the name of the month,
   * in the current locale, of a TIMESTAMP or DATE argument. */
  @LibraryOperator(libraries = {MYSQL})
  public static final SqlFunction MONTHNAME =
      new SqlFunction("MONTHNAME", SqlKind.OTHER_FUNCTION,
          ReturnTypes.VARCHAR_2000, null, OperandTypes.DATETIME,
          SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {BIG_QUERY, HIVE, SPARK})
  public static final SqlFunction DATETIME_ADD =
      new SqlFunction("DATETIME_ADD",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.ARG0_NULLABLE,
      null,
      OperandTypes.DATETIME,
      SqlFunctionCategory.TIMEDATE) {

        @Override public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) {
          writer.getDialect().unparseIntervalOperandsBasedFunctions(
              writer, call, leftPrec, rightPrec);
        }
      };

  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction DATETIME_SUB =
      new SqlFunction("DATETIME_SUB",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.ARG0_NULLABLE,
      null,
      OperandTypes.DATETIME,
      SqlFunctionCategory.TIMEDATE) {

        @Override public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) {
          writer.getDialect().unparseIntervalOperandsBasedFunctions(
              writer, call, leftPrec, rightPrec);
        }
      };

  @LibraryOperator(libraries = {BIG_QUERY, HIVE, SPARK})
  public static final SqlFunction DATE_ADD =
      new SqlFunction(
        "DATE_ADD",
        SqlKind.PLUS,
        ReturnTypes.DATE,
        null,
        OperandTypes.or(DATETIME_INTERVAL, DATETIME_INTEGER),
        SqlFunctionCategory.TIMEDATE) {

      @Override public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) {
        writer.getDialect().unparseIntervalOperandsBasedFunctions(
            writer, call, leftPrec, rightPrec);
      }
    };

  @LibraryOperator(libraries = {BIG_QUERY, HIVE, SPARK})
  public static final SqlFunction DATE_SUB =
      new SqlFunction(
        "DATE_SUB",
        SqlKind.MINUS,
        ReturnTypes.DATE,
        null,
        OperandTypes.or(DATETIME_INTERVAL, DATETIME_INTEGER),
        SqlFunctionCategory.TIMEDATE) {

        @Override public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) {
          writer.getDialect().unparseIntervalOperandsBasedFunctions(
              writer, call, leftPrec, rightPrec);
        }
      };

  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction TIMESTAMP_ADD =
      new SqlFunction(
        "TIMESTAMP_ADD",
        SqlKind.PLUS,
        ReturnTypes.TIMESTAMP,
        null,
        OperandTypes.family(SqlTypeFamily.TIMESTAMP, SqlTypeFamily.DATETIME_INTERVAL),
        SqlFunctionCategory.TIMEDATE) {

        @Override public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) {
          writer.getDialect().unparseIntervalOperandsBasedFunctions(
              writer, call, leftPrec, rightPrec);
        }
      };

  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction TIMESTAMP_SUB =
      new SqlFunction(
        "TIMESTAMP_SUB",
        SqlKind.MINUS,
        ReturnTypes.TIMESTAMP,
        null,
        OperandTypes.family(SqlTypeFamily.TIMESTAMP, SqlTypeFamily.DATETIME_INTERVAL),
        SqlFunctionCategory.TIMEDATE) {

        @Override public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) {
          writer.getDialect().unparseIntervalOperandsBasedFunctions(
              writer, call, leftPrec, rightPrec);
        }
      };

  @LibraryOperator(libraries = {HIVE, SPARK, SNOWFLAKE, TERADATA})
  public static final SqlFunction ADD_MONTHS =
      new SqlFunction(
        "ADD_MONTHS",
        SqlKind.PLUS,
        ReturnTypes.ARG0,
        null,
        OperandTypes.family(SqlTypeFamily.DATETIME, SqlTypeFamily.INTEGER),
        SqlFunctionCategory.TIMEDATE);

  /** The "DAYNAME(datetime)" function; returns the name of the day of the week,
   * in the current locale, of a TIMESTAMP or DATE argument. */
  @LibraryOperator(libraries = {MYSQL})
  public static final SqlFunction DAYNAME =
      new SqlFunction("DAYNAME", SqlKind.OTHER_FUNCTION,
          ReturnTypes.VARCHAR_2000, null, OperandTypes.DATETIME,
          SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {MYSQL, POSTGRESQL})
  public static final SqlFunction LEFT =
      new SqlFunction("LEFT", SqlKind.OTHER_FUNCTION,
          ReturnTypes.ARG0_NULLABLE_VARYING, null,
          OperandTypes.CBSTRING_INTEGER, SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {MYSQL, POSTGRESQL})
  public static final SqlFunction REPEAT =
      new SqlFunction(
          "REPEAT",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.ARG0_NULLABLE_VARYING,
          null,
          OperandTypes.STRING_INTEGER,
          SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {MYSQL, POSTGRESQL})
  public static final SqlFunction RIGHT =
      new SqlFunction("RIGHT", SqlKind.OTHER_FUNCTION,
          ReturnTypes.ARG0_NULLABLE_VARYING, null,
          OperandTypes.CBSTRING_INTEGER, SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {MYSQL})
  public static final SqlFunction SPACE =
      new SqlFunction("SPACE",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.VARCHAR_2000_NULLABLE,
          null,
          OperandTypes.INTEGER,
          SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {MYSQL})
  public static final SqlFunction STRCMP =
      new SqlFunction("STRCMP",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER_NULLABLE,
          null,
          OperandTypes.STRING_STRING,
          SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {MYSQL, POSTGRESQL, ORACLE})
  public static final SqlFunction SOUNDEX =
      new SqlFunction("SOUNDEX",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.VARCHAR_4_NULLABLE,
          null,
          OperandTypes.CHARACTER,
          SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {POSTGRESQL})
  public static final SqlFunction DIFFERENCE =
      new SqlFunction("DIFFERENCE",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER_NULLABLE,
          null,
          OperandTypes.STRING_STRING,
          SqlFunctionCategory.STRING);

  /** The "CONCAT(arg, ...)" function that concatenates strings.
   * For example, "CONCAT('a', 'bc', 'd')" returns "abcd". */
  @LibraryOperator(libraries = {MYSQL, POSTGRESQL})
  public static final SqlFunction CONCAT_FUNCTION =
      new SqlFunction("CONCAT",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.MULTIVALENT_STRING_SUM_PRECISION_NULLABLE,
          InferTypes.RETURN_TYPE,
          OperandTypes.repeat(SqlOperandCountRanges.from(2),
              OperandTypes.STRING),
          SqlFunctionCategory.STRING);

  /** The "CONCAT(arg0, arg1)" function that concatenates strings.
   * For example, "CONCAT('a', 'bc')" returns "abc".
   *
   *
It is assigned {@link SqlKind#CONCAT2} to make it not equal to
   * {@link #CONCAT_FUNCTION}. */
  @LibraryOperator(libraries = {ORACLE})
  public static final SqlFunction CONCAT2 =
      new SqlFunction("CONCAT",
          SqlKind.CONCAT2,
          ReturnTypes.MULTIVALENT_STRING_SUM_PRECISION_NULLABLE,
          InferTypes.RETURN_TYPE,
          OperandTypes.STRING_SAME_SAME,
          SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {MYSQL})
  public static final SqlFunction REVERSE =
      new SqlFunction("REVERSE",
          SqlKind.REVERSE,
          ReturnTypes.ARG0_NULLABLE_VARYING,
          null,
          OperandTypes.CHARACTER,
          SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {MYSQL})
  public static final SqlFunction FROM_BASE64 =
      new SqlFunction("FROM_BASE64",
        SqlKind.OTHER_FUNCTION,
        ReturnTypes.explicit(SqlTypeName.VARBINARY)
          .andThen(SqlTypeTransforms.TO_NULLABLE),
        null,
        OperandTypes.STRING,
        SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {MYSQL})
  public static final SqlFunction TO_BASE64 =
      new SqlFunction("TO_BASE64",
        SqlKind.OTHER_FUNCTION,
        ReturnTypes.explicit(SqlTypeName.VARCHAR)
          .andThen(SqlTypeTransforms.TO_NULLABLE),
        null,
        OperandTypes.or(OperandTypes.STRING, OperandTypes.BINARY),
        SqlFunctionCategory.STRING);

  /** The "TO_DATE(string1, string2)" function; casts string1
   * to a DATE using the format specified in string2. */
  @LibraryOperator(libraries = {POSTGRESQL, ORACLE, SPARK})
  public static final SqlFunction TO_DATE =
      new SqlFunction("TO_DATE",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.DATE_NULLABLE,
          null,
          OperandTypes.STRING_STRING,
          SqlFunctionCategory.TIMEDATE);

  /** The "TO_TIMESTAMP(string1, string2)" function; casts string1
   * to a TIMESTAMP using the format specified in string2. */
  @LibraryOperator(libraries = {POSTGRESQL, ORACLE, SNOWFLAKE})
  public static final SqlFunction TO_TIMESTAMP =
      new SqlFunction("TO_TIMESTAMP",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.DATE_NULLABLE,
          null,
          OperandTypes.STRING_STRING,
          SqlFunctionCategory.TIMEDATE);

  /** The "TIMESTAMP_SECONDS(bigint)" function; returns a TIMESTAMP value
   * a given number of seconds after 1970-01-01 00:00:00. */
  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction TIMESTAMP_SECONDS =
      new SqlFunction("TIMESTAMP_SECONDS", SqlKind.OTHER_FUNCTION,
          ReturnTypes.TIMESTAMP_NULLABLE, null, OperandTypes.INTEGER,
          SqlFunctionCategory.TIMEDATE);

  /** The "TIMESTAMP_MILLIS(bigint)" function; returns a TIMESTAMP value
   * a given number of milliseconds after 1970-01-01 00:00:00. */
  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction TIMESTAMP_MILLIS =
      new SqlFunction("TIMESTAMP_MILLIS", SqlKind.OTHER_FUNCTION,
          ReturnTypes.TIMESTAMP_NULLABLE, null, OperandTypes.INTEGER,
          SqlFunctionCategory.TIMEDATE);

  /** The "TIMESTAMP_MICROS(bigint)" function; returns a TIMESTAMP value
   * a given number of micro-seconds after 1970-01-01 00:00:00. */
  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction TIMESTAMP_MICROS =
      new SqlFunction("TIMESTAMP_MICROS", SqlKind.OTHER_FUNCTION,
          ReturnTypes.TIMESTAMP_NULLABLE, null, OperandTypes.INTEGER,
          SqlFunctionCategory.TIMEDATE);

  /** The "UNIX_SECONDS(bigint)" function; returns the number of seconds
   * since 1970-01-01 00:00:00. */
  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction UNIX_SECONDS =
      new SqlFunction("UNIX_SECONDS", SqlKind.OTHER_FUNCTION,
          ReturnTypes.BIGINT_NULLABLE, null, OperandTypes.TIMESTAMP,
          SqlFunctionCategory.TIMEDATE);

  /** The "UNIX_MILLIS(bigint)" function; returns the number of milliseconds
   * since 1970-01-01 00:00:00. */
  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction UNIX_MILLIS =
      new SqlFunction("UNIX_MILLIS", SqlKind.OTHER_FUNCTION,
          ReturnTypes.BIGINT_NULLABLE, null, OperandTypes.TIMESTAMP,
          SqlFunctionCategory.TIMEDATE);

  /** The "UNIX_MICROS(bigint)" function; returns the number of microseconds
   * since 1970-01-01 00:00:00. */
  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction UNIX_MICROS =
      new SqlFunction("UNIX_MICROS", SqlKind.OTHER_FUNCTION,
          ReturnTypes.BIGINT_NULLABLE, null, OperandTypes.TIMESTAMP,
          SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {ORACLE})
  public static final SqlFunction CHR =
      new SqlFunction("CHR",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.CHAR,
          null,
          OperandTypes.INTEGER,
          SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {ORACLE})
  public static final SqlFunction TANH =
      new SqlFunction("TANH",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.DOUBLE_NULLABLE,
          null,
          OperandTypes.NUMERIC,
          SqlFunctionCategory.NUMERIC);

  @LibraryOperator(libraries = {ORACLE})
  public static final SqlFunction COSH =
      new SqlFunction("COSH",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.DOUBLE_NULLABLE,
          null,
          OperandTypes.NUMERIC,
          SqlFunctionCategory.NUMERIC);

  @LibraryOperator(libraries = {ORACLE})
  public static final SqlFunction SINH =
      new SqlFunction("SINH",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.DOUBLE_NULLABLE,
          null,
          OperandTypes.NUMERIC,
          SqlFunctionCategory.NUMERIC);

  @LibraryOperator(libraries = {MYSQL, POSTGRESQL})
  public static final SqlFunction MD5 =
      new SqlFunction("MD5",
        SqlKind.OTHER_FUNCTION,
        ReturnTypes.explicit(SqlTypeName.VARCHAR)
          .andThen(SqlTypeTransforms.TO_NULLABLE),
        null,
        OperandTypes.or(OperandTypes.STRING, OperandTypes.BINARY),
        SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {MYSQL, POSTGRESQL})
  public static final SqlFunction SHA1 =
      new SqlFunction("SHA1",
        SqlKind.OTHER_FUNCTION,
        ReturnTypes.explicit(SqlTypeName.VARCHAR)
          .andThen(SqlTypeTransforms.TO_NULLABLE),
        null,
        OperandTypes.or(OperandTypes.STRING, OperandTypes.BINARY),
        SqlFunctionCategory.STRING);

  /** Infix "::" cast operator used by PostgreSQL, for example
   * {@code '100'::INTEGER}. */
  @LibraryOperator(libraries = {POSTGRESQL})
  public static final SqlOperator INFIX_CAST =
      new SqlCastOperator();

  @LibraryOperator(libraries = {STANDARD})
  public static final SqlFunction FORMAT =
      new SqlFunction(
        "FORMAT",
        SqlKind.FORMAT,
        ReturnTypes.VARCHAR_2000_NULLABLE, null,
        OperandTypes.family(SqlTypeFamily.STRING, SqlTypeFamily.NUMERIC),
        SqlFunctionCategory.STRING);

  /** The "TO_NUMBER(string1, string2)" function; casts string1
   * as hexadecimal to a NUMBER using the format specified in string2. */
  @LibraryOperator(libraries = {TERADATA, POSTGRESQL, ORACLE})
  public static final SqlFunction TO_NUMBER =
      new SqlFunction(
        "TO_NUMBER",
        SqlKind.TO_NUMBER,
        ReturnTypes.BIGINT_FORCE_NULLABLE,
        null, OperandTypes.or(OperandTypes.STRING, OperandTypes.STRING_STRING,
        OperandTypes.family(SqlTypeFamily.STRING, SqlTypeFamily.NULL),
        OperandTypes.family(SqlTypeFamily.NULL, SqlTypeFamily.STRING),
        OperandTypes.STRING_STRING_STRING,
        OperandTypes.family(SqlTypeFamily.NULL)),
        SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {HIVE, SPARK})
  public static final SqlFunction CONV =
          new SqlFunction(
                  "CONV",
                  SqlKind.OTHER_FUNCTION,
                  ReturnTypes.VARCHAR_4_NULLABLE, null,
                  OperandTypes.family(SqlTypeFamily.STRING, SqlTypeFamily.NUMERIC,
                          SqlTypeFamily.NUMERIC),
                  SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {BIG_QUERY, HIVE, SPARK})
  public static final SqlFunction RPAD =
      new SqlFunction("RPAD", SqlKind.OTHER_FUNCTION,
        ReturnTypes.VARCHAR_2000_NULLABLE, null,
        OperandTypes.STRING_INTEGER_OPTIONAL_STRING,
        SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {BIG_QUERY, HIVE, SPARK})
  public static final SqlFunction LPAD =
      new SqlFunction("LPAD", SqlKind.OTHER_FUNCTION,
        ReturnTypes.VARCHAR_2000_NULLABLE, null,
        OperandTypes.STRING_INTEGER_OPTIONAL_STRING,
        SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {STANDARD})
  public static final SqlFunction STR_TO_DATE = new SqlFunction(
      "STR_TO_DATE",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.DATE_NULLABLE,
      null,
      OperandTypes.STRING_STRING,
      SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction PARSE_DATE =
      new SqlFunction(
        "PARSE_DATE",
        SqlKind.OTHER_FUNCTION,
        ReturnTypes.DATE_NULLABLE, null,
        OperandTypes.STRING_STRING,
        SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction PARSE_TIME =
      new SqlFunction(
          "PARSE_TIME",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.TIME_NULLABLE, null,
          OperandTypes.STRING_STRING,
          SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction PARSE_TIMESTAMP =
      new SqlFunction("PARSE_TIMESTAMP",
        SqlKind.OTHER_FUNCTION,
        ReturnTypes.TIMESTAMP_NULLABLE,
        null,
        OperandTypes.or(OperandTypes.STRING, OperandTypes.STRING_STRING),
        SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction PARSE_DATETIME =
      new SqlFunction("PARSE_DATETIME",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.ARG1_NULLABLE,
          null,
          OperandTypes.or(OperandTypes.STRING, OperandTypes.STRING_STRING),
          SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {HIVE, SPARK})
  public static final SqlFunction UNIX_TIMESTAMP =
      new SqlFunction(
        "UNIX_TIMESTAMP",
        SqlKind.OTHER_FUNCTION,
        ReturnTypes.BIGINT_NULLABLE, null,
        OperandTypes.family(ImmutableList.of(SqlTypeFamily.STRING, SqlTypeFamily.STRING),
          // both the operands are optional
          number -> number == 0 || number == 1),
        SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {HIVE, SPARK})
  public static final SqlFunction FROM_UNIXTIME =
      new SqlFunction(
        "FROM_UNIXTIME",
        SqlKind.OTHER_FUNCTION,
        ReturnTypes.VARCHAR_2000_NULLABLE, null,
        OperandTypes.family(ImmutableList.of(SqlTypeFamily.INTEGER, SqlTypeFamily.STRING),
          // Second operand is optional
          number -> number == 1),
        SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {STANDARD})
  public static final SqlFunction STRING_SPLIT = new SqlFunction(
      "STRING_SPLIT",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.MULTISET_NULLABLE,
      null,
      OperandTypes.STRING_STRING,
      SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {HIVE, SPARK})
  public static final SqlFunction SPLIT = new SqlFunction(
      "SPLIT",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.MULTISET_NULLABLE,
      null,
      OperandTypes.STRING_STRING,
      SqlFunctionCategory.STRING);

  /** The "TO_VARCHAR(numeric, string)" function; casts string
   * Format first_operand to specified in second operand. */
  @LibraryOperator(libraries = {SNOWFLAKE})
  public static final SqlFunction TO_VARCHAR =
      new SqlFunction(
        "TO_VARCHAR",
        SqlKind.OTHER_FUNCTION,
        ReturnTypes.VARCHAR_2000_NULLABLE, null,
        OperandTypes.family(SqlTypeFamily.NUMERIC, SqlTypeFamily.STRING),
        SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction TIMESTAMP_TO_DATE = new SqlFunction(
      "DATE",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.ARG0_NULLABLE,
      null,
      OperandTypes.DATETIME,
      SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {BIG_QUERY, SPARK})
  public static final SqlFunction FORMAT_DATETIME = new SqlFunction(
      "FORMAT_DATETIME",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.ARG0,
      null,
      OperandTypes.ANY_ANY,
      SqlFunctionCategory.TIMEDATE);

  /** Returns the index of search string in source string
   *  0 is returned when no match is found. */
  @LibraryOperator(libraries = {SNOWFLAKE, BIG_QUERY})
  public static final SqlFunction INSTR = new SqlFunction(
          "INSTR",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER_NULLABLE,
          null,
          OperandTypes.family(ImmutableList.of
          (SqlTypeFamily.STRING, SqlTypeFamily.STRING,
          SqlTypeFamily.INTEGER, SqlTypeFamily.INTEGER),
              number -> number == 2 || number == 3),
          SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {MSSQL})
  public static final SqlFunction CHARINDEX = new SqlFunction(
          "CHARINDEX",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER_NULLABLE,
          null,
          OperandTypes.family(ImmutableList.of
          (SqlTypeFamily.STRING, SqlTypeFamily.STRING,
          SqlTypeFamily.INTEGER),
              number -> number == 2),
          SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction TIME_DIFF = new SqlFunction(
          "TIME_DIFF",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER,
          null,
          OperandTypes.family(SqlTypeFamily.DATETIME, SqlTypeFamily.DATETIME),
          SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction TIMESTAMPINTADD = new SqlFunction("TIMESTAMPINTADD",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.TIMESTAMP, null,
          OperandTypes.family(SqlTypeFamily.DATETIME, SqlTypeFamily.INTEGER),
          SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction TIMESTAMPINTSUB = new SqlFunction("TIMESTAMPINTSUB",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.TIMESTAMP, null,
          OperandTypes.family(SqlTypeFamily.DATETIME, SqlTypeFamily.INTEGER),
          SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {TERADATA})
  public static final SqlFunction WEEKNUMBER_OF_YEAR =
      new SqlFunction("WEEKNUMBER_OF_YEAR", SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER, null, OperandTypes.DATETIME,
          SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {TERADATA})
  public static final SqlFunction YEARNUMBER_OF_CALENDAR =
      new SqlFunction("YEARNUMBER_OF_CALENDAR", SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER, null, OperandTypes.DATETIME,
          SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {TERADATA})
  public static final SqlFunction MONTHNUMBER_OF_YEAR =
      new SqlFunction("MONTHNUMBER_OF_YEAR", SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER, null, OperandTypes.DATETIME,
          SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {TERADATA})
  public static final SqlFunction QUARTERNUMBER_OF_YEAR =
      new SqlFunction("QUARTERNUMBER_OF_YEAR", SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER, null, OperandTypes.DATETIME,
          SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {TERADATA})
  public static final SqlFunction WEEKNUMBER_OF_MONTH =
      new SqlFunction("WEEKNUMBER_OF_MONTH", SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER, null, OperandTypes.DATETIME,
          SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {TERADATA})
  public static final SqlFunction MONTHNUMBER_OF_QUARTER =
      new SqlFunction("MONTHNUMBER_OF_QUARTER", SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER, null, OperandTypes.DATETIME,
          SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {TERADATA})
  public static final SqlFunction WEEKNUMBER_OF_CALENDAR =
      new SqlFunction("WEEKNUMBER_OF_CALENDAR", SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER, null, OperandTypes.DATETIME,
          SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {TERADATA})
  public static final SqlFunction DAYOCCURRENCE_OF_MONTH =
      new SqlFunction("DAYOCCURRENCE_OF_MONTH", SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER, null, OperandTypes.DATETIME,
          SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {TERADATA})
  public static final SqlFunction DAYNUMBER_OF_CALENDAR =
        new SqlFunction("DAYNUMBER_OF_CALENDAR", SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER, null, OperandTypes.DATETIME,
          SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction DATE_DIFF =
      new SqlFunction("DATE_DIFF", SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER, null,
          OperandTypes.family(
              ImmutableList.of(SqlTypeFamily.DATE, SqlTypeFamily.DATE,
            SqlTypeFamily.STRING),
            number -> number == 2),
          SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {SPARK})
  public static final SqlFunction DATEDIFF =
      new SqlFunction("DATEDIFF", SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER, null,
          OperandTypes.family(SqlTypeFamily.DATE, SqlTypeFamily.DATE),
          SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {STANDARD})
  public static final SqlFunction DATE_MOD = new SqlFunction(
      "DATE_MOD",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.INTEGER_NULLABLE,
      null,
      OperandTypes.family(SqlTypeFamily.DATE, SqlTypeFamily.INTEGER),
      SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {TERADATA, SNOWFLAKE})
  public static final SqlFunction STRTOK = new SqlFunction(
      "STRTOK",
      SqlKind.OTHER_FUNCTION,
      ReturnTypes.VARCHAR_2000_NULLABLE,
      null,
      OperandTypes.or(OperandTypes.STRING_STRING_INTEGER,
          OperandTypes.family(SqlTypeFamily.NULL, SqlTypeFamily.STRING, SqlTypeFamily.INTEGER)),
      SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction TIME_SUB =
      new SqlFunction("TIME_SUB",
          SqlKind.MINUS,
          ReturnTypes.TIME,
          null,
          OperandTypes.DATETIME_INTERVAL,
          SqlFunctionCategory.TIMEDATE) {

        @Override public void unparse(SqlWriter writer, SqlCall call, int leftPrec, int rightPrec) {
          writer.getDialect().unparseIntervalOperandsBasedFunctions(
              writer, call, leftPrec, rightPrec);
        }
      };

  @LibraryOperator(libraries = {SNOWFLAKE})
  public static final SqlFunction TO_BINARY =
      new SqlFunction("TO_BINARY",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.BINARY,
          null,
          OperandTypes.family(
              ImmutableList.of(SqlTypeFamily.NUMERIC, SqlTypeFamily.STRING),
              number -> number == 1),
          SqlFunctionCategory.TIMEDATE);

  @LibraryOperator(libraries = {SNOWFLAKE})
  public static final SqlFunction TO_CHAR =
      new SqlFunction("TO_CHAR",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.VARCHAR_2000_NULLABLE, null,
              OperandTypes.family(SqlTypeFamily.NUMERIC, SqlTypeFamily.STRING),
          SqlFunctionCategory.STRING);

  @LibraryOperator(libraries = {NETEZZA})
  public static final SqlFunction MONTHS_BETWEEN =
      new SqlFunction("MONTHS_BETWEEN",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER_NULLABLE, null,
          OperandTypes.family(SqlTypeFamily.DATE, SqlTypeFamily.DATE),
          SqlFunctionCategory.NUMERIC);

  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction REGEXP_MATCH_COUNT =
      new SqlFunction("REGEXP_MATCH_COUNT",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.VARCHAR_2000,
          null,
          OperandTypes.family(
              ImmutableList.of(SqlTypeFamily.STRING, SqlTypeFamily.STRING,
              SqlTypeFamily.NUMERIC, SqlTypeFamily.STRING),
              number -> number == 2 || number == 3),
          SqlFunctionCategory.NUMERIC);

  @LibraryOperator(libraries = {NETEZZA})
  public static final SqlFunction BITWISE_AND =
      new SqlFunction("BITWISE_AND",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER_NULLABLE, null,
          OperandTypes.family(SqlTypeFamily.NUMERIC, SqlTypeFamily.NUMERIC),
          SqlFunctionCategory.NUMERIC);

  @LibraryOperator(libraries = {NETEZZA})
  public static final SqlFunction BITWISE_OR =
      new SqlFunction("BITWISE_OR",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER_NULLABLE, null,
          OperandTypes.family(SqlTypeFamily.NUMERIC, SqlTypeFamily.NUMERIC),
          SqlFunctionCategory.NUMERIC);

  @LibraryOperator(libraries = {NETEZZA})
  public static final SqlFunction BITWISE_XOR =
      new SqlFunction("BITWISE_XOR",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER_NULLABLE, null,
          OperandTypes.family(SqlTypeFamily.NUMERIC, SqlTypeFamily.NUMERIC),
          SqlFunctionCategory.NUMERIC);

  @LibraryOperator(libraries = {NETEZZA})
  public static final SqlFunction INT2SHL =
      new SqlFunction("INT2SHL",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER_NULLABLE, null,
          OperandTypes.family(SqlTypeFamily.NUMERIC, SqlTypeFamily.NUMERIC,
                  SqlTypeFamily.NUMERIC),
          SqlFunctionCategory.NUMERIC);

  @LibraryOperator(libraries = {NETEZZA})
  public static final SqlFunction INT8XOR =
          new SqlFunction("INT8XOR",
                  SqlKind.OTHER_FUNCTION,
                  ReturnTypes.INTEGER_NULLABLE, null,
                  OperandTypes.family(SqlTypeFamily.NUMERIC, SqlTypeFamily.NUMERIC),
                  SqlFunctionCategory.NUMERIC);

  @LibraryOperator(libraries = {NETEZZA})
  public static final SqlFunction INT2SHR =
      new SqlFunction("INT2SHR",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER_NULLABLE, null,
          OperandTypes.family(SqlTypeFamily.NUMERIC, SqlTypeFamily.NUMERIC,
                  SqlTypeFamily.NUMERIC),
          SqlFunctionCategory.NUMERIC);

  @LibraryOperator(libraries = {NETEZZA})
  public static final SqlFunction PI = new SqlFunction("PI",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.DECIMAL_MOD_NULLABLE, null,
          OperandTypes.family(SqlTypeFamily.NULL),
          SqlFunctionCategory.NUMERIC);

  @LibraryOperator(libraries = {NETEZZA})
  public static final SqlFunction ACOS = new SqlFunction("ACOS",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.DECIMAL_MOD_NULLABLE, null,
          OperandTypes.family(SqlTypeFamily.NUMERIC),
          SqlFunctionCategory.NUMERIC);

  @LibraryOperator(libraries = {NETEZZA})
  public static final SqlFunction OCTET_LENGTH = new SqlFunction("OCTET_LENGTH",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER_NULLABLE, null,
          OperandTypes.family(SqlTypeFamily.CHARACTER),
          SqlFunctionCategory.NUMERIC);

  @LibraryOperator(libraries = {BIG_QUERY, SPARK})
  public static final SqlFunction REGEXP_CONTAINS =
      new SqlFunction("REGEXP_CONTAINS",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.BOOLEAN,
          null,
          OperandTypes.STRING_STRING,
          SqlFunctionCategory.NUMERIC);

  @LibraryOperator(libraries = {TERADATA})
  public static final SqlFunction HASHBUCKET =
      new SqlFunction(
          "HASHBUCKET",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER_NULLABLE,
          null,
          OperandTypes.INTEGER,
          SqlFunctionCategory.SYSTEM);

  @LibraryOperator(libraries = {TERADATA})
  public static final SqlFunction HASHROW =
      new SqlFunction(
          "HASHROW",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER_NULLABLE,
          null,
          OperandTypes.ONE_OR_MORE,
          SqlFunctionCategory.SYSTEM);

  @LibraryOperator(libraries = {BIG_QUERY})
  public static final SqlFunction FARM_FINGERPRINT =
      new SqlFunction(
          "FARM_FINGERPRINT",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER_NULLABLE,
          null,
          OperandTypes.STRING,
          SqlFunctionCategory.SYSTEM);

  @LibraryOperator(libraries = {NETEZZA})
  public static final SqlFunction ROWID =
      new SqlFunction(
          "ROWID",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.INTEGER_NULLABLE,
          null,
          null,
          SqlFunctionCategory.SYSTEM);

  @LibraryOperator(libraries = {TERADATA})
  public static final SqlFunction TRUNC =
      new SqlFunction(
          "TRUNC",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.DATE,
          null,
          OperandTypes.family(SqlTypeFamily.DATE,
          SqlTypeFamily.STRING), SqlFunctionCategory.SYSTEM);

  @LibraryOperator(libraries = {SPARK})
  public static final SqlFunction RAISE_ERROR =
      new SqlFunction("RAISE_ERROR",
          SqlKind.OTHER_FUNCTION,
          null,
          null,
          OperandTypes.STRING,
          SqlFunctionCategory.SYSTEM);

  @LibraryOperator(libraries = {NETEZZA})
  public static final SqlFunction TRUE =
      new SqlFunction(
          "TRUE",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.BOOLEAN,
          null,
          null,
          SqlFunctionCategory.SYSTEM);

  @LibraryOperator(libraries = {NETEZZA})
  public static final SqlFunction FALSE =
      new SqlFunction(
          "FALSE",
          SqlKind.OTHER_FUNCTION,
          ReturnTypes.BOOLEAN,
          null,
          null,
          SqlFunctionCategory.SYSTEM);
}


text:
typedef struct Irqmap {
	int irq;
    struct gpio gpiostruct;
} Irqmap;

int free_irq_gpio(struct Irqmap leds_gpiostruct[], int size);

int gpio_request_arr(struct Irqmap leds_gpiostruct[], int size);

int request_irq_array(struct Irqmap leds_gpiostruct[], int size);

#endif //_GPIO_MISC_H


text:
<?xml version="1.0" encoding="utf-8"?>
<Monster xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Name>ochre jelly</Name>
  <Attack1>Engulfs and covers with acidic slime 3d6</Attack1>
  <Attack2> Passive 3d6 acid</Attack2>
  <Difficulty>8</Difficulty>
  <BaseLevel>6</BaseLevel>
  <BaseExperience>88</BaseExperience>
  <Speed>3</Speed>
  <BaseAC>8</BaseAC>
  <BaseMR>20</BaseMR>
  <Alignment>0 (neutral)</Alignment>
  <Frequency>(by normal means) 2 (Quite rare)</Frequency>
  <GenoCidable>Yes</GenoCidable>
  <Weight>50</Weight>
  <NutritionalValue>20</NutritionalValue>
  <Size>Medium</Size>
  <Resistances>conveyed none</Resistances>
  <ResistancesConveyed>none</ResistancesConveyed>
  <Characteristics>
    <string>can flow under doors. </string>
    <string>does not breathe. </string>
    <string>cannot pick up items. </string>
    <string>has no eyes. </string>
    <string>has no limbs. </string>
    <string>has no head. </string>
    <string>is mindless. </string>
    <string>is acidic to eat. </string>
    <string>does not eat. (*) </string>
    <string>is neither male nor female. </string>
    <string>is normally generated hostile.</string>
  </Characteristics>
</Monster>