Add support for trivial where clause cases
Showing the changes to cmd/api-errors.go (1 of 59 files). Show all
Unified · Split
| @@ -27,6 +27,7 @@ import ( · 26 unmodified lines | ||
| 27 | 27 | "github.com/minio/minio/pkg/dns" |
| 28 | 28 | "github.com/minio/minio/pkg/event" |
| 29 | 29 | "github.com/minio/minio/pkg/hash" |
| 30 | + "github.com/minio/minio/pkg/s3select" | |
| 30 | 31 | ) |
| 31 | 32 | |
| 32 | 33 | // APIError structure |
| @@ -190,6 +191,7 @@ const ( · 157 unmodified lines | ||
| 190 | 191 | ErrAdminCredentialsMismatch |
| 191 | 192 | ErrInsecureClientRequest |
| 192 | 193 | ErrObjectTampered |
| 194 | + | |
| 193 | 195 | ErrHealNotImplemented |
| 194 | 196 | ErrHealNoSuchProcess |
| 195 | 197 | ErrHealInvalidClientToken |
| @@ -197,6 +199,93 @@ const ( · 1 unmodified line | ||
| 197 | 199 | ErrHealAlreadyRunning |
| 198 | 200 | ErrHealOverlappingPaths |
| 199 | 201 | ErrIncorrectContinuationToken |
| 202 | + | |
| 203 | + //S3 Select Errors | |
| 204 | + ErrEmptyRequestBody | |
| 205 | + ErrUnsupportedFunction | |
| 206 | + ErrInvalidExpressionType | |
| 207 | + ErrBusy | |
| 208 | + ErrUnauthorizedAccess | |
| 209 | + ErrExpressionTooLong | |
| 210 | + ErrIllegalSQLFunctionArgument | |
| 211 | + ErrInvalidKeyPath | |
| 212 | + ErrInvalidCompressionFormat | |
| 213 | + ErrInvalidFileHeaderInfo | |
| 214 | + ErrInvalidJSONType | |
| 215 | + ErrInvalidQuoteFields | |
| 216 | + ErrInvalidRequestParameter | |
| 217 | + ErrInvalidDataType | |
| 218 | + ErrInvalidTextEncoding | |
| 219 | + ErrInvalidDataSource | |
| 220 | + ErrInvalidTableAlias | |
| 221 | + ErrMissingRequiredParameter | |
| 222 | + ErrObjectSerializationConflict | |
| 223 | + ErrUnsupportedSQLOperation | |
| 224 | + ErrUnsupportedSQLStructure | |
| 225 | + ErrUnsupportedSyntax | |
| 226 | + ErrUnsupportedRangeHeader | |
| 227 | + ErrLexerInvalidChar | |
| 228 | + ErrLexerInvalidOperator | |
| 229 | + ErrLexerInvalidLiteral | |
| 230 | + ErrLexerInvalidIONLiteral | |
| 231 | + ErrParseExpectedDatePart | |
| 232 | + ErrParseExpectedKeyword | |
| 233 | + ErrParseExpectedTokenType | |
| 234 | + ErrParseExpected2TokenTypes | |
| 235 | + ErrParseExpectedNumber | |
| 236 | + ErrParseExpectedRightParenBuiltinFunctionCall | |
| 237 | + ErrParseExpectedTypeName | |
| 238 | + ErrParseExpectedWhenClause | |
| 239 | + ErrParseUnsupportedToken | |
| 240 | + ErrParseUnsupportedLiteralsGroupBy | |
| 241 | + ErrParseExpectedMember | |
| 242 | + ErrParseUnsupportedSelect | |
| 243 | + ErrParseUnsupportedCase | |
| 244 | + ErrParseUnsupportedCaseClause | |
| 245 | + ErrParseUnsupportedAlias | |
| 246 | + ErrParseUnsupportedSyntax | |
| 247 | + ErrParseUnknownOperator | |
| 248 | + ErrParseInvalidPathComponent | |
| 249 | + ErrParseMissingIdentAfterAt | |
| 250 | + ErrParseUnexpectedOperator | |
| 251 | + ErrParseUnexpectedTerm | |
| 252 | + ErrParseUnexpectedToken | |
| 253 | + ErrParseUnexpectedKeyword | |
| 254 | + ErrParseExpectedExpression | |
| 255 | + ErrParseExpectedLeftParenAfterCast | |
| 256 | + ErrParseExpectedLeftParenValueConstructor | |
| 257 | + ErrParseExpectedLeftParenBuiltinFunctionCall | |
| 258 | + ErrParseExpectedArgumentDelimiter | |
| 259 | + ErrParseCastArity | |
| 260 | + ErrParseInvalidTypeParam | |
| 261 | + ErrParseEmptySelect | |
| 262 | + ErrParseSelectMissingFrom | |
| 263 | + ErrParseExpectedIdentForGroupName | |
| 264 | + ErrParseExpectedIdentForAlias | |
| 265 | + ErrParseUnsupportedCallWithStar | |
| 266 | + ErrParseNonUnaryAgregateFunctionCall | |
| 267 | + ErrParseMalformedJoin | |
| 268 | + ErrParseExpectedIdentForAt | |
| 269 | + ErrParseAsteriskIsNotAloneInSelectList | |
| 270 | + ErrParseCannotMixSqbAndWildcardInSelectList | |
| 271 | + ErrParseInvalidContextForWildcardInSelectList | |
| 272 | + ErrIncorrectSQLFunctionArgumentType | |
| 273 | + ErrValueParseFailure | |
| 274 | + ErrEvaluatorInvalidArguments | |
| 275 | + ErrIntegerOverflow | |
| 276 | + ErrLikeInvalidInputs | |
| 277 | + ErrCastFailed | |
| 278 | + ErrInvalidCast | |
| 279 | + ErrEvaluatorInvalidTimestampFormatPattern | |
| 280 | + ErrEvaluatorInvalidTimestampFormatPatternSymbolForParsing | |
| 281 | + ErrEvaluatorTimestampFormatPatternDuplicateFields | |
| 282 | + ErrEvaluatorTimestampFormatPatternHourClockAmPmMismatch | |
| 283 | + ErrEvaluatorUnterminatedTimestampFormatPatternToken | |
| 284 | + ErrEvaluatorInvalidTimestampFormatPatternToken | |
| 285 | + ErrEvaluatorInvalidTimestampFormatPatternSymbol | |
| 286 | + ErrEvaluatorBindingDoesNotExist | |
| 287 | + ErrInvalidColumnIndex | |
| 288 | + ErrMissingHeaders | |
| 200 | 289 | ) |
| 201 | 290 | |
| 202 | 291 | // error code to APIError structure, these fields carry respective |
| @@ -803,6 +892,7 @@ var errorCodeResponse = map[APIErrorCode]APIError{ · 600 unmodified lines | ||
| 803 | 892 | Description: "X-Amz-Expires must be less than a week (in seconds); that is, the given X-Amz-Expires must be less than 604800 seconds", |
| 804 | 893 | HTTPStatusCode: http.StatusBadRequest, |
| 805 | 894 | }, |
| 895 | + | |
| 806 | 896 | // Generic Invalid-Request error. Should be used for response errors only for unlikely |
| 807 | 897 | // corner case errors for which introducing new APIErrorCode is not worth it. LogIf() |
| 808 | 898 | // should be used to log the error at the source of the error for debugging purposes. |
| @@ -851,6 +941,432 @@ var errorCodeResponse = map[APIErrorCode]APIError{ · 42 unmodified lines | ||
| 851 | 941 | Description: "The continuation token provided is incorrect", |
| 852 | 942 | HTTPStatusCode: http.StatusBadRequest, |
| 853 | 943 | }, |
| 944 | + //S3 Select API Errors | |
| 945 | + ErrEmptyRequestBody: { | |
| 946 | + Code: "EmptyRequestBody", | |
| 947 | + Description: "Request body cannot be empty.", | |
| 948 | + HTTPStatusCode: http.StatusBadRequest, | |
| 949 | + }, | |
| 950 | + ErrUnsupportedFunction: { | |
| 951 | + Code: "UnsupportedFunction", | |
| 952 | + Description: "Encountered an unsupported SQL function.", | |
| 953 | + HTTPStatusCode: http.StatusBadRequest, | |
| 954 | + }, | |
| 955 | + ErrInvalidDataSource: { | |
| 956 | + Code: "InvalidDataSource", | |
| 957 | + Description: "Invalid data source type. Only CSV and JSON are supported at this time.", | |
| 958 | + HTTPStatusCode: http.StatusBadRequest, | |
| 959 | + }, | |
| 960 | + ErrInvalidExpressionType: { | |
| 961 | + Code: "InvalidExpressionType", | |
| 962 | + Description: "The ExpressionType is invalid. Only SQL expressions are supported at this time.", | |
| 963 | + HTTPStatusCode: http.StatusBadRequest, | |
| 964 | + }, | |
| 965 | + ErrBusy: { | |
| 966 | + Code: "Busy", | |
| 967 | + Description: "The service is unavailable. Please retry.", | |
| 968 | + HTTPStatusCode: http.StatusServiceUnavailable, | |
| 969 | + }, | |
| 970 | + ErrUnauthorizedAccess: { | |
| 971 | + Code: "UnauthorizedAccess", | |
| 972 | + Description: "You are not authorized to perform this operation", | |
| 973 | + HTTPStatusCode: http.StatusUnauthorized, | |
| 974 | + }, | |
| 975 | + ErrExpressionTooLong: { | |
| 976 | + Code: "ExpressionTooLong", | |
| 977 | + Description: "The SQL expression is too long: The maximum byte-length for the SQL expression is 256 KB.", | |
| 978 | + HTTPStatusCode: http.StatusBadRequest, | |
| 979 | + }, | |
| 980 | + ErrIllegalSQLFunctionArgument: { | |
| 981 | + Code: "IllegalSqlFunctionArgument", | |
| 982 | + Description: "Illegal argument was used in the SQL function.", | |
| 983 | + HTTPStatusCode: http.StatusBadRequest, | |
| 984 | + }, | |
| 985 | + ErrInvalidKeyPath: { | |
| 986 | + Code: "InvalidKeyPath", | |
| 987 | + Description: "Key path in the SQL expression is invalid.", | |
| 988 | + HTTPStatusCode: http.StatusBadRequest, | |
| 989 | + }, | |
| 990 | + ErrInvalidCompressionFormat: { | |
| 991 | + Code: "InvalidCompressionFormat", | |
| 992 | + Description: "The file is not in a supported compression format. Only GZIP is supported at this time.", | |
| 993 | + HTTPStatusCode: http.StatusBadRequest, | |
| 994 | + }, | |
| 995 | + ErrInvalidFileHeaderInfo: { | |
| 996 | + Code: "InvalidFileHeaderInfo", | |
| 997 | + Description: "The FileHeaderInfo is invalid. Only NONE, USE, and IGNORE are supported.", | |
| 998 | + HTTPStatusCode: http.StatusBadRequest, | |
| 999 | + }, | |
| 1000 | + ErrInvalidJSONType: { | |
| 1001 | + Code: "InvalidJsonType", | |
| 1002 | + Description: "The JsonType is invalid. Only DOCUMENT and LINES are supported at this time.", | |
| 1003 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1004 | + }, | |
| 1005 | + ErrInvalidQuoteFields: { | |
| 1006 | + Code: "InvalidQuoteFields", | |
| 1007 | + Description: "The QuoteFields is invalid. Only ALWAYS and ASNEEDED are supported.", | |
| 1008 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1009 | + }, | |
| 1010 | + ErrInvalidRequestParameter: { | |
| 1011 | + Code: "InvalidRequestParameter", | |
| 1012 | + Description: "The value of a parameter in SelectRequest element is invalid. Check the service API documentation and try again.", | |
| 1013 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1014 | + }, | |
| 1015 | + ErrInvalidDataType: { | |
| 1016 | + Code: "InvalidDataType", | |
| 1017 | + Description: "The SQL expression contains an invalid data type.", | |
| 1018 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1019 | + }, | |
| 1020 | + ErrInvalidTextEncoding: { | |
| 1021 | + Code: "InvalidTextEncoding", | |
| 1022 | + Description: "Invalid encoding type. Only UTF-8 encoding is supported at this time.", | |
| 1023 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1024 | + }, | |
| 1025 | + ErrInvalidTableAlias: { | |
| 1026 | + Code: "InvalidTableAlias", | |
| 1027 | + Description: "The SQL expression contains an invalid table alias.", | |
| 1028 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1029 | + }, | |
| 1030 | + ErrMissingRequiredParameter: { | |
| 1031 | + Code: "MissingRequiredParameter", | |
| 1032 | + Description: "The SelectRequest entity is missing a required parameter. Check the service documentation and try again.", | |
| 1033 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1034 | + }, | |
| 1035 | + ErrObjectSerializationConflict: { | |
| 1036 | + Code: "ObjectSerializationConflict", | |
| 1037 | + Description: "The SelectRequest entity can only contain one of CSV or JSON. Check the service documentation and try again.", | |
| 1038 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1039 | + }, | |
| 1040 | + ErrUnsupportedSQLOperation: { | |
| 1041 | + Code: "UnsupportedSqlOperation", | |
| 1042 | + Description: "Encountered an unsupported SQL operation.", | |
| 1043 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1044 | + }, | |
| 1045 | + ErrUnsupportedSQLStructure: { | |
| 1046 | + Code: "UnsupportedSqlStructure", | |
| 1047 | + Description: "Encountered an unsupported SQL structure. Check the SQL Reference.", | |
| 1048 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1049 | + }, | |
| 1050 | + ErrUnsupportedSyntax: { | |
| 1051 | + Code: "UnsupportedSyntax", | |
| 1052 | + Description: "Encountered invalid syntax.", | |
| 1053 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1054 | + }, | |
| 1055 | + ErrUnsupportedRangeHeader: { | |
| 1056 | + Code: "UnsupportedRangeHeader", | |
| 1057 | + Description: "Range header is not supported for this operation.", | |
| 1058 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1059 | + }, | |
| 1060 | + ErrLexerInvalidChar: { | |
| 1061 | + Code: "LexerInvalidChar", | |
| 1062 | + Description: "The SQL expression contains an invalid character.", | |
| 1063 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1064 | + }, | |
| 1065 | + ErrLexerInvalidOperator: { | |
| 1066 | + Code: "LexerInvalidOperator", | |
| 1067 | + Description: "The SQL expression contains an invalid literal.", | |
| 1068 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1069 | + }, | |
| 1070 | + ErrLexerInvalidLiteral: { | |
| 1071 | + Code: "LexerInvalidLiteral", | |
| 1072 | + Description: "The SQL expression contains an invalid operator.", | |
| 1073 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1074 | + }, | |
| 1075 | + ErrLexerInvalidIONLiteral: { | |
| 1076 | + Code: "LexerInvalidIONLiteral", | |
| 1077 | + Description: "The SQL expression contains an invalid operator.", | |
| 1078 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1079 | + }, | |
| 1080 | + ErrParseExpectedDatePart: { | |
| 1081 | + Code: "ParseExpectedDatePart", | |
| 1082 | + Description: "Did not find the expected date part in the SQL expression.", | |
| 1083 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1084 | + }, | |
| 1085 | + ErrParseExpectedKeyword: { | |
| 1086 | + Code: "ParseExpectedKeyword", | |
| 1087 | + Description: "Did not find the expected keyword in the SQL expression.", | |
| 1088 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1089 | + }, | |
| 1090 | + ErrParseExpectedTokenType: { | |
| 1091 | + Code: "ParseExpectedTokenType", | |
| 1092 | + Description: "Did not find the expected token in the SQL expression.", | |
| 1093 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1094 | + }, | |
| 1095 | + ErrParseExpected2TokenTypes: { | |
| 1096 | + Code: "ParseExpected2TokenTypes", | |
| 1097 | + Description: "Did not find the expected token in the SQL expression.", | |
| 1098 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1099 | + }, | |
| 1100 | + ErrParseExpectedNumber: { | |
| 1101 | + Code: "ParseExpectedNumber", | |
| 1102 | + Description: "Did not find the expected number in the SQL expression.", | |
| 1103 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1104 | + }, | |
| 1105 | + ErrParseExpectedRightParenBuiltinFunctionCall: { | |
| 1106 | + Code: "ParseExpectedRightParenBuiltinFunctionCall", | |
| 1107 | + Description: "Did not find the expected right parenthesis character in the SQL expression.", | |
| 1108 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1109 | + }, | |
| 1110 | + ErrParseExpectedTypeName: { | |
| 1111 | + Code: "ParseExpectedTypeName", | |
| 1112 | + Description: "Did not find the expected type name in the SQL expression.", | |
| 1113 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1114 | + }, | |
| 1115 | + ErrParseExpectedWhenClause: { | |
| 1116 | + Code: "ParseExpectedWhenClause", | |
| 1117 | + Description: "Did not find the expected WHEN clause in the SQL expression. CASE is not supported.", | |
| 1118 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1119 | + }, | |
| 1120 | + ErrParseUnsupportedToken: { | |
| 1121 | + Code: "ParseUnsupportedToken", | |
| 1122 | + Description: "The SQL expression contains an unsupported token.", | |
| 1123 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1124 | + }, | |
| 1125 | + ErrParseUnsupportedLiteralsGroupBy: { | |
| 1126 | + Code: "ParseUnsupportedLiteralsGroupBy", | |
| 1127 | + Description: "The SQL expression contains an unsupported use of GROUP BY.", | |
| 1128 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1129 | + }, | |
| 1130 | + ErrParseExpectedMember: { | |
| 1131 | + Code: "ParseExpectedMember", | |
| 1132 | + Description: "The SQL expression contains an unsupported use of MEMBER.", | |
| 1133 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1134 | + }, | |
| 1135 | + ErrParseUnsupportedSelect: { | |
| 1136 | + Code: "ParseUnsupportedSelect", | |
| 1137 | + Description: "The SQL expression contains an unsupported use of SELECT.", | |
| 1138 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1139 | + }, | |
| 1140 | + ErrParseUnsupportedCase: { | |
| 1141 | + Code: "ParseUnsupportedCase", | |
| 1142 | + Description: "The SQL expression contains an unsupported use of CASE.", | |
| 1143 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1144 | + }, | |
| 1145 | + ErrParseUnsupportedCaseClause: { | |
| 1146 | + Code: "ParseUnsupportedCaseClause", | |
| 1147 | + Description: "The SQL expression contains an unsupported use of CASE.", | |
| 1148 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1149 | + }, | |
| 1150 | + ErrParseUnsupportedAlias: { | |
| 1151 | + Code: "ParseUnsupportedAlias", | |
| 1152 | + Description: "The SQL expression contains an unsupported use of ALIAS.", | |
| 1153 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1154 | + }, | |
| 1155 | + ErrParseUnsupportedSyntax: { | |
| 1156 | + Code: "ParseUnsupportedSyntax", | |
| 1157 | + Description: "The SQL expression contains unsupported syntax.", | |
| 1158 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1159 | + }, | |
| 1160 | + ErrParseUnknownOperator: { | |
| 1161 | + Code: "ParseUnknownOperator", | |
| 1162 | + Description: "The SQL expression contains an invalid operator.", | |
| 1163 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1164 | + }, | |
| 1165 | + ErrParseInvalidPathComponent: { | |
| 1166 | + Code: "ParseInvalidPathComponent", | |
| 1167 | + Description: "The SQL expression contains an invalid path component.", | |
| 1168 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1169 | + }, | |
| 1170 | + ErrParseMissingIdentAfterAt: { | |
| 1171 | + Code: "ParseMissingIdentAfterAt", | |
| 1172 | + Description: "Did not find the expected identifier after the @ symbol in the SQL expression.", | |
| 1173 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1174 | + }, | |
| 1175 | + ErrParseUnexpectedOperator: { | |
| 1176 | + Code: "ParseUnexpectedOperator", | |
| 1177 | + Description: "The SQL expression contains an unexpected operator.", | |
| 1178 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1179 | + }, | |
| 1180 | + ErrParseUnexpectedTerm: { | |
| 1181 | + Code: "ParseUnexpectedTerm", | |
| 1182 | + Description: "The SQL expression contains an unexpected term.", | |
| 1183 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1184 | + }, | |
| 1185 | + ErrParseUnexpectedToken: { | |
| 1186 | + Code: "ParseUnexpectedToken", | |
| 1187 | + Description: "The SQL expression contains an unexpected token.", | |
| 1188 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1189 | + }, | |
| 1190 | + ErrParseUnexpectedKeyword: { | |
| 1191 | + Code: "ParseUnexpectedKeyword", | |
| 1192 | + Description: "The SQL expression contains an unexpected keyword.", | |
| 1193 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1194 | + }, | |
| 1195 | + ErrParseExpectedExpression: { | |
| 1196 | + Code: "ParseExpectedExpression", | |
| 1197 | + Description: "Did not find the expected SQL expression.", | |
| 1198 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1199 | + }, | |
| 1200 | + ErrParseExpectedLeftParenAfterCast: { | |
| 1201 | + Code: "ParseExpectedLeftParenAfterCast", | |
| 1202 | + Description: "Did not find expected the left parenthesis in the SQL expression.", | |
| 1203 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1204 | + }, | |
| 1205 | + ErrParseExpectedLeftParenValueConstructor: { | |
| 1206 | + Code: "ParseExpectedLeftParenValueConstructor", | |
| 1207 | + Description: "Did not find expected the left parenthesis in the SQL expression.", | |
| 1208 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1209 | + }, | |
| 1210 | + ErrParseExpectedLeftParenBuiltinFunctionCall: { | |
| 1211 | + Code: "ParseExpectedLeftParenBuiltinFunctionCall", | |
| 1212 | + Description: "Did not find the expected left parenthesis in the SQL expression.", | |
| 1213 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1214 | + }, | |
| 1215 | + ErrParseExpectedArgumentDelimiter: { | |
| 1216 | + Code: "ParseExpectedArgumentDelimiter", | |
| 1217 | + Description: "Did not find the expected argument delimiter in the SQL expression.", | |
| 1218 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1219 | + }, | |
| 1220 | + ErrParseCastArity: { | |
| 1221 | + Code: "ParseCastArity", | |
| 1222 | + Description: "The SQL expression CAST has incorrect arity.", | |
| 1223 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1224 | + }, | |
| 1225 | + ErrParseInvalidTypeParam: { | |
| 1226 | + Code: "ParseInvalidTypeParam", | |
| 1227 | + Description: "The SQL expression contains an invalid parameter value.", | |
| 1228 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1229 | + }, | |
| 1230 | + ErrParseEmptySelect: { | |
| 1231 | + Code: "ParseEmptySelect", | |
| 1232 | + Description: "The SQL expression contains an empty SELECT.", | |
| 1233 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1234 | + }, | |
| 1235 | + ErrParseSelectMissingFrom: { | |
| 1236 | + Code: "ParseSelectMissingFrom", | |
| 1237 | + Description: "GROUP is not supported in the SQL expression.", | |
| 1238 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1239 | + }, | |
| 1240 | + ErrParseExpectedIdentForGroupName: { | |
| 1241 | + Code: "ParseExpectedIdentForGroupName", | |
| 1242 | + Description: "GROUP is not supported in the SQL expression.", | |
| 1243 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1244 | + }, | |
| 1245 | + ErrParseExpectedIdentForAlias: { | |
| 1246 | + Code: "ParseExpectedIdentForAlias", | |
| 1247 | + Description: "Did not find the expected identifier for the alias in the SQL expression.", | |
| 1248 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1249 | + }, | |
| 1250 | + ErrParseUnsupportedCallWithStar: { | |
| 1251 | + Code: "ParseUnsupportedCallWithStar", | |
| 1252 | + Description: "Only COUNT with (*) as a parameter is supported in the SQL expression.", | |
| 1253 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1254 | + }, | |
| 1255 | + ErrParseNonUnaryAgregateFunctionCall: { | |
| 1256 | + Code: "ParseNonUnaryAgregateFunctionCall", | |
| 1257 | + Description: "Only one argument is supported for aggregate functions in the SQL expression.", | |
| 1258 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1259 | + }, | |
| 1260 | + ErrParseMalformedJoin: { | |
| 1261 | + Code: "ParseMalformedJoin", | |
| 1262 | + Description: "JOIN is not supported in the SQL expression.", | |
| 1263 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1264 | + }, | |
| 1265 | + ErrParseExpectedIdentForAt: { | |
| 1266 | + Code: "ParseExpectedIdentForAt", | |
| 1267 | + Description: "Did not find the expected identifier for AT name in the SQL expression.", | |
| 1268 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1269 | + }, | |
| 1270 | + ErrParseAsteriskIsNotAloneInSelectList: { | |
| 1271 | + Code: "ParseAsteriskIsNotAloneInSelectList", | |
| 1272 | + Description: "Other expressions are not allowed in the SELECT list when '*' is used without dot notation in the SQL expression.", | |
| 1273 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1274 | + }, | |
| 1275 | + ErrParseCannotMixSqbAndWildcardInSelectList: { | |
| 1276 | + Code: "ParseCannotMixSqbAndWildcardInSelectList", | |
| 1277 | + Description: "Cannot mix [] and * in the same expression in a SELECT list in SQL expression.", | |
| 1278 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1279 | + }, | |
| 1280 | + ErrParseInvalidContextForWildcardInSelectList: { | |
| 1281 | + Code: "ParseInvalidContextForWildcardInSelectList", | |
| 1282 | + Description: "Invalid use of * in SELECT list in the SQL expression.", | |
| 1283 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1284 | + }, | |
| 1285 | + ErrIncorrectSQLFunctionArgumentType: { | |
| 1286 | + Code: "IncorrectSqlFunctionArgumentType", | |
| 1287 | + Description: "Incorrect type of arguments in function call in the SQL expression.", | |
| 1288 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1289 | + }, | |
| 1290 | + ErrValueParseFailure: { | |
| 1291 | + Code: "ValueParseFailure", | |
| 1292 | + Description: "Time stamp parse failure in the SQL expression.", | |
| 1293 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1294 | + }, | |
| 1295 | + ErrEvaluatorInvalidArguments: { | |
| 1296 | + Code: "EvaluatorInvalidArguments", | |
| 1297 | + Description: "Incorrect number of arguments in the function call in the SQL expression.", | |
| 1298 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1299 | + }, | |
| 1300 | + ErrIntegerOverflow: { | |
| 1301 | + Code: "IntegerOverflow", | |
| 1302 | + Description: "Int overflow or underflow in the SQL expression.", | |
| 1303 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1304 | + }, | |
| 1305 | + ErrLikeInvalidInputs: { | |
| 1306 | + Code: "LikeInvalidInputs", | |
| 1307 | + Description: "Invalid argument given to the LIKE clause in the SQL expression.", | |
| 1308 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1309 | + }, | |
| 1310 | + ErrCastFailed: { | |
| 1311 | + Code: "CastFailed", | |
| 1312 | + Description: "Attempt to convert from one data type to another using CAST failed in the SQL expression.", | |
| 1313 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1314 | + }, | |
| 1315 | + ErrInvalidCast: { | |
| 1316 | + Code: "InvalidCast", | |
| 1317 | + Description: "Attempt to convert from one data type to another using CAST failed in the SQL expression.", | |
| 1318 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1319 | + }, | |
| 1320 | + ErrEvaluatorInvalidTimestampFormatPattern: { | |
| 1321 | + Code: "EvaluatorInvalidTimestampFormatPattern", | |
| 1322 | + Description: "Time stamp format pattern requires additional fields in the SQL expression.", | |
| 1323 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1324 | + }, | |
| 1325 | + ErrEvaluatorInvalidTimestampFormatPatternSymbolForParsing: { | |
| 1326 | + Code: "EvaluatorInvalidTimestampFormatPatternSymbolForParsing", | |
| 1327 | + Description: "Time stamp format pattern contains a valid format symbol that cannot be applied to time stamp parsing in the SQL expression.", | |
| 1328 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1329 | + }, | |
| 1330 | + ErrEvaluatorTimestampFormatPatternDuplicateFields: { | |
| 1331 | + Code: "EvaluatorTimestampFormatPatternDuplicateFields", | |
| 1332 | + Description: "Time stamp format pattern contains multiple format specifiers representing the time stamp field in the SQL expression.", | |
| 1333 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1334 | + }, | |
| 1335 | + ErrEvaluatorTimestampFormatPatternHourClockAmPmMismatch: { | |
| 1336 | + Code: "EvaluatorUnterminatedTimestampFormatPatternToken", | |
| 1337 | + Description: "Time stamp format pattern contains unterminated token in the SQL expression.", | |
| 1338 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1339 | + }, | |
| 1340 | + ErrEvaluatorUnterminatedTimestampFormatPatternToken: { | |
| 1341 | + Code: "EvaluatorInvalidTimestampFormatPatternToken", | |
| 1342 | + Description: "Time stamp format pattern contains an invalid token in the SQL expression.", | |
| 1343 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1344 | + }, | |
| 1345 | + ErrEvaluatorInvalidTimestampFormatPatternToken: { | |
| 1346 | + Code: "EvaluatorInvalidTimestampFormatPatternToken", | |
| 1347 | + Description: "Time stamp format pattern contains an invalid token in the SQL expression.", | |
| 1348 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1349 | + }, | |
| 1350 | + ErrEvaluatorInvalidTimestampFormatPatternSymbol: { | |
| 1351 | + Code: "EvaluatorInvalidTimestampFormatPatternSymbol", | |
| 1352 | + Description: "Time stamp format pattern contains an invalid symbol in the SQL expression.", | |
| 1353 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1354 | + }, | |
| 1355 | + ErrInvalidColumnIndex: { | |
| 1356 | + Code: "InvalidColumnIndex", | |
| 1357 | + Description: "Column index in the SQL expression is invalid.", | |
| 1358 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1359 | + }, | |
| 1360 | + ErrEvaluatorBindingDoesNotExist: { | |
| 1361 | + Code: "ErrEvaluatorBindingDoesNotExist", | |
| 1362 | + Description: "A column name or a path provided does not exist in the SQL expression", | |
| 1363 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1364 | + }, | |
| 1365 | + ErrMissingHeaders: { | |
| 1366 | + Code: "MissingHeaders", | |
| 1367 | + Description: "Some headers in the query are missing from the file. Check the file and try again.", | |
| 1368 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1369 | + }, | |
| 854 | 1370 | // Add your error structure here. |
| 855 | 1371 | } |
| 856 | 1372 | |
| @@ -900,6 +1416,169 @@ func toAPIErrorCode(err error) (apiErr APIErrorCode) { · 43 unmodified lines | ||
| 900 | 1416 | case context.Canceled, context.DeadlineExceeded: |
| 901 | 1417 | apiErr = ErrOperationTimedOut |
| 902 | 1418 | } |
| 1419 | + switch err { | |
| 1420 | + case s3select.ErrBusy: | |
| 1421 | + apiErr = ErrBusy | |
| 1422 | + case s3select.ErrUnauthorizedAccess: | |
| 1423 | + apiErr = ErrUnauthorizedAccess | |
| 1424 | + case s3select.ErrExpressionTooLong: | |
| 1425 | + apiErr = ErrExpressionTooLong | |
| 1426 | + case s3select.ErrIllegalSQLFunctionArgument: | |
| 1427 | + apiErr = ErrIllegalSQLFunctionArgument | |
| 1428 | + case s3select.ErrInvalidKeyPath: | |
| 1429 | + apiErr = ErrInvalidKeyPath | |
| 1430 | + case s3select.ErrInvalidCompressionFormat: | |
| 1431 | + apiErr = ErrInvalidCompressionFormat | |
| 1432 | + case s3select.ErrInvalidFileHeaderInfo: | |
| 1433 | + apiErr = ErrInvalidFileHeaderInfo | |
| 1434 | + case s3select.ErrInvalidJSONType: | |
| 1435 | + apiErr = ErrInvalidJSONType | |
| 1436 | + case s3select.ErrInvalidQuoteFields: | |
| 1437 | + apiErr = ErrInvalidQuoteFields | |
| 1438 | + case s3select.ErrInvalidRequestParameter: | |
| 1439 | + apiErr = ErrInvalidRequestParameter | |
| 1440 | + case s3select.ErrInvalidDataType: | |
| 1441 | + apiErr = ErrInvalidDataType | |
| 1442 | + case s3select.ErrInvalidTextEncoding: | |
| 1443 | + apiErr = ErrInvalidTextEncoding | |
| 1444 | + case s3select.ErrInvalidTableAlias: | |
| 1445 | + apiErr = ErrInvalidTableAlias | |
| 1446 | + case s3select.ErrMissingRequiredParameter: | |
| 1447 | + apiErr = ErrMissingRequiredParameter | |
| 1448 | + case s3select.ErrObjectSerializationConflict: | |
| 1449 | + apiErr = ErrObjectSerializationConflict | |
| 1450 | + case s3select.ErrUnsupportedSQLOperation: | |
| 1451 | + apiErr = ErrUnsupportedSQLOperation | |
| 1452 | + case s3select.ErrUnsupportedSQLStructure: | |
| 1453 | + apiErr = ErrUnsupportedSQLStructure | |
| 1454 | + case s3select.ErrUnsupportedSyntax: | |
| 1455 | + apiErr = ErrUnsupportedSyntax | |
| 1456 | + case s3select.ErrUnsupportedRangeHeader: | |
| 1457 | + apiErr = ErrUnsupportedRangeHeader | |
| 1458 | + case s3select.ErrLexerInvalidChar: | |
| 1459 | + apiErr = ErrLexerInvalidChar | |
| 1460 | + case s3select.ErrLexerInvalidOperator: | |
| 1461 | + apiErr = ErrLexerInvalidOperator | |
| 1462 | + case s3select.ErrLexerInvalidLiteral: | |
| 1463 | + apiErr = ErrLexerInvalidLiteral | |
| 1464 | + case s3select.ErrLexerInvalidIONLiteral: | |
| 1465 | + apiErr = ErrLexerInvalidIONLiteral | |
| 1466 | + case s3select.ErrParseExpectedDatePart: | |
| 1467 | + apiErr = ErrParseExpectedDatePart | |
| 1468 | + case s3select.ErrParseExpectedKeyword: | |
| 1469 | + apiErr = ErrParseExpectedKeyword | |
| 1470 | + case s3select.ErrParseExpectedTokenType: | |
| 1471 | + apiErr = ErrParseExpectedTokenType | |
| 1472 | + case s3select.ErrParseExpected2TokenTypes: | |
| 1473 | + apiErr = ErrParseExpected2TokenTypes | |
| 1474 | + case s3select.ErrParseExpectedNumber: | |
| 1475 | + apiErr = ErrParseExpectedNumber | |
| 1476 | + case s3select.ErrParseExpectedRightParenBuiltinFunctionCall: | |
| 1477 | + apiErr = ErrParseExpectedRightParenBuiltinFunctionCall | |
| 1478 | + case s3select.ErrParseExpectedTypeName: | |
| 1479 | + apiErr = ErrParseExpectedTypeName | |
| 1480 | + case s3select.ErrParseExpectedWhenClause: | |
| 1481 | + apiErr = ErrParseExpectedWhenClause | |
| 1482 | + case s3select.ErrParseUnsupportedToken: | |
| 1483 | + apiErr = ErrParseUnsupportedToken | |
| 1484 | + case s3select.ErrParseUnsupportedLiteralsGroupBy: | |
| 1485 | + apiErr = ErrParseUnsupportedLiteralsGroupBy | |
| 1486 | + case s3select.ErrParseExpectedMember: | |
| 1487 | + apiErr = ErrParseExpectedMember | |
| 1488 | + case s3select.ErrParseUnsupportedSelect: | |
| 1489 | + apiErr = ErrParseUnsupportedSelect | |
| 1490 | + case s3select.ErrParseUnsupportedCase: | |
| 1491 | + apiErr = ErrParseUnsupportedCase | |
| 1492 | + case s3select.ErrParseUnsupportedCaseClause: | |
| 1493 | + apiErr = ErrParseUnsupportedCaseClause | |
| 1494 | + case s3select.ErrParseUnsupportedAlias: | |
| 1495 | + apiErr = ErrParseUnsupportedAlias | |
| 1496 | + case s3select.ErrParseUnsupportedSyntax: | |
| 1497 | + apiErr = ErrParseUnsupportedSyntax | |
| 1498 | + case s3select.ErrParseUnknownOperator: | |
| 1499 | + apiErr = ErrParseUnknownOperator | |
| 1500 | + case s3select.ErrParseInvalidPathComponent: | |
| 1501 | + apiErr = ErrParseInvalidPathComponent | |
| 1502 | + case s3select.ErrParseMissingIdentAfterAt: | |
| 1503 | + apiErr = ErrParseMissingIdentAfterAt | |
| 1504 | + case s3select.ErrParseUnexpectedOperator: | |
| 1505 | + apiErr = ErrParseUnexpectedOperator | |
| 1506 | + case s3select.ErrParseUnexpectedTerm: | |
| 1507 | + apiErr = ErrParseUnexpectedTerm | |
| 1508 | + case s3select.ErrParseUnexpectedToken: | |
| 1509 | + apiErr = ErrParseUnexpectedToken | |
| 1510 | + case s3select.ErrParseUnexpectedKeyword: | |
| 1511 | + apiErr = ErrParseUnexpectedKeyword | |
| 1512 | + case s3select.ErrParseExpectedExpression: | |
| 1513 | + apiErr = ErrParseExpectedExpression | |
| 1514 | + case s3select.ErrParseExpectedLeftParenAfterCast: | |
| 1515 | + apiErr = ErrParseExpectedLeftParenAfterCast | |
| 1516 | + case s3select.ErrParseExpectedLeftParenValueConstructor: | |
| 1517 | + apiErr = ErrParseExpectedLeftParenValueConstructor | |
| 1518 | + case s3select.ErrParseExpectedLeftParenBuiltinFunctionCall: | |
| 1519 | + apiErr = ErrParseExpectedLeftParenBuiltinFunctionCall | |
| 1520 | + case s3select.ErrParseExpectedArgumentDelimiter: | |
| 1521 | + apiErr = ErrParseExpectedArgumentDelimiter | |
| 1522 | + case s3select.ErrParseCastArity: | |
| 1523 | + apiErr = ErrParseCastArity | |
| 1524 | + case s3select.ErrParseInvalidTypeParam: | |
| 1525 | + apiErr = ErrParseInvalidTypeParam | |
| 1526 | + case s3select.ErrParseEmptySelect: | |
| 1527 | + apiErr = ErrParseEmptySelect | |
| 1528 | + case s3select.ErrParseSelectMissingFrom: | |
| 1529 | + apiErr = ErrParseSelectMissingFrom | |
| 1530 | + case s3select.ErrParseExpectedIdentForGroupName: | |
| 1531 | + apiErr = ErrParseExpectedIdentForGroupName | |
| 1532 | + case s3select.ErrParseExpectedIdentForAlias: | |
| 1533 | + apiErr = ErrParseExpectedIdentForAlias | |
| 1534 | + case s3select.ErrParseUnsupportedCallWithStar: | |
| 1535 | + apiErr = ErrParseUnsupportedCallWithStar | |
| 1536 | + case s3select.ErrParseNonUnaryAgregateFunctionCall: | |
| 1537 | + apiErr = ErrParseNonUnaryAgregateFunctionCall | |
| 1538 | + case s3select.ErrParseMalformedJoin: | |
| 1539 | + apiErr = ErrParseMalformedJoin | |
| 1540 | + case s3select.ErrParseExpectedIdentForAt: | |
| 1541 | + apiErr = ErrParseExpectedIdentForAt | |
| 1542 | + case s3select.ErrParseAsteriskIsNotAloneInSelectList: | |
| 1543 | + apiErr = ErrParseAsteriskIsNotAloneInSelectList | |
| 1544 | + case s3select.ErrParseCannotMixSqbAndWildcardInSelectList: | |
| 1545 | + apiErr = ErrParseCannotMixSqbAndWildcardInSelectList | |
| 1546 | + case s3select.ErrParseInvalidContextForWildcardInSelectList: | |
| 1547 | + apiErr = ErrParseInvalidContextForWildcardInSelectList | |
| 1548 | + case s3select.ErrIncorrectSQLFunctionArgumentType: | |
| 1549 | + apiErr = ErrIncorrectSQLFunctionArgumentType | |
| 1550 | + case s3select.ErrValueParseFailure: | |
| 1551 | + apiErr = ErrValueParseFailure | |
| 1552 | + case s3select.ErrIntegerOverflow: | |
| 1553 | + apiErr = ErrIntegerOverflow | |
| 1554 | + case s3select.ErrLikeInvalidInputs: | |
| 1555 | + apiErr = ErrLikeInvalidInputs | |
| 1556 | + case s3select.ErrCastFailed: | |
| 1557 | + apiErr = ErrCastFailed | |
| 1558 | + case s3select.ErrInvalidCast: | |
| 1559 | + apiErr = ErrInvalidCast | |
| 1560 | + case s3select.ErrEvaluatorInvalidTimestampFormatPattern: | |
| 1561 | + apiErr = ErrEvaluatorInvalidTimestampFormatPattern | |
| 1562 | + case s3select.ErrEvaluatorInvalidTimestampFormatPatternSymbolForParsing: | |
| 1563 | + apiErr = ErrEvaluatorInvalidTimestampFormatPatternSymbolForParsing | |
| 1564 | + case s3select.ErrEvaluatorTimestampFormatPatternDuplicateFields: | |
| 1565 | + apiErr = ErrEvaluatorTimestampFormatPatternDuplicateFields | |
| 1566 | + case s3select.ErrEvaluatorTimestampFormatPatternHourClockAmPmMismatch: | |
| 1567 | + apiErr = ErrEvaluatorTimestampFormatPatternHourClockAmPmMismatch | |
| 1568 | + case s3select.ErrEvaluatorUnterminatedTimestampFormatPatternToken: | |
| 1569 | + apiErr = ErrEvaluatorUnterminatedTimestampFormatPatternToken | |
| 1570 | + case s3select.ErrEvaluatorInvalidTimestampFormatPatternToken: | |
| 1571 | + apiErr = ErrEvaluatorInvalidTimestampFormatPatternToken | |
| 1572 | + case s3select.ErrEvaluatorInvalidTimestampFormatPatternSymbol: | |
| 1573 | + apiErr = ErrEvaluatorInvalidTimestampFormatPatternSymbol | |
| 1574 | + case s3select.ErrInvalidColumnIndex: | |
| 1575 | + apiErr = ErrInvalidColumnIndex | |
| 1576 | + case s3select.ErrEvaluatorBindingDoesNotExist: | |
| 1577 | + apiErr = ErrEvaluatorBindingDoesNotExist | |
| 1578 | + case s3select.ErrMissingHeaders: | |
| 1579 | + apiErr = ErrMissingHeaders | |
| 1580 | + | |
| 1581 | + } | |
| 903 | 1582 | |
| 904 | 1583 | if apiErr != ErrNone { |
| 905 | 1584 | // If there was a match in the above switch case. |