We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StatementAnalyzer visitUnnest as below, I think need invoke analysis.addSourceColumns in this method to record column lineage.
@Override protected Scope visitUnnest(Unnest node, Optional<Scope> scope) { ImmutableMap.Builder<NodeRef<Expression>, List<Field>> mappings = ImmutableMap.builder(); ImmutableList.Builder<Field> outputFields = ImmutableList.builder(); for (Expression expression : node.getExpressions()) { List<Field> expressionOutputs = new ArrayList<>(); ExpressionAnalysis expressionAnalysis = analyzeExpression(expression, createScope(scope)); Type expressionType = expressionAnalysis.getType(expression); if (expressionType instanceof ArrayType) { Type elementType = ((ArrayType) expressionType).getElementType(); if (elementType instanceof RowType) { ((RowType) elementType).getFields().stream() .map(field -> Field.newUnqualified(field.getName(), field.getType())) .forEach(expressionOutputs::add); } else { expressionOutputs.add(Field.newUnqualified(Optional.empty(), elementType)); } } else if (expressionType instanceof MapType) { expressionOutputs.add(Field.newUnqualified(Optional.empty(), ((MapType) expressionType).getKeyType())); expressionOutputs.add(Field.newUnqualified(Optional.empty(), ((MapType) expressionType).getValueType())); } else { throw new TrinoException(INVALID_FUNCTION_ARGUMENT, "Cannot unnest type: " + expressionType); } outputFields.addAll(expressionOutputs); mappings.put(NodeRef.of(expression), expressionOutputs); } Optional<Field> ordinalityField = Optional.empty(); if (node.isWithOrdinality()) { ordinalityField = Optional.of(Field.newUnqualified(Optional.empty(), BIGINT)); } ordinalityField.ifPresent(outputFields::add); analysis.setUnnest(node, new UnnestAnalysis(mappings.buildOrThrow(), ordinalityField)); return createAndAssignScope(node, scope, outputFields.build()); }
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
StatementAnalyzer visitUnnest as below, I think need invoke analysis.addSourceColumns in this method to record column lineage.
The text was updated successfully, but these errors were encountered: