Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix upload to artifact registry script #64

Open
wants to merge 18 commits into
base: looker
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
e6ea717
Workaround
julianhyde Jul 29, 2019
c09d49a
Looker instructions
julianhyde Mar 10, 2020
8ce8c94
Temporary workaround: change SqlInternalOperator's syntax back to FUN…
julianhyde Sep 16, 2020
a8dc9bb
[CALCITE-5052] Allow Source based on a URL with jar: protocol
mkou Mar 22, 2022
6c60f06
[CALCITE-3312] WIP: TIMESTAMPDIFF cannot be converted to SQL
tjbanghart Mar 28, 2023
607a2ff
[CALCITE-5449] Allow EXTRACT() to accept DAYOFWEEK, DAYOFYEAR, ISOWEE…
tjbanghart Mar 28, 2023
d8a502b
Use first datetime operand as DATE_TRUNC return type
tjbanghart Feb 28, 2023
0aa835f
Fix for sorting by literals
wnob Jun 28, 2023
e9c8eed
Fixup for MetaColumn constructor changes in [CALCITE-5549]
olivrlee Sep 28, 2023
707788b
[CALCITE-6055] Customize handling of type name based on type system
wnob Oct 17, 2023
ce896fa
[CALCITE-6062] Parse timestamps more permissively
wnob Oct 19, 2023
5961ccd
[CALCITE-5508] Allow no-op versions of DATETIME and TIMESTAMP
wnob Nov 14, 2023
9c803c0
Revert "[CALCITE-6006] RelToSqlConverter loses charset information"
tanclary Feb 16, 2024
093a8bb
[CALCITE-6196] Accept BigQuery PERCENTILE functions without OVER clause
tanclary Jan 9, 2024
9afff30
[CALCITE-6301] Extend ‘Must-filter’ columns to support a conditional …
olivrlee Oct 23, 2024
19d0c28
Revert "[CALCITE-4496] Measure columns ("SELECT ... AS MEASURE")"
olivrlee Oct 28, 2024
f8d6474
Revert "[CALCITE-6519] Non-aggregate query that uses measure in ORDER…
olivrlee Nov 7, 2024
7d588dc
Fix upload to artifact registry script
olivrlee Nov 8, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public static void main(String[] args) throws Exception {
ConnectionFactories.addType("TIMESTAMP", typeFactory ->
typeFactory.createSqlType(
SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE)))
.with(CalciteConnectionProperty.TIME_ZONE, "UTC")
.connect();
case "scott-postgresql":
return CalciteAssert.that()
Expand Down
99 changes: 63 additions & 36 deletions babel/src/test/resources/sql/big-query.iq
Original file line number Diff line number Diff line change
Expand Up @@ -410,14 +410,12 @@ SELECT
# In the following example, EXTRACT returns values corresponding to
# different date parts from a column of dates near the end of the
# year.

!if (false) {
SELECT
d,
EXTRACT(ISOYEAR FROM d) AS isoyear,
EXTRACT(ISOWEEK FROM d) AS isoweek,
EXTRACT(YEAR FROM d) AS year,
EXTRACT(WEEK FROM d) AS week
EXTRACT(ISOWEEK FROM d) as isoweek,
EXTRACT(WEEK(TUESDAY) FROM d) AS week_tues,
EXTRACT(YEAR FROM d) AS year
FROM UNNEST(
ARRAY [DATE '2015-12-23',
DATE '2015-12-24',
Expand All @@ -438,48 +436,62 @@ FROM UNNEST(
DATE '2016-01-08',
DATE '2016-01-09']) AS d
ORDER BY d;
+------------+---------+---------+------+------+
| date | isoyear | isoweek | year | week |
+------------+---------+---------+------+------+
| 2015-12-23 | 2015 | 52 | 2015 | 51 |
| 2015-12-24 | 2015 | 52 | 2015 | 51 |
| 2015-12-25 | 2015 | 52 | 2015 | 51 |
| 2015-12-26 | 2015 | 52 | 2015 | 51 |
| 2015-12-27 | 2015 | 52 | 2015 | 52 |
| 2015-12-28 | 2015 | 53 | 2015 | 52 |
| 2015-12-29 | 2015 | 53 | 2015 | 52 |
| 2015-12-30 | 2015 | 53 | 2015 | 52 |
| 2015-12-31 | 2015 | 53 | 2015 | 52 |
| 2016-01-01 | 2015 | 53 | 2016 | 0 |
| 2016-01-02 | 2015 | 53 | 2016 | 0 |
| 2016-01-03 | 2015 | 53 | 2016 | 1 |
| 2016-01-04 | 2016 | 1 | 2016 | 1 |
| 2016-01-05 | 2016 | 1 | 2016 | 1 |
| 2016-01-06 | 2016 | 1 | 2016 | 1 |
| 2016-01-07 | 2016 | 1 | 2016 | 1 |
| 2016-01-08 | 2016 | 1 | 2016 | 1 |
| 2016-01-09 | 2016 | 1 | 2016 | 1 |
+------------+---------+---------+------+------+
+------------+---------+---------+-----------+------+
| d | isoyear | isoweek | week_tues | year |
+------------+---------+---------+-----------+------+
| 2015-12-23 | 2015 | 52 | 51 | 2015 |
| 2015-12-24 | 2015 | 52 | 51 | 2015 |
| 2015-12-25 | 2015 | 52 | 51 | 2015 |
| 2015-12-26 | 2015 | 52 | 51 | 2015 |
| 2015-12-27 | 2015 | 52 | 51 | 2015 |
| 2015-12-28 | 2015 | 53 | 51 | 2015 |
| 2015-12-29 | 2015 | 53 | 52 | 2015 |
| 2015-12-30 | 2015 | 53 | 52 | 2015 |
| 2015-12-31 | 2015 | 53 | 52 | 2015 |
| 2016-01-01 | 2015 | 53 | 0 | 2016 |
| 2016-01-02 | 2015 | 53 | 0 | 2016 |
| 2016-01-03 | 2015 | 53 | 0 | 2016 |
| 2016-01-04 | 2016 | 1 | 0 | 2016 |
| 2016-01-05 | 2016 | 1 | 1 | 2016 |
| 2016-01-06 | 2016 | 1 | 1 | 2016 |
| 2016-01-07 | 2016 | 1 | 1 | 2016 |
| 2016-01-08 | 2016 | 1 | 1 | 2016 |
| 2016-01-09 | 2016 | 1 | 1 | 2016 |
+------------+---------+---------+-----------+------+
(18 rows)

!ok
!}


# In the following example, date_expression falls on a Sunday. EXTRACT
# calculates the first column using weeks that begin on Sunday, and it
# calculates the second column using weeks that begin on Monday.

!if (false) {
WITH t AS (SELECT DATE('2017-11-05') AS d)
SELECT
d,
EXTRACT(ISOWEEK FROM d) AS isoweek,
EXTRACT(WEEK(SUNDAY) FROM d) AS week_sunday,
EXTRACT(WEEK(MONDAY) FROM d) AS week_monday FROM t;
+------------+-------------+-------------+
| date | week_sunday | week_monday |
+------------+-------------+-------------+
| 2017-11-05 | 45 | 44 |
+------------+-------------+-------------+
+------------+---------+-------------+-------------+
| d | isoweek | week_sunday | week_monday |
+------------+---------+-------------+-------------+
| 2017-11-05 | 44 | 45 | 44 |
+------------+---------+-------------+-------------+
(1 row)

!ok

SELECT EXTRACT(DAYOFWEEK FROM DATE '2008-12-25') as dow,
EXTRACT(DAYOFYEAR FROM DATE '2008-12-25') as doy;
+-----+-----+
| dow | doy |
+-----+-----+
| 5 | 360 |
+-----+-----+
(1 row)

!ok
!}

# In the following example, EXTRACT returns a value corresponding to
# the HOUR time part.
Expand Down Expand Up @@ -2716,6 +2728,18 @@ SELECT TIMESTAMP(DATE "2008-12-25") AS timestamp_date;

!ok

# This tests the no-op TIMESTAMP and DATETIME functions.
select TIMESTAMP(TIMESTAMP "2008-01-01 01:03:05") as ts,
DATETIME(DATETIME "2008-01-01 01:03:05") as dt;
+---------------------+---------------------+
| ts | dt |
+---------------------+---------------------+
| 2008-01-01 01:03:05 | 2008-01-01 01:03:05 |
+---------------------+---------------------+
(1 row)

!ok

# All these timestamps should be equal.
# This tests the BQ timestamp literal string formatter
# (optional 'T', optional leading zeros, optional offset with conversion).
Expand Down Expand Up @@ -3436,7 +3460,8 @@ SELECT
(1 row)

!ok

# Bug.CALCITE_2539_FIXED
!if (false) {
#####################################################################
# DATE_DIFF
#
Expand Down Expand Up @@ -3747,6 +3772,8 @@ SELECT TIMESTAMP_DIFF(TIMESTAMP '2008-12-25', TIMESTAMP '2008-09-25', `quarter`)
(1 row)

!ok

!}
#####################################################################
# DATE_TRUNC
#
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ tasks.validateBeforeBuildingReleaseArtifacts {

val String.v: String get() = rootProject.extra["$this.version"] as String

val buildVersion = "calcite".v + releaseParams.snapshotSuffix
val buildVersion = if (project.gradle.startParameter.projectProperties["forRelease"] == "true") { "calcite".v } else { "calcite".v + releaseParams.snapshotSuffix }

println("Building Apache Calcite $buildVersion")

Expand Down
27 changes: 17 additions & 10 deletions core/src/main/codegen/templates/Parser.jj
Original file line number Diff line number Diff line change
Expand Up @@ -1945,19 +1945,13 @@ SqlInsert WhenNotMatchedClause(SqlNode table) :
*/
void AddSelectItem(List<SqlNode> list) :
{
SqlNode e;
final SqlNode e;
final SqlIdentifier id;
}
{
e = SelectExpression()
(
[ <AS>
[ <MEASURE> {
e = SqlInternalOperators.MEASURE.createCall(
e.getParserPosition(), e);
}
]
]
[ <AS> ]
(
id = SimpleIdentifier()
|
Expand Down Expand Up @@ -6166,6 +6160,15 @@ SqlTypeNameSpec DateTimeTypeName() :
typeName = SqlTypeName.DATE;
return new SqlBasicTypeNameSpec(typeName, getPos());
}
|
// DATETIME is the BigQuery-specific name for ISO SQL's TIMESTAMP type.
// In order to support this, the schema UDT map must be properly configued.
// See the BigQuery Quidem tests in the babel component for an example.
<DATETIME> {
s = span();
return new SqlUserDefinedTypeNameSpec(
unquotedIdentifier(), precision, s.end(this));
}
|
LOOKAHEAD(2)
<TIME> { s = span(); }
Expand All @@ -6179,7 +6182,12 @@ SqlTypeNameSpec DateTimeTypeName() :
precision = PrecisionOpt()
typeName = TimeZoneOpt(false)
{
return new SqlBasicTypeNameSpec(typeName, precision, s.end(this));
// Like DATETIME above, TIMESTAMP may have a different meaning for
// certain SQL dialects (namely, BigQuery). Unlike DATETIME, TIMESTAMP
// types names have default standard types that will be used in the
// absence of a UDT mapping.
return new SqlUserDefinedTypeNameSpec(
typeName.getSpaceName(), precision, s.end(this));
}
}

Expand Down Expand Up @@ -8347,7 +8355,6 @@ SqlPostfixOperator PostfixRowOperator() :
| < MATCH_RECOGNIZE: "MATCH_RECOGNIZE">
| < MAX: "MAX" >
| < MAXVALUE: "MAXVALUE" >
| < MEASURE: "MEASURE" >
| < MEASURES: "MEASURES" >
| < MEMBER: "MEMBER" >
| < MERGE: "MERGE" > { beforeTableName(); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.apache.calcite.rel.convert.ConverterRule;
import org.apache.calcite.rel.core.Project;
import org.apache.calcite.rel.logical.LogicalProject;
import org.apache.calcite.rex.RexUtil;

/**
* Rule to convert a {@link LogicalProject} to an {@link EnumerableProject}.
Expand All @@ -34,8 +33,7 @@ class EnumerableProjectRule extends ConverterRule {
/** Default configuration. */
static final Config DEFAULT_CONFIG = Config.INSTANCE
.as(Config.class)
.withConversion(LogicalProject.class,
p -> !p.containsOver() && !RexUtil.M2V_FINDER.inProject(p),
.withConversion(LogicalProject.class, p -> !p.containsOver(),
Convention.NONE, EnumerableConvention.INSTANCE,
"EnumerableProjectRule")
.withRuleFactory(EnumerableProjectRule::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -873,8 +873,8 @@ void populate2() {
// datetime
define(DATETIME_PLUS, new DatetimeArithmeticImplementor());
define(MINUS_DATE, new DatetimeArithmeticImplementor());
define(EXTRACT, new ExtractImplementor());
define(DATE_PART, new ExtractImplementor());
define(EXTRACT, new ExtractImplementor(true));
define(DATE_PART, new ExtractImplementor(false));
define(FLOOR,
new FloorImplementor(BuiltInMethod.FLOOR.method,
BuiltInMethod.UNIX_TIMESTAMP_FLOOR.method,
Expand Down Expand Up @@ -3287,12 +3287,20 @@ private static class UnaryImplementor extends AbstractRexCallImplementor {

/** Implementor for the {@code EXTRACT(unit FROM datetime)} function. */
private static class ExtractImplementor extends AbstractRexCallImplementor {
ExtractImplementor() {

private final boolean supportDayOfWeek;

ExtractImplementor(boolean supportDayOfWeek) {
super("extract", NullPolicy.STRICT, false);
this.supportDayOfWeek = supportDayOfWeek;
}

@Override Expression implementSafe(final RexToLixTranslator translator,
final RexCall call, final List<Expression> argValueList) {
if (argValueList.get(0).getType() == String.class && supportDayOfWeek) {
return Expressions.call(BuiltInMethod.CUSTOM_DATE_EXTRACT.method,
translator.getRoot(), argValueList.get(0), argValueList.get(1));
}
// May need to convert the first argument from a String to a TimeUnitRange
final Object timeUnitRangeObj = translator.getLiteralValue(argValueList.get(0));
final TimeUnitRange timeUnitRange;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ MetaColumn createColumn(Table table, String tableCat, String tableSchem,
String tableName, String columnName, int dataType, String typeName,
Integer columnSize, @Nullable Integer decimalDigits, int numPrecRadix,
int nullable, Integer charOctetLength, int ordinalPosition,
String isNullable);
String isNullable, String isAutoincrement, String isGeneratedcolumn);

/** Returns the list of expected column names.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
int nullable,
Integer charOctetLength,
int ordinalPosition,
String isNullable) {
String isNullable,
String isAutoincrement,
String isGeneratedcolumn) {
return new MetaColumn(
tableCat,
tableSchem,
Expand All @@ -55,12 +57,14 @@
dataType,
typeName,
columnSize,
decimalDigits,

Check failure on line 60 in core/src/main/java/org/apache/calcite/jdbc/CalciteMetaColumnFactoryImpl.java

View workflow job for this annotation

GitHub Actions / CheckerFramework (JDK 11)

[Task :core:compileJava] [argument.type.incompatible] incompatible argument for parameter decimalDigits of MetaColumn. decimalDigits, ^ found : @initialized @nullable Integer

Check failure on line 60 in core/src/main/java/org/apache/calcite/jdbc/CalciteMetaColumnFactoryImpl.java

View workflow job for this annotation

GitHub Actions / CheckerFramework (JDK 11, oldest Guava)

[Task :core:compileJava] [argument.type.incompatible] incompatible argument for parameter decimalDigits of MetaColumn. decimalDigits, ^ found : @initialized @nullable Integer

Check failure on line 60 in core/src/main/java/org/apache/calcite/jdbc/CalciteMetaColumnFactoryImpl.java

View workflow job for this annotation

GitHub Actions / CheckerFramework (JDK 11)

[Task :core:compileJava] [argument.type.incompatible] incompatible argument for parameter decimalDigits of MetaColumn. decimalDigits, ^ found : @initialized @nullable Integer

Check failure on line 60 in core/src/main/java/org/apache/calcite/jdbc/CalciteMetaColumnFactoryImpl.java

View workflow job for this annotation

GitHub Actions / CheckerFramework (JDK 11, oldest Guava)

[Task :core:compileJava] [argument.type.incompatible] incompatible argument for parameter decimalDigits of MetaColumn. decimalDigits, ^ found : @initialized @nullable Integer
numPrecRadix,
nullable,
charOctetLength,
ordinalPosition,
isNullable);
isNullable,
isAutoincrement,
isGeneratedcolumn);
}

@Override public Class<? extends MetaColumn> getMetaColumnClass() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,11 @@ public Enumerable<MetaColumn> columns(final MetaTable table_) {
: DatabaseMetaData.columnNoNulls,
precision,
field.getIndex() + 1,
field.getType().isNullable() ? "YES" : "NO");
field.getType().isNullable() ? "YES" : "NO",
"NO",
field.getType().getSqlTypeName() == SqlTypeName.MEASURE
? "YES"
: "NO");
});
}

Expand Down
Loading
Loading