Skip to content

Commit

Permalink
Merge branch 'prestodb:master' into jackson-core-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariamalmesfer authored Oct 6, 2024
2 parents 6023bad + 832b071 commit d7017e6
Show file tree
Hide file tree
Showing 127 changed files with 3,957 additions and 2,948 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ jobs:
- name: Maven Checks
run: |
export MAVEN_OPTS="${MAVEN_INSTALL_OPTS}"
./mvnw install -B -V -T 1C -DskipTests -Dmaven.javadoc.skip=true --no-transfer-progress -P ci -pl '!presto-test-coverage,!:presto-server,!:presto-docs'
./mvnw install -B -V -T 1C -DskipTests -Dmaven.javadoc.skip=true --no-transfer-progress -P ci -pl '!presto-test-coverage,!:presto-docs'
- name: Clean Maven Output
run: ./mvnw clean -pl '!:presto-server,!:presto-cli,!presto-test-coverage'
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ To commit code, you should:
1. User friendliness
1. Config options have names and descriptions that can be understood by someone configuring Presto
1. All new language features, new functions, and major features have documentation added
1. When adding a new method to [Plugin.java](https://github.com/prestodb/presto/blob/master/presto-spi/src/main/java/com/facebook/presto/spi/Plugin.java), include documentation for the new method in the [Presto Developer Guide](https://prestodb.io/docs/current/develop.html).
1. Release notes following the [Release Note Guidelines](https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines) are added for user visible changes
* For large features, discuss your design with relevant code owners before you start implementing it.

Expand Down
34 changes: 32 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.6.0</version>
<version>42.6.1</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -2407,7 +2407,8 @@
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${dep.nexus-staging-plugin.version}</version>
<extensions>true</extensions>
<!-- This plugin is not registered as an extension because it will fail to activate
concurrently with the Maven Provisio plugin, as that has its own deployment lifecycle -->
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
Expand Down Expand Up @@ -2436,6 +2437,13 @@
<artifactId>presto-maven-plugin</artifactId>
</plugin>

<plugin>
<groupId>ca.vanzyl.provisio.maven.plugins</groupId>
<artifactId>provisio-maven-plugin</artifactId>
<version>1.0.18</version>
<extensions>true</extensions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down Expand Up @@ -2615,9 +2623,31 @@
<id>deploy-to-ossrh</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<!-- This plugin must be configured manually ("Maven 2" style in the docs) due to the usage of the
Maven Provisio plugin, which includes its own deployment lifecycle -->
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import static com.facebook.presto.plugin.bigquery.BigQueryErrorCode.BIGQUERY_FAILED_TO_EXECUTE_QUERY;
import static com.google.cloud.bigquery.storage.v1beta1.Storage.ReadSession;
import static com.google.common.collect.ImmutableList.toImmutableList;
import static java.lang.String.format;
import static java.util.Objects.requireNonNull;
import static java.util.stream.Collectors.toList;
import static java.util.stream.IntStream.range;
Expand Down Expand Up @@ -131,7 +130,7 @@ private List<BigQuerySplit> createEmptyProjection(TableId tableId, int actualPar
return splits;
}
catch (BigQueryException e) {
throw new PrestoException(BIGQUERY_FAILED_TO_EXECUTE_QUERY, format("Failed to compute empty projection"), e);
throw new PrestoException(BIGQUERY_FAILED_TO_EXECUTE_QUERY, "Failed to compute empty projection", e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/**
* A block packs positionCount values into a chunk of memory. How the values are packed,
* whether compression is used, endianness, and other implementation details are up to the subclasses.
* However, for purposes of API, you can think of a Block as a sequence of values that
* However, for purposes of API, you can think of a Block as a sequence of zero-indexed values that
* can be read by calling the getter methods in this interface. For instance,
* you can read positionCount bytes by calling
* block.getByte(0), block.getByte(1), ... block.getByte(positionCount - 1).
Expand All @@ -51,6 +51,8 @@ default int getSliceLength(int position)

/**
* Gets a byte in the value at {@code position}.
*
* @throws IllegalArgumentException if position is negative or greater than or equal to the positionCount
*/
default byte getByte(int position)
{
Expand All @@ -59,6 +61,8 @@ default byte getByte(int position)

/**
* Gets a short in the value at {@code position}.
*
* @throws IllegalArgumentException if position is negative or greater than or equal to the positionCount
*/
default short getShort(int position)
{
Expand All @@ -67,6 +71,8 @@ default short getShort(int position)

/**
* Gets an int in the value at {@code position}.
*
* @throws IllegalArgumentException if position is negative or greater than or equal to the positionCount
*/
default int getInt(int position)
{
Expand All @@ -75,6 +81,8 @@ default int getInt(int position)

/**
* Gets a long in the value at {@code position}.
*
* @throws IllegalArgumentException if position is negative or greater than or equal to the positionCount
*/
default long getLong(int position)
{
Expand All @@ -99,15 +107,16 @@ default Slice getSlice(int position, int offset, int length)

/**
* Gets a block in the value at {@code position}.
* @return
*
* @throws IllegalArgumentException if position is negative or greater than or equal to the positionCount
*/
default Block getBlock(int position)
{
throw new UnsupportedOperationException(getClass().getName());
}

/**
* Is the byte sequences at {@code offset} in the value at {@code position} equal
* Is the byte sequence at {@code offset} in the value at {@code position} equal
* to the byte sequence at {@code otherOffset} in {@code otherSlice}.
* This method must be implemented if @{code getSlice} is implemented.
*/
Expand Down Expand Up @@ -147,7 +156,7 @@ default void writeBytesTo(int position, int offset, int length, SliceOutput slic
}

/**
* Appends the value at {@code position} to {@code blockBuilder} and close the entry.
* Appends the value at {@code position} to {@code blockBuilder} and closes the entry.
*/
void writePositionTo(int position, BlockBuilder blockBuilder);

Expand Down Expand Up @@ -378,12 +387,14 @@ default Block getLoadedBlock()
Block appendNull();

/**
* Returns the converted long value at {@code position} if the value ar {@code position} can be converted to long.
* @throws UnsupportedOperationException if value at {@code position} is not compatible to be converted to long.
* Returns the converted long value at {@code position} if the value at {@code position} can be converted to long.
*
* Difference between toLong() and getLong() is:
* getLong() would only return value when the block is LongArrayBlock, otherwise it would throw exception.
* toLong() would return value for compatible types: LongArrayBlock, IntArrayBlock, ByteArrayBlock and ShortArrayBlock.
*
* @throws UnsupportedOperationException if value at {@code position} is not able to be converted to long.
* @throws IllegalArgumentException if position is negative or greater than or equal to the positionCount
*/
default long toLong(int position)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@
import static java.lang.String.format;
import static java.util.Objects.requireNonNull;

/**
* A dictionary holds positionCount values of arbitrary types. Usually some of these values are repeated,
* and the block wraps an underlying delegate block with fewer or no repeated values.
* This delegate block is called the "dictionary".
* The ids array contains positionCount indexes into the underlying delegate block.
* When value N is requested from this block instead of returning the value directly,
* it looks up the index of value N at ids[N]; then it returns the value in dictionary[ids[N]].
* This compresses data when the same value repeats at multiple locations.
*
* Not every id in the ids array is a valid position in the block.
* Specify an offset in the ids array to indicate that IDs are only stored from that position forward.
* If the ids array is longer than offset+positionCount, then extra values to the right are not valid.
* That is, IDs are stored in a range of the array from offset to offset+positionCount-1 (inclusive).
*/
public class DictionaryBlock
implements Block
{
Expand Down Expand Up @@ -509,6 +523,10 @@ int[] getRawIds()
return ids;
}

/**
* @param position the position of the desired value in this block
* @return the position of the desired value in the underlying block this block wraps
*/
public int getId(int position)
{
checkValidPosition(position, positionCount);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public static TupleDomainFilter toFilter(Domain domain)
}

/**
* Returns true is ranges represent != or NOT IN filter for double, float or string column.
* Returns true if ranges represent != or NOT IN filter for double, float or string column.
* <p>
* The logic is to return true if ranges are next to each other, but don't include the touch value.
*/
Expand Down
19 changes: 19 additions & 0 deletions presto-docs/src/main/sphinx/admin/properties.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,25 @@ output data set is not skewed in order to avoid the overhead of hashing and
redistributing all the data across the network. This can also be specified
on a per-query basis using the ``redistribute_writes`` session property.

``task_writer_count``
^^^^^^^^^^^^^^^^^^^^^

* **Type:** ``integer``
* **Default value:** ``1``

Default number of local parallel table writer threads per worker. It is required
to be a power of two for a Java query engine.

``task_partitioned_writer_count``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

* **Type:** ``integer``
* **Default value:** ``task_writer_count``

Number of local parallel table writer threads per worker for partitioned writes. If not
set, the number set by ``task_writer_count`` will be used. It is required to be a power
of two for a Java query engine.

.. _tuning-memory:

Memory Management Properties
Expand Down
14 changes: 12 additions & 2 deletions presto-docs/src/main/sphinx/connector/iceberg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ Property Name Description
Available values are ``NONE`` or ``OAUTH2`` (default: ``NONE``).
``OAUTH2`` requires either a credential or token.

``iceberg.rest.auth.oauth2.uri`` OAUTH2 server endpoint URI.
Example: ``https://localhost:9191``

``iceberg.rest.auth.oauth2.credential`` The credential to use for OAUTH2 authentication.
Example: ``key:secret``

Expand Down Expand Up @@ -1631,9 +1634,11 @@ In this example, SYSTEM_TIME can be used as an alias for TIMESTAMP.

// In following query, timestamp string is matching with second inserted record.
SELECT * FROM ctas_nation FOR TIMESTAMP AS OF TIMESTAMP '2023-10-17 13:29:46.822 America/Los_Angeles';
SELECT * FROM ctas_nation FOR TIMESTAMP AS OF TIMESTAMP '2023-10-17 13:29:46.822';

// Same example using SYSTEM_TIME as an alias for TIMESTAMP
SELECT * FROM ctas_nation FOR SYSTEM_TIME AS OF TIMESTAMP '2023-10-17 13:29:46.822 America/Los_Angeles';
SELECT * FROM ctas_nation FOR SYSTEM_TIME AS OF TIMESTAMP '2023-10-17 13:29:46.822';

.. code-block:: text

Expand All @@ -1643,8 +1648,12 @@ In this example, SYSTEM_TIME can be used as an alias for TIMESTAMP.
20 | canada | 2 | comment
(2 rows)

The option following FOR TIMESTAMP AS OF can accept any expression that returns a timestamp with time zone value.
For example, `TIMESTAMP '2023-10-17 13:29:46.822 America/Los_Angeles'` is a constant string for the expression.
.. note::

Timestamp without timezone will be parsed and rendered in the session time zone. See `TIMESTAMP <https://prestodb.io/docs/current/language/types.html#timestamp>`_.

The option following FOR TIMESTAMP AS OF can accept any expression that returns a timestamp or timestamp with time zone value.
For example, `TIMESTAMP '2023-10-17 13:29:46.822 America/Los_Angeles'` and `TIMESTAMP '2023-10-17 13:29:46.822'` are both valid timestamps. The first specifies the timestamp within the timezone `America/Los_Angeles`. The second will use the timestamp based on the user's session timezone.
In the following query, the expression CURRENT_TIMESTAMP returns the current timestamp with time zone value.

.. code-block:: sql
Expand All @@ -1665,6 +1674,7 @@ In the following query, the expression CURRENT_TIMESTAMP returns the current tim
// In following query, timestamp string is matching with second inserted record.
// BEFORE clause returns first record which is less than timestamp of the second record.
SELECT * FROM ctas_nation FOR TIMESTAMP BEFORE TIMESTAMP '2023-10-17 13:29:46.822 America/Los_Angeles';
SELECT * FROM ctas_nation FOR TIMESTAMP BEFORE TIMESTAMP '2023-10-17 13:29:46.822';

.. code-block:: text

Expand Down
8 changes: 8 additions & 0 deletions presto-docs/src/main/sphinx/connector/prometheus.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ replacing the properties as appropriate:
prometheus.max-query-duration=1h
prometheus.cache-ttl=30s
prometheus.bearer-token-file=/path/to/bearer/token/file
prometheus.tls.enabled=true
prometheus.tls.truststore-path=/path/to/truststore
prometheus.tls.truststore-password=truststorePassword
verify-host-name=true
Configuration Properties
------------------------
Expand All @@ -39,6 +43,10 @@ Property Name Description
``prometheus.max-query-duration`` Width of overall query to Prometheus, will be divided into query-chunk-duration queries
``prometheus.cache-ttl`` How long the config values are cached
``prometheus.bearer-token-file`` File holding bearer token for access to Prometheus
``prometheus.tls.enabled`` Enable or disable TLS for securing communication with Prometheus
``prometheus.tls.truststore-path`` Path to the trust store containing the SSL certificates
``prometheus.tls.truststore-password`` Password to access the trust store for TLS verification
``verify-host-name`` Enable or disable hostname verification in the SSL certificate
======================================== ============================================================================================

Not Exhausting Your Presto Available Heap
Expand Down
8 changes: 8 additions & 0 deletions presto-docs/src/main/sphinx/functions/ip.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,11 @@ IP Functions
SELECT is_private_ip(IPADDRESS '157.240.200.99'); -- false
SELECT is_private_ip(IPADDRESS '2a03:2880:f031:12:face:b00c:0:2'); -- false

.. function:: ip_prefix_subnets(ip_prefix, prefix_length) -> array(ip_prefix)

Returns the subnets of ``ip_prefix`` of size ``prefix_length``. ``prefix_length`` must be valid ([0, 32] for IPv4
and [0, 128] for IPv6) or the query will fail and raise an error. An empty array is returned if ``prefix_length``
is shorter (that is, less specific) than ``ip_prefix``. ::

SELECT IP_PREFIX_SUBNETS(IPPREFIX '192.168.1.0/24', 25); -- [{192.168.1.0/25}, {192.168.1.128/25}]
SELECT IP_PREFIX_SUBNETS(IPPREFIX '2a03:2880:c000::/34', 36); -- [{2a03:2880:c000::/36}, {2a03:2880:d000::/36}, {2a03:2880:e000::/36}, {2a03:2880:f000::/36}]
Loading

0 comments on commit d7017e6

Please sign in to comment.