public class ColumnsArrayParser extends Object implements ScanLevelProjection.ScanProjectionParser
select * from dfs.`multilevel/csv`
where columns[1] < 1000
To handle these cases, the general rule is: allow any number of wildcard or `columns` appearances in the input projection, but collapse them all down to a single occurrence of `columns` in the output projection. (Upstream code will prevent `columns` from appearing twice in its non-indexed form.)
It falls to this parser to detect a not-uncommon user error, a query such as the following:
SELECT max(columns[1]) AS col1
FROM cp.`textinput/input1.csv`
WHERE col1 IS NOT NULL
In standard SQL, column aliases are not allowed in the WHERE
clause. So, Drill will push two columns down to the scan operator:
`columns`[1] and `col1`. This parser will detect the "extra"
columns and must provide a message that helps the user identify
the likely original problem.Constructor and Description |
---|
ColumnsArrayParser(boolean requireColumnsArray) |
ColumnsArrayParser(boolean requireColumnsArray,
boolean allowOtherCols) |
Modifier and Type | Method and Description |
---|---|
void |
bind(ScanLevelProjection builder) |
void |
build() |
UnresolvedColumnsArrayColumn |
columnsArrayCol() |
boolean |
parse(RequestedColumn inCol) |
void |
validate() |
void |
validateColumn(ColumnProjection col) |
public ColumnsArrayParser(boolean requireColumnsArray, boolean allowOtherCols)
public ColumnsArrayParser(boolean requireColumnsArray)
public void bind(ScanLevelProjection builder)
bind
in interface ScanLevelProjection.ScanProjectionParser
public boolean parse(RequestedColumn inCol)
parse
in interface ScanLevelProjection.ScanProjectionParser
public void validate()
validate
in interface ScanLevelProjection.ScanProjectionParser
public void validateColumn(ColumnProjection col)
validateColumn
in interface ScanLevelProjection.ScanProjectionParser
public void build()
build
in interface ScanLevelProjection.ScanProjectionParser
public UnresolvedColumnsArrayColumn columnsArrayCol()
Copyright © 2021 The Apache Software Foundation. All rights reserved.