Source:
<code>protected Node visitShowPartitions(ShowPartitions showPartitions, Void context) { QualifiedObjectName table = createQualifiedObjectName(session, showPartitions, showPartitions.getTable()); TableHandle tableHandle = metadata.getTableHandle(session, table) <START> .orElseThrow(() -> new SemanticException(MISSING_TABLE, showPartitions, "Table '%s' does not exist", table)); <END> Optional<TableLayout> layout = getLayout(showPartitions, showPartitions.getTable(), showPartitions.getWhere()); List<Expression> rows = getPartitionsAsValuesRows(showPartitions, table, layout); Map<ColumnHandle, String> columnHandleNames = ImmutableBiMap.copyOf(metadata.getColumnHandles(session, tableHandle)).inverse(); List<String> partitioningColumns = getPartitioningColumns(showPartitions, table, tableHandle, layout, columnHandleNames); Optional<Expression> where; if (rows.isEmpty()) { List<Expression> row = partitioningColumns.stream() .map(partitioningColumn -> new NullLiteral()) .collect(toImmutableList()); rows = ImmutableList.of(new Row(row)); where = Optional.of(FALSE_LITERAL); } else { where = showPartitions.getWhere(); } return simpleQuery( selectList(partitioningColumns.stream().map(QueryUtil::identifier).collect(toImmutableList())), aliased(new Values(rows), "x", partitioningColumns), where, Optional.empty(), Optional.empty(), orderBy(showPartitions.getOrderBy()), showPartitions.getLimit()); }</code><technical_language>sight, this commit changes TableLayout layout = getLayout(showPartitions, showPartitions.getTable(), showPartitions.getWhere()) .orElseThrow(() -> new SemanticException(NOT_SUPPORTED, showPartitions, "Could find layout for table: %s", table)); TableLayout layout = getLayout(showPartitions, showPartitions.getTable(), showPartitions.getWhere()) .orElseGet( get layout clause ) Is understanding correct</technical_language>

Target:
protected Node visitShowPartitions(ShowPartitions showPartitions, Void context) { QualifiedObjectName table = createQualifiedObjectName(session, showPartitions, showPartitions.getTable()); TableHandle tableHandle = metadata.getTableHandle(session, table) .orElseThrow(() -> new SemanticException(MISSING_TABLE, showPartitions, "Table '%s' does not exist", table)); TableLayout layout = getLayoutFromFilterScanQuery(showPartitions, showPartitions.getTable(), showPartitions.getWhere()) .orElseGet(() -> getLayoutWithoutPartitionsFromMetadata(showPartitions, showPartitions.getTable(), tableHandle)); List<Expression> rows = getPartitionsAsValuesRows(showPartitions, table, layout); List<String> partitioningColumns = getPartitioningColumns(showPartitions, table, tableHandle, layout); Optional<Expression> where; if (rows.isEmpty()) { List<Expression> row = partitioningColumns.stream() .map(partitioningColumn -> new NullLiteral()) .collect(toImmutableList()); rows = ImmutableList.of(new Row(row)); where = Optional.of(FALSE_LITERAL); } else { where = showPartitions.getWhere(); } return simpleQuery( selectList(partitioningColumns.stream().map(QueryUtil::identifier).collect(toImmutableList())), aliased(new Values(rows), "x", partitioningColumns), where, Optional.empty(), Optional.empty(), orderBy(showPartitions.getOrderBy()), showPartitions.getLimit()); }