Skip to content

Commit

Permalink
Change the default precision of timestamp datatypes to micros (6) ins…
Browse files Browse the repository at this point in the history
…tead of current millis (3)
  • Loading branch information
amargoor authored and Amogh Margoor committed Jan 9, 2024
1 parent 6f9f8cf commit f92f49b
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 5 deletions.
36 changes: 36 additions & 0 deletions core/trino-spi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,42 @@
<old>method void io.trino.spi.connector.ConnectorMetadata::createMaterializedView(io.trino.spi.connector.ConnectorSession, io.trino.spi.connector.SchemaTableName, io.trino.spi.connector.ConnectorMaterializedViewDefinition, boolean, boolean)</old>
<new>method void io.trino.spi.connector.ConnectorMetadata::createMaterializedView(io.trino.spi.connector.ConnectorSession, io.trino.spi.connector.SchemaTableName, io.trino.spi.connector.ConnectorMaterializedViewDefinition, java.util.Map&lt;java.lang.String, java.lang.Object&gt;, boolean, boolean)</new>
</item>
<item>
<ignore>true</ignore>
<code>java.field.constantValueChanged</code>
<old>field io.trino.spi.type.TimeType.DEFAULT_PRECISION</old>
<new>field io.trino.spi.type.TimeType.DEFAULT_PRECISION</new>
<justification>Change the precision to 6 as specified by SQL Standard</justification>
<oldValue>3</oldValue>
<newValue>6</newValue>
</item>
<item>
<ignore>true</ignore>
<code>java.field.constantValueChanged</code>
<old>field io.trino.spi.type.TimeWithTimeZoneType.DEFAULT_PRECISION</old>
<new>field io.trino.spi.type.TimeWithTimeZoneType.DEFAULT_PRECISION</new>
<justification>Change the precision to 6 as specified by SQL Standard</justification>
<oldValue>3</oldValue>
<newValue>6</newValue>
</item>
<item>
<ignore>true</ignore>
<code>java.field.constantValueChanged</code>
<old>field io.trino.spi.type.TimestampType.DEFAULT_PRECISION</old>
<new>field io.trino.spi.type.TimestampType.DEFAULT_PRECISION</new>
<justification>Change the precision to 6 as specified by SQL Standard</justification>
<oldValue>3</oldValue>
<newValue>6</newValue>
</item>
<item>
<ignore>true</ignore>
<code>java.field.constantValueChanged</code>
<old>field io.trino.spi.type.TimestampWithTimeZoneType.DEFAULT_PRECISION</old>
<new>field io.trino.spi.type.TimestampWithTimeZoneType.DEFAULT_PRECISION</new>
<justification>Change the precision to 6 as specified by SQL Standard</justification>
<oldValue>3</oldValue>
<newValue>6</newValue>
</item>
</differences>
</revapi.differences>
</analysisConfiguration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public final class TimeType
private static final VarHandle LONG_HANDLE = MethodHandles.byteArrayViewVarHandle(long[].class, ByteOrder.LITTLE_ENDIAN);

public static final int MAX_PRECISION = 12;
public static final int DEFAULT_PRECISION = 3; // TODO: should be 6 per SQL spec
public static final int DEFAULT_PRECISION = 6;

private static final TimeType[] TYPES = new TimeType[MAX_PRECISION + 1];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public abstract sealed class TimeWithTimeZoneType
public static final int MAX_PRECISION = 12;
public static final int MAX_SHORT_PRECISION = 9;

public static final int DEFAULT_PRECISION = 3; // TODO: should be 6 per SQL spec
public static final int DEFAULT_PRECISION = 6;

private static final TimeWithTimeZoneType[] TYPES = new TimeWithTimeZoneType[MAX_PRECISION + 1];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public abstract sealed class TimestampType
public static final int MAX_PRECISION = 12;

public static final int MAX_SHORT_PRECISION = 6;
public static final int DEFAULT_PRECISION = 3; // TODO: should be 6 per SQL spec
public static final int DEFAULT_PRECISION = 6;

private static final TimestampType[] TYPES = new TimestampType[MAX_PRECISION + 1];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public abstract sealed class TimestampWithTimeZoneType
public static final int MAX_PRECISION = 12;

public static final int MAX_SHORT_PRECISION = 3;
public static final int DEFAULT_PRECISION = 3; // TODO: should be 6 per SQL spec
public static final int DEFAULT_PRECISION = 6;

private static final TimestampWithTimeZoneType[] TYPES = new TimestampWithTimeZoneType[MAX_PRECISION + 1];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
public class TestJdbcCompatibility
{
private static final Optional<Integer> VERSION_UNDER_TEST = testedVersion();
private static final int TIMESTAMP_DEFAULT_PRECISION = 3;
private static final int TIMESTAMP_DEFAULT_PRECISION = 6;

private final TestingTrinoServer server;
private final String serverUrl;
Expand Down

0 comments on commit f92f49b

Please sign in to comment.