tianyang/spider2-aifunc huggingface dataset:
Database: IPL
Task: Identify the top 3 bowlers who conceded the highest number of runs in a single over, considering only overs that had the maximum runs conceded within their respective matches. For each bowler, show only their single worst over performance (highest runs conceded). When ranking, first sort by runs conceded in descending order. For ties in runs conceded, rank by how similar the bowler's bowling skill description is to 'fast pace bowling' (higher similarity first, rounded to 2 decimal places for comparison stability), treating NULL or missing bowling skills as empty text. For remaining ties, sort by player name alphabetically, then by match ID. Return the player name, match ID, and runs conceded in the over.
Required AI functions: AI_SIMILARITY
Database: IPL
Task: Among bowlers who conceded runs in single overs that were the maximum-run overs of their respective matches, identify the top 3 bowlers whose extracted bowling style is 'medium' (extracted from bowling_skill using the question 'What is the bowling style? Return exactly one word: fast, medium, medium-fast, spin, offbreak, legbreak, or the specific style'). For these medium-pace bowlers, return their name, the match ID where they conceded the most runs in such an over, and the runs conceded. If there are ties in runs conceded, order alphabetically by bowler name, then by match ID.
Required AI functions: AI_EXTRACT
Database: BRAZILIAN_E_COMMERCE
Task: Among the top 50 customers ranked by number of delivered orders (with ties broken by customer_unique_id alphabetically ascending) who have left review comments, identify those whose aggregated review text has overall 'positive' sentiment. Return the top three such customers ranked by number of delivered orders descending, with ties broken by customer_unique_id alphabetically ascending. For each customer, provide their customer_unique_id, the count of delivered orders, the average total payment per order rounded to 2 decimal places (calculated by first summing all payment values for each order, then averaging across orders), their city, and their state.
Required AI functions: AI_SENTIMENT
Database: BRAZILIAN_E_COMMERCE
Task: Among customers who have written at least one review comment, identify the top 3 by number of delivered orders (by customer_unique_id). For each, provide their average total payment per order (calculated by first summing all payment values for each order, then averaging these order totals), city, state, overall review sentiment, and a summary of their feedback themes. Aggregate each customer's review comments using the instruction 'Summarize the main feedback themes in 2-3 phrases, formatted as: Theme1; Theme2; Theme3', then determine the overall sentiment of this summary (returning one of: 'positive', 'negative', 'neutral', 'mixed', or 'unknown'). Order results by delivered order count descending, with ties broken by customer_unique_id ascending.
Required AI functions: AI_AGG, AI_SENTIMENT
Database: BRAZILIAN_E_COMMERCE
Task: In the year with the lowest annual delivered orders volume among 2016, 2017, and 2018, what was the highest monthly delivered orders volume, and what are the main issues mentioned in the top 50 reviews most similar to 'customer complaint about product quality, delivery delay, or poor service' from orders delivered in that peak month (with ties in similarity broken by review_id in ascending order), aggregated using the instruction 'From these complaint categories: [Atraso na entrega, Produto não recebido, Produto errado, Produto danificado, Qualidade ruim, Atendimento ruim], identify the top 3 most frequently mentioned. Output exactly 3 categories from the list, formatted as: category1; category2; category3'?
Required AI functions: AI_AGG, AI_SIMILARITY
Database: BRAZILIAN_E_COMMERCE
Task: For sellers with delivered orders, identify the top performer in each of four achievement categories: most distinct customer unique IDs, highest profit (calculated as price minus freight value), most distinct orders, and most 5-star ratings. For each winning seller, analyze their 5-star review comments (limited to the 10 most recent per achievement, ordered by review creation date descending with review ID descending as tie-breaker, filtering to only comments with similarity above 0.3 to 'Excellent product quality and fast reliable delivery service') and aggregate these comments using the instruction 'List exactly 3 one-word themes from: delivery, quality, price, service, packaging, communication. Format: theme1; theme2; theme3'. Return each achievement description, the seller ID, the metric value, and the praise themes summary.
Required AI functions: AI_AGG, AI_SIMILARITY
Database: BRAZILIAN_E_COMMERCE
Task: For the 100 most recent orders (by order purchase timestamp, with ties broken by order ID in descending order) that have reviews with non-empty comment messages, at least one product with a valid category name, and at least one payment record, analyze only those with 'positive' overall sentiment (using sentiment analysis on the review comment message). For each product category represented in these positive-sentiment orders (using English category names where available, falling back to Portuguese names), identify the most preferred payment method - defined as the payment type with the highest number of payment records. If there is a tie in payment counts, select the payment method that comes first alphabetically. Then calculate the average of these highest payment counts across all represented categories, rounded to the nearest whole number.
Required AI functions: AI_SENTIMENT
Database: BRAZILIAN_E_COMMERCE
Task: Among product categories where at least 30% of sampled customer reviews (up to 50 reviews per category, sampled by order_id in ascending order) have 'positive' overall sentiment, identify the top three categories whose most commonly used payment type has the highest number of payments. When counting payments for a category, associate each order with the category once (even if the order contains multiple items from that category), then count all payment records for those orders. Display the category name in English (using the translation table, falling back to the original Portuguese name if no translation exists), the dominant payment type, and the payment count. For ties in payment count within a category, prefer the payment type that comes first alphabetically. For ties in payment count across categories, order by category name alphabetically.
Required AI functions: AI_SENTIMENT
Database: PAGILA
Task: Which actor appeared most frequently in English-language films released between 2000 and 2010 that were rated G or PG, had a running time of 120 minutes or less, and whose descriptions semantically indicate content highly appropriate for young children? Use the filter condition 'This film description indicates content that is highly appropriate and entertaining for young children under 10 years old: ' concatenated with the film description to identify child-appropriate films. Return the actor's full name (first name followed by last name) as a single field. If there is a tie in film count, rank alphabetically by the actor's full name.
Required AI functions: AI_FILTER
Database: PAGILA
Task: Which actor starred most frequently in English-language children's category films that were rated G or PG, had a running time of 120 minutes or less, were released between 2000 and 2010, and whose film descriptions have 'positive' overall sentiment? Provide the actor's full name (first and last name combined). If there is a tie in film count, rank alphabetically by full name.
Required AI functions: AI_SENTIMENT
Database: PAGILA
Task: Among films rented in cities where the city name starts with 'A' or contains a hyphen, classify each film into exactly one of ['Family Entertainment', 'Action & Thriller', 'Drama & Romance', 'Comedy', 'Documentary & Educational'] based on its description. Only consider films with a semantic similarity score above 0.3 to 'exciting entertaining popular movie'. Which content type has the highest total rental hours?
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: MODERN_DATA
Task: In the combined dataset joining trees with income data by ZIP code (where duplicate ZIP codes in the income table are handled by averaging their income values), restricted to records with both median and mean income greater than zero and a non-empty borough name, identify the three boroughs with the highest tree count among those that qualify as residential areas with favorable economic profiles.

First, filter to only include boroughs where the condition 'The borough "{borough}" in New York City is a residential area: ' evaluates to true. Then, classify each borough's economic tier into exactly one of ['High Income Area', 'Middle Income Area', 'Low Income Area'] based on a description formatted as 'Area: {borough}, Average Income: ${avg_mean_income_rounded_to_whole_dollar}'. Only include boroughs classified as 'High Income Area' or 'Middle Income Area'.

Return the borough name, tree count, average mean income, and economic tier classification for the top 3 boroughs by tree count. If there are ties in tree count, order alphabetically by borough name.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: MODERN_DATA
Task: For trees in the Bronx, classify each neighborhood into one of ['Residential', 'Commercial', 'Industrial', 'Park/Green Space', 'Mixed Use'] based on the neighborhood name (nta_name field). For each environment type, calculate the percentage of trees with 'Good' health status (rounded to 2 decimal places) and the total tree count. Order results by semantic similarity to 'ideal environment for healthy urban trees' in descending order, with ties broken alphabetically by environment type.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: MODERN_DATA
Task: Among trees in the Bronx with status 'Alive', what percentage have health status 'Good'? Also, for the healthy trees, summarize the most common species by aggregating the top 20 species by count, where each species is formatted as '{species_name}: {count} trees', using the aggregation instruction: 'List the top 5 species with their tree counts, formatted as: species1 (count), species2 (count), species3 (count), species4 (count), species5 (count)'.
Required AI functions: AI_AGG
Database: CHINOOK
Task: What are the first names and amounts spent by customers from European countries who spent less than $1 on albums by the best-selling artist (determined by total revenue), but only considering albums whose titles have a semantic similarity score above 0.2 to 'heavy metal rock anthems'? Filter to European customers using the condition 'This country is located in Europe: ' concatenated with the country name. Order results by amount spent ascending, then by first name alphabetically for ties.
Required AI functions: AI_FILTER, AI_SIMILARITY
Database: SQLITE_SAKILA
Task: Among customers whose payment behavior is classified as 'Moderately Variable' or 'Highly Variable' from the categories ['Highly Variable', 'Moderately Variable', 'Stable'] based on a description formatted as 'Customer monthly payment pattern: average change of $[avg_change] over [num_months] month transitions', and whose payment pattern has a semantic similarity score greater than 0.4 to the reference phrase 'highly volatile and erratic spending with large unpredictable fluctuations between months', which customer has the highest average monthly change in payment amounts? Monthly change is defined as the absolute difference between consecutive months' total payments, excluding the first month (which has no prior month to compare). Provide the customer's full name as a single concatenated value (first name followed by last name).
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: SQLITE_SAKILA
Task: Which customer has the highest average month-over-month change in payment amounts (where each monthly change is calculated as the absolute difference between consecutive months' totals, excluding the first month which has no prior month to compare)? Provide the customer's full name (first and last name concatenated with a space) along with a summary of their viewing preferences based on the descriptions of films they've rented, aggregated using the instruction: 'Summarize the main genres and themes this customer enjoys, formatted as: [theme1], [theme2], [theme3]'.
Required AI functions: AI_AGG
Database: EDUCATION_BUSINESS
Task: For hardware product segments in 2020 and 2021 sales data, classify each segment into exactly one of ['Computing Devices', 'Add-on Components', 'Connectivity & Storage'] based on the segment name, where 'Computing Devices' means 'primary computing hardware like computers and laptops', 'Add-on Components' means 'accessories and peripherals that enhance computing devices', and 'Connectivity & Storage' means 'networking equipment and data storage solutions'. Filter to only segments NOT classified as 'Connectivity & Storage' to focus on consumer-facing hardware. Return the segment name, its strategic classification, and the unique product count for 2020, ordered by semantic similarity to 'essential hardware for modern digital workspaces' in descending order.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: COMPLEX_ORACLE
Task: In the United States, for Q4 2019 and Q4 2020 (using calendar_quarter_desc '2019-04' and '2020-04'), first select only those cities where total sales with no promotions (where promo_id is NULL, 0, or 999) rose by at least 20% from Q4 2019 to Q4 2020. Among these cities, rank products by their overall sales (still excluding promotions) in those quarters and take the top 20% using ROW_NUMBER with CEIL. Then compute each top product's share of total sales in Q4 2019 and Q4 2020 (as decimal fractions) and calculate the difference in share from Q4 2019 to Q4 2020.

For the final results, classify each product into exactly one of ['Bats', 'Training Equipment', 'Apparel', 'Accessories', 'Other'] based on the product name, and filter to only include products classified as 'Bats' or 'Training Equipment'. Additionally, only include products whose names are semantically similar to 'professional sports equipment for competitive athletes' with a similarity score above 0.3.

Return the product ID, product name, product category (the classification result), share in 2019, share in 2020, and share change, ordered by share change descending, with ties broken by product ID ascending.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: COMPLEX_ORACLE
Task: In the United States of America, for Q4 2019 and Q4 2020, identify cities where total sales (excluding promotions, where promo_id = 999 indicates no promotion) increased by at least 20% from Q4 2019 to Q4 2020. Among products sold in these qualifying cities during Q4 of both years (still excluding promotions), rank products by their combined Q4 2019 + Q4 2020 sales and select the top 20% using ROW_NUMBER ranking with CEIL rounding. For each top product, calculate its share of total sales in Q4 2019 and Q4 2020 separately as decimal fractions rounded to 6 decimal places (not percentages), then compute the share change (Q4 2020 share minus Q4 2019 share), also rounded to 6 decimal places. For each product, also extract from the product description the "primary_sport" using the extraction question 'What sport or activity is this product designed for? Answer in 1-3 words.' Return the product ID, product name, extracted primary sport, Q4 2019 share, Q4 2020 share, and share change, ordered by share change descending, with ties broken by product ID ascending.
Required AI functions: AI_EXTRACT
Database: COMPLEX_ORACLE
Task: What is the average projected monthly sales in USD for France in 2021, considering only product sales with promotions where promo_total_id = 1 and channels where channel_total_id = 1, where products are filtered to only those where the condition 'This product is designed for competitive or professional sports use: ' concatenated with the product name evaluates to true, and each remaining product is classified into exactly one of ['Professional Equipment', 'Training Equipment', 'Accessories', 'Fan Gear', 'Other'] based on its product name? Calculate projections by taking each product's monthly sales from 2019 and 2020, computing the growth rate as (sales_2020 - sales_2019) / sales_2019, applying this growth rate to sales_2020 to get projected 2021 sales, converting to USD using 2021 exchange rates, then averaging by month and product category. Return the month number (1-12), the AI-classified product category, and the average projected USD sales rounded to 2 decimal places, ordered by month number then by product category alphabetically.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: COMPLEX_ORACLE
Task: Among all products sold in the United States (country_iso_code = 'US') with promo_id=999, considering only those cities whose total sales increased by at least 20% from Q4 2019 (calendar_quarter_id=1772) to Q4 2020 (calendar_quarter_id=1776), identify products that rank in the top 20% of total combined sales across both quarters using NTILE(5) partitioning (quintile = 1). For each such product, classify it into exactly one of ['Baseball Equipment', 'Cricket Equipment', 'Training Equipment', 'Other Sports Equipment'] based on the product name. Additionally, filter to only include products where the condition 'This product represents primary sporting goods equipment rather than accessories or training aids: ' concatenated with the product name evaluates to true. Among the remaining products, which one has the smallest absolute percentage-point change in its share of total sales between Q4 2019 and Q4 2020? If there is a tie in percentage-point change, use the lowest prod_id as the tiebreaker. Return only the product name and its sport category classification.
Required AI functions: AI_CLASSIFY, AI_FILTER
Database: COMPLEX_ORACLE
Task: Among all products sold in the United States (country_iso_code='US') with promo_id=999, considering only cities whose sales increased by at least 20% from Q4 2019 (calendar_quarter_id=1772) to Q4 2020 (calendar_quarter_id=1776), identify the product in the top 20% of total sales (determined by NTILE(5) with quintile=1 ordered by total sales descending) that has the smallest absolute percentage-point change in its share of total sales between these two quarters. If there is a tie in percentage-point change, use the smallest prod_id as the tie-breaker. For this product, extract the sport type using the extraction question 'What sport is this product designed for?' and the equipment category using 'What specific type of equipment is this (e.g., bat, ball, glove, helmet, training aid)?' from a description formatted as 'Product: {prod_name}, Category: {prod_category}, Subcategory: {prod_subcategory}'. Return the product name, sport type, and equipment category.
Required AI functions: AI_EXTRACT
Database: CITY_LEGISLATION
Task: For cities inserted in April, May, and June from 2021 to 2023, calculate the monthly count, cumulative running total (sum of that month's counts across years up to the given year), and year-over-year growth percentages for both metrics. Year-over-year growth means comparing each year to the immediately preceding year (2022 compared to 2021, 2023 compared to 2022). Present results only for 2022 and 2023.

Rank the results by how semantically similar each month's trend description is to the reference phrase 'significant year-over-year decline in new city insertions indicating reduced data collection momentum', where the trend description is formatted as 'This month shows {monthly_yoy_growth}% change in city insertions compared to the same month last year, with cumulative growth of {running_total_yoy_growth}%'. Display the top 4 months most similar to this concerning trend pattern.

For each result, classify the trend severity into exactly one of ['Critical Decline', 'Moderate Decline', 'Minor Decline', 'Stable', 'Growth'] based on a description formatted as 'Year-over-year change in monthly city insertions: {monthly_yoy_growth}%', where 'Critical Decline' means 'severe decrease exceeding 5%', 'Moderate Decline' means 'notable decrease between 3% and 5%', 'Minor Decline' means 'slight decrease between 0% and 3%', 'Stable' means 'essentially unchanged, within 1% either direction', and 'Growth' means 'any positive increase'.

Display the year, full month name (e.g., 'April'), cities added in month, cumulative running total, monthly YoY growth percentage (rounded to 2 decimals), running total YoY growth percentage (rounded to 2 decimals), and the trend severity classification.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: CITY_LEGISLATION
Task: Among the countries that have the longest streak of consecutive city insert dates in June 2022 (where consecutive means actual sequential calendar days without gaps), return the uppercase 2-letter country codes. Order them first by economic development level based on country name classified into ['Developed Economy', 'Emerging Economy', 'Developing Economy'] (with 'Developed Economy' first, then 'Emerging Economy', then 'Developing Economy'), and within each level by semantic similarity of the country name to 'major global economic power with large population and growing technology sector' from highest to lowest.
Required AI functions: AI_CLASSIFY, AI_SIMILARITY
Database: CITY_LEGISLATION
Task: For June 2022, identify which countries have the longest streak of consecutive city insertion dates, where a "streak" means a run of consecutive calendar days (with no gaps) on which at least one city was inserted for that country. Return the uppercase 2-letter country codes of all countries that achieved the maximum streak length, along with a summary of cities inserted for each country during June 2022, aggregated using the instruction: 'List the cities inserted, formatted as: City1, City2, City3, ... (include up to 10 city names)'. Order results alphabetically by country code.
Required AI functions: AI_AGG
Database: MODERN_DATA
Task: For each pizza order, compute the final set of ingredients by starting with the standard recipe toppings, removing any excluded toppings, and adding any extra toppings. Format the ingredients as '{pizza_name}: {ingredients}' where ingredients appearing multiple times are prefixed with '2x ' (with a space after '2x') and listed first in alphabetical order, followed by single-occurrence ingredients in alphabetical order.

Then classify each order's dietary profile into exactly one of ['Meat-Heavy', 'Vegetarian', 'Balanced'] based on the final ingredients string. Also extract the primary protein source from the final ingredients using the extraction question 'What is the main meat or protein ingredient? If there is meat (such as Bacon, Beef, Chicken, Pepperoni, or Salami), return the primary meat. If there is no meat but Cheese is present, return "Cheese". If there is no meat and no cheese, return "None". Answer with just the ingredient name.' into a field named 'primary_protein'.

Return row_id, order_id, customer_id, pizza_name, final_ingredients, dietary_profile, and primary_protein. Order results by dietary_profile alphabetically, then by row_id ascending.
Required AI functions: AI_CLASSIFY, AI_EXTRACT
Database: BANK_SALES_TRADING
Task: For each customer, determine their financial trajectory trend from January to April 2020. Calculate the January and April balances from transaction data (where balance is the cumulative sum of deposits minus withdrawals/purchases). Determine the trend as 'Growing' if April balance > January balance, 'Declining' if April balance < January balance, or 'Stable' if equal. Use AI aggregation with the instruction 'Describe the pattern briefly in 5 words or less, e.g., steady decline, volatile recovery, gradual growth' to add a brief pattern description based on monthly data formatted as 'Mon YYYY: change=X, balance=Y'. Output format: trend, start balance, end balance, and pattern description. Order results by customer_id.
Required AI functions: AI_AGG