| 26 | namespace gandiva { |
| 27 | |
| 28 | std::vector<std::string> DateUtils::GetMatches(std::string pattern, bool exactMatch) { |
| 29 | // we are case-insensitive |
| 30 | std::transform(pattern.begin(), pattern.end(), pattern.begin(), ::tolower); |
| 31 | std::vector<std::string> matches; |
| 32 | |
| 33 | for (const auto& it : sql_date_format_to_boost_map_) { |
| 34 | if (it.first.find(pattern) != std::string::npos && |
| 35 | (!exactMatch || (it.first.length() == pattern.length()))) { |
| 36 | matches.push_back(it.first); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | return matches; |
| 41 | } |
| 42 | |
| 43 | std::vector<std::string> DateUtils::GetPotentialMatches(const std::string& pattern) { |
| 44 | return GetMatches(pattern, false); |