[amlops@aq-qa2-monman1 groovy]$ groovy produce-error-report-from-orders.groovy -e qa2 -h aq-qa2-mysql1 -uspike -p tar63t -o /tmp/ INFO - Starting Query May 24, 2016 9:16:04 AM groovy.sql.Sql$AbstractQueryCommand execute WARNING: Failed to execute: SELECT DISTINCT r.name as `Reseller`, substring_index(searchEngineUsers.description, '_', 1) as `MerchantID`, (select description from mms_common.businessAreas where id = reverse(substring_index(reverse(substring_index(gce_campaign.name, '_', 2)), '_', 1))) as `BA`, (select description from mms_common.businessLocations where id = substring_index(reverse(substring_index(reverse(gce_campaign.name), '_', 2)), '_', 1)) as `BL`, gce_campaign.name as `CampaignName`, gce_adGroup.name as `AdGroupName`, gce_textAd.headline as `Headline`, gce_textAd.description1 as `Description1`, gce_textAd.description2 as `Description2`, gce_textAd.displayURL as `DisplayURL`, gce_textAd.destinationURL as `DestinationURL`, gce_textAdError.errorCode as `ErrorCode`, gce_textAdError.errorText as `ErrorText`, gce_textAdError.reason as `Reason`, gce_textAdError.policyName as `PolicyName`, gce_textAdError.`field` as `Field`, gce_textAdError.`trigger` as `Trigger`, gce_textAdError.isExemptable as `IsExemptable`, o.id as `OrderID`, -1 as `IsCustomized`, /* to save bandwidth, only return json on orders we suspect have custom ads */ customOrders.json as `orderJson` FROM content_editor_google.gce_campaign JOIN tsacommon.searchEngineUsers on searchEngineUserID = searchEngineUsers.id JOIN smb.merchants m on m.id = substring_index(searchEngineUsers.description, '_', 1) JOIN smb.resellers r on r.id = m.reseller_id JOIN smb.orders o on o.merchant_id = m.id and o.state not in ('paused', 'error', 'quote', 'archived') /* * do a left join on smb.orders again, this time looking for json that might contain custom ads * if the json doesn't contain "delta" then this join will return null, that way we don't waste * network bandwidth sending back a json string that for sure won't have custom ad text */ LEFT JOIN smb.orders customOrders on customOrders.id = o.id and customOrders.json like '%"delta"%' JOIN content_editor_google.gce_adGroup on gce_campaign.id = campaignID JOIN content_editor_google.gce_textAd on adGroupID = gce_adGroup.id JOIN content_editor_google.gce_textAdError on textAdID = gce_textAd.id JOIN clients.externalCampaign on gceCampaignID = gce_campaign.id JOIN clients.externalCampaignParent on externalCampaignParent.id = externalCampaignParentID WHERE gce_campaign.status != 'Deleted' AND gce_adGroup.status != 'Deleted' AND gce_textAd.status != 'Disabled' AND gce_textAdError.errorText = 'Editorial Rejection' ORDER BY MerchantID, OrderID, gce_campaign.id because: Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation '=' Caught: java.sql.SQLException: Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation '=' java.sql.SQLException: Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_general_ci,IMPLICIT) for operation '=' at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465) at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1383) at produce-error-report-from-orders.run(produce-error-report-from-orders.groovy:159)