Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions docs/reference/sql/barrier.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

title: barrier
description: >
Creates an optimization barrier that prevents filter pushdown by evaluating
boolean expressions at runtime.
kernels:
- returns: boolean
args:
- name: expression
type: string
- name: col_name
type: string
- name: col_value
type: any
---

## Description

`barrier()` evaluates a boolean expression string at runtime using bound column
values, and is marked as volatile to prevent the query optimizer from reordering
or pushing filters past it.

The first argument is a boolean expression string. After that, arguments come in
pairs of `(column_name, column_value)` that bind variables used in the
expression.

### Supported expression syntax

- **Comparison operators**: `=`, `==`, `!=`, `<>`, `>`, `>=`, `<`, `<=`
- **Logical operators**: `AND` / `and`, `OR` / `or`
- **Literal types**: integers, floats, single- or double-quoted strings, `true`, `false`, `null`
- Unrecognized expressions evaluate to `false`
- `NULL` comparisons evaluate to `false`

### When to use

Use `barrier()` when you need a predicate to be evaluated **after** a join or
scan rather than being pushed down by the optimizer. This is useful when the
predicate depends on values that are only available at a specific stage of
query execution.

## Examples

Filter rows using bound column values:

```sql
SELECT *
FROM (VALUES (150, 'active'), (50, 'active'), (200, 'closed')) AS orders(amount, status)
WHERE barrier('amount > 100 AND status = "active"',
'amount', amount,
'status', status);
```

Combine multiple conditions with different data types:

```sql
SELECT *
FROM (VALUES (29.99, 'electronics'), (9.99, 'books'), (49.99, 'electronics')) AS products(price, category)
WHERE barrier('price > 19.99 AND category = "electronics"',
'price', price,
'category', category);
```

Use `OR` logic:

```sql
SELECT *
FROM (VALUES (3, 'info'), (7, 'critical'), (10, 'warning')) AS events(priority, type)
WHERE barrier('priority < 5 OR type = "critical"',
'priority', priority,
'type', type);
```
30 changes: 30 additions & 0 deletions docs/reference/sql/rs_convexhull.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

title: RS_ConvexHull
description: Return the convex hull geometry of a raster.
kernels:
- returns: geometry
args: [raster]
---

## Examples

```sql
SELECT RS_ConvexHull(RS_Example());
```
30 changes: 30 additions & 0 deletions docs/reference/sql/rs_crs.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

title: RS_CRS
description: Return the CRS string for a raster.
kernels:
- returns: string
args: [raster]
---

## Examples

```sql
SELECT RS_CRS(RS_Example());
```
30 changes: 30 additions & 0 deletions docs/reference/sql/rs_envelope.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

title: RS_Envelope
description: Return the envelope (bounding box) of a raster as a geometry.
kernels:
- returns: geometry
args: [raster]
---

## Examples

```sql
SELECT RS_Envelope(RS_Example());
```
24 changes: 24 additions & 0 deletions docs/reference/sql/rs_example.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

title: RS_Example
description: Create a simple example raster for testing and demos.
kernels:
- returns: raster
args: []
---
30 changes: 30 additions & 0 deletions docs/reference/sql/rs_height.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

title: RS_Height
description: Return the height of a raster in pixels.
kernels:
- returns: bigint
args: [raster]
---

## Examples

```sql
SELECT RS_Height(RS_Example());
```
35 changes: 35 additions & 0 deletions docs/reference/sql/rs_rastertoworldcoord.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

title: RS_RasterToWorldCoord
description: Convert raster pixel coordinates to world coordinates as a point.
kernels:
- returns: geometry
args:
- raster
- name: x
type: integer
- name: y
type: integer
---

## Examples

```sql
SELECT RS_RasterToWorldCoord(RS_Example(), 10, 20);
```
35 changes: 35 additions & 0 deletions docs/reference/sql/rs_rastertoworldcoordx.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

title: RS_RasterToWorldCoordX
description: Convert raster pixel coordinates to world X coordinate.
kernels:
- returns: double
args:
- raster
- name: x
type: integer
- name: y
type: integer
---

## Examples

```sql
SELECT RS_RasterToWorldCoordX(RS_Example(), 10, 20);
```
35 changes: 35 additions & 0 deletions docs/reference/sql/rs_rastertoworldcoordy.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

title: RS_RasterToWorldCoordY
description: Convert raster pixel coordinates to world Y coordinate.
kernels:
- returns: double
args:
- raster
- name: x
type: integer
- name: y
type: integer
---

## Examples

```sql
SELECT RS_RasterToWorldCoordY(RS_Example(), 10, 20);
```
30 changes: 30 additions & 0 deletions docs/reference/sql/rs_rotation.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

title: RS_Rotation
description: Return the raster rotation in radians based on skew parameters.
kernels:
- returns: double
args: [raster]
---

## Examples

```sql
SELECT RS_Rotation(RS_Example());
```
Loading