| 293 | } |
| 294 | |
| 295 | void checkObjectHasNoAmbiguousPaths(const PathsInData & paths) |
| 296 | { |
| 297 | size_t size = paths.size(); |
| 298 | for (size_t i = 0; i < size; ++i) |
| 299 | { |
| 300 | for (size_t j = 0; j < i; ++j) |
| 301 | { |
| 302 | if (isPrefix(paths[i].getParts(), paths[j].getParts()) |
| 303 | || isPrefix(paths[j].getParts(), paths[i].getParts())) |
| 304 | throw Exception(ErrorCodes::INCOMPATIBLE_COLUMNS, |
| 305 | "Data in Object has ambiguous paths: '{}' and '{}'", |
| 306 | paths[i].getPath(), paths[j].getPath()); |
| 307 | |
| 308 | if (hasDifferentStructureInPrefix(paths[i].getParts(), paths[j].getParts())) |
| 309 | throw Exception(ErrorCodes::INCOMPATIBLE_COLUMNS, |
| 310 | "Data in Object has ambiguous paths: '{}' and '{}'. " |
| 311 | "Paths have prefixes matched by names, but different in structure", |
| 312 | paths[i].getPath(), paths[j].getPath()); |
| 313 | } |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | static DataTypePtr getLeastCommonTypeForObject(const DataTypes & types, bool check_ambiguous_paths) |
| 318 | { |