1. Change all required fields to optional
Although they all "required", but it not recommended to use `required`, because it is hard to modify in future.
2. Fix a missing field bug
* [bugfix](schema change) when there is a string column with delete predicate, the schema change may core
Co-authored-by: yiguolei <yiguolei@gmail.com>
1. rename PhysicalHeapSort to PhysicalQuickSort
2. add LogicalTopN and PhysicalTopN
3. add implementation rule for LogicalTopN
4. add a interface Sort for both logical and physical sort
5. add a interface TopN for both logical and physical top-n
6. add a AbstractPhysicalSort as super class of PhysicalQuickSort and PhysicalTopN
When we do write current plan with its child. Currently, nereids memo do nothing indeed.
This PR fix this situation by add a predicate in rewrite that only replaced target group and set newGroupExpressionGenerated to false when target is null or target is same with existed group expression's group.
here we need to handle one situation that original target is not the same with
existedGroupExpression.getOwnerGroup(). In this case, if we change target to
existedGroupExpression.getOwnerGroup(), we could not rewrite plan as we expected and the plan
will not be changed anymore.
Think below example:
We have a plan like this:
```
Original (Group 2 is root):
Group2: Project(outside)
Group1: |---Project(inside)
Group0: |---UnboundRelation
and we want to rewrite group 2 by Project(inside, GroupPlan(group 0))
After rewriting we should get (Group 2 is root):
Group2: Project(inside)
Group0: |---UnboundRelation
Group1: Project(inside)
```
After rewriting, Group 1's GroupExpression is not in GroupExpressionsMap anymore and Group 1 is unreachable.
Merge Group 1 into Group 2 is better, but in consideration of there is others way to let a Group take into
unreachable. There's no need to complicate to add a merge step. Instead, we need to have a clear step to
remove unreachable groups and GroupExpressions after rewrite.
1. add StatementContext, and PlannerContext is renamed to CascadsContext. CascadsContext belong to a StatementContext, and StatementContext belong to a ConnectionContext, and the lifecycle increases in turn. StatementContext can wrap some statement's lifecycle-related state, such as ExpressionId, TableLock. MemoTestUtil can simplify create a CascadesContext and Memo for test.
2. add PlanPreprocessor to process parsed logical plan before copy into memo. and add a PlanPostprocessor to process physical plan after copy out from memo.
3. utilize PlanPreprocessor to process SET_VAR hint, the class is EliminateLogicalSelectHint
4. pass the limit clause in regression test case, in set_var.groovy
We should close eof scanners before transfer done, otherwise,
they are closed until scannode is closed. Because plan is closed
after the plan is finished, so query profile would leak stats from
scanners closed by scannode::close. e.g. SegmentTotalNum in profile
is less.
# Proposed changes
Read and decode parquet physical type.
1. The encoding type of boolean is bit-packing, this PR introduces the implementation of bit-packing from Impala
2. Create a parquet including all the primitive types supported by hive
## Remaining Problems
1. At present, only physical types are decoded, and there is no corresponding and conversion methods with doris logical.
2. No parsing and processing Decimal type / Timestamp / Date.
3. Int_8 / Int_16 is stored as Int_32. How to resolve these types.