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

Debug calcite 6123 #24

Open
wants to merge 588 commits into
base: main
Choose a base branch
from
Open

Debug calcite 6123 #24

wants to merge 588 commits into from

Conversation

JiajunBernoulli
Copy link
Owner

No description provided.

julianhyde and others added 30 commits May 27, 2023 21:17
…te should create a Values

If RelBuilder.project is applied to an Aggregate with no group keys
(which always returns one row) and all of the projected expressions are
literals, then the result should be a Values with one row.

For example,
  SELECT 42 FROM myTable GROUP BY ()
becomes
  VALUES 42
(Both queries always return one row, even if myTable is empty.)

Close apache#3209
Use matchers for Object.toString(), Collection.size(), Map.size():
* assertThat(map.size(), is(n)) → assertThat(map, aMapWithSize(n));
* assertThat(list.size(), is(n)) → assertThat(map, IsCollectionWithSize.hasSize(n));
* assertThat(o.toString(), is(s)) → assertThat(o, hasToString(s));
* assertThat(o.toString(), equalTo(s)) → assertThat(o, hasToString(s));

If there are multiple equivalent methods in Hamcrest, use the
ones in CoreMatchers or Matchers:
* CoreMatchers.is rather than Is.is
* Matchers.hasToString rather than HasToString.hasToString
* Matchers.hasSize rather than IsCollectionWithSize.hasSize
* Matchers.aMapWithSize rather than IsMapWithSize.aMapWithSize

Require static import of methods in CoreMatchers and Matchers.
Autostyle now converts

  import org.hamcrest.CoreMatchers;
  import org.hamcrest.Matchers;

to

  import static org.hamcrest.CoreMatchers.anything;
  import static org.hamcrest.Matchers.allOf;

and hopefully the user will take the hint.
* Javadoc paragraphs (starting with '<p>') must have a blank
  line before;
* Javadoc paragraphs must have exactly one space between the
  '*' or '/**' at the start of the line and the first
  non-whitespace character;
* Ensure that '<p>' is not at the end of a line;
* Remove '</p>'; they are not required because Javadoc is
  HTML, not XHTML;
* Require blank line between description and first @param,
  @return, etc.
* Replace all '**/' with '*/'.
… by lower version Oracle Server(<12) when unparsing OffsetFetch
… are equal under `compareTo` but not `equals`

BigDecimal is a type that implements Comparable but whose
natural order is not consistent with equals. For example, if
x = BigDecimal("1.0") and and y = BigDecimal("1"),
x.equals(y) returns false and x.compareTo(y) returns 0.
Guava RangeSet is OK with such types, and Sarg should be also.

Before this fix, Sarg could not deduce that
  z < 1 or 1.0 < z
is equivalent to
  z <> 1

Close apache#3224
… ORDER BY ordinal

The incorrect query has an ordinal that is not the first item
of the ORDER BY clause:

  SELECT "JOB"
  FROM "scott"."EMP"
  GROUP BY "JOB"
  ORDER BY "JOB", 2

The correct query should have a subquery:

  SELECT "JOB"
  FROM (SELECT "JOB", COUNT("ENAME") AS "$f1"
    FROM "scott"."EMP"
    GROUP BY "JOB"
    ORDER BY "JOB", 2) AS "t0"
…ESTAMP_TRUNC/DATETIME_TRUNC should return TIMESTAMP for DATE/TIMESTAMPs and TIMESTAMP_LTZ for TIMESTAMP_LTZ
`PairList` is a list whose entries are pairs (`interface Map.Entry`).

Its implementation is efficient (backed by a single list,
where the left and right parts of each pair are stored in
even, odd positions).

In addition to the usual `List` methods, there are additional
methods for pairs: `add(K, V)`, `leftList()`, `rightList()`,
`toImmutableMap()`, `forEach(BiConsumer<K, V>)`,
`forEach(IndexedBiConsumer<K, V>)`,

By default `PairList` is immutable, but using the method
`PairList.immutable()` you can override the backing list and
create an immutable `PairList`.
Puffin provides a similar programming model to Awk. A program
is a collection of rules, each of which is a predicate
applied to a line of text followed by an action on that test.

Puffin programs are thread-safe; if Puffin is invoked on
mutiple sources (files), each file is processed in its own
thread and is allocated its own state that the rules can use
without coordination.

Puffin caches compiled regular expressions, so that calls to
`matches(String)` are almost as efficient as if the program
had called `Pattern.compile(String)` in advance.
Add an autostyle rule, and fix its one violation.

Fix lint violations detected by [CALCITE-5765] LintTest (to follow).
LintTest.testLint applies rules to Calcite's java source files,
most of them concerned with the formatting of javadoc comments,
and fails if any of the rules give warnings.

LintTest.testLog verifies recent git commit messages. The
goal is to prevent malformed messages that begin with a
space, end in a '.', or contain the word 'fix'. (Many commit
messages that contain the word 'fix' are describing the code
change; they should instead describe the problem seen by the
user, which is what will be most useful to those reading the
release notes. If the message describes the problem, the
word 'fix' is implicit.)

Also create method `TestUtil.getBase(File)`, based on some
logic previously in `DocumentationTest`.

Close apache#3250
If a block of text in javadoc is preceded by a blank line, and is not
inside '<blockquote>' or '<ul>', the block must start with '<p>'.
…e twice when emulating NULLS LAST

This is a problem because MSSQL disallows duplicate sort keys. The MSSQL
dialect should not give GROUPING special treatment when emulating NULL
direction, and this change solves the problem by removing that special
treatment.

Close apache#3251
Flink has a similar function, but has slightly different
behavior from Spark.
  array_contains(array[1, null], cast(null as integer))
returns TRUE in Flink, UNKNOWN in Spark. This change
implements the Spark behavior.

Replace SqlFunctions.arrayContains with List.contains (Julian Hyde).

Tweak Util.distinctList, and add note that SqlFunctions.distinct could
use a similar algorithm (Julian Hyde).

Close apache#3207
LakeShen and others added 28 commits November 3, 2023 10:09
…Deep for fieldTypes rather than reference comparison
Bump commons-codec from 1.13 to 1.16.0
Bump commons-dbcp2 from 2.9.0 to 2.11.0
Bump commons-io from 2.11.0 to 2.15.0
Bump commons-lang3 from 3.8 to 3.13.0
Bump commons-pool2 from 2.6.2 to 2.12.0
Bump commons-text from 1.10.0 to 1.11.0
…de) for SqlKind.MINUS

Uncovered a bug in RelJson#toRex for the TIMESTAMP_DIFF call for Big Query dialect.
MINUS_DATE uses an ARG2_NULLABLE return type inference which requires 3 operands, however there are only 2 operands for BQ.
The solution here is to do something similar to how we handle CAST and to add in "type" when serializing to JSON in RelJson.toJson(RexNode node) for SqlKind.MINUS so that jsonType will be defined in toRex.

Co-authored-by: TJ Banghart <[email protected]>
…unction for empty string arguments

Signed-off-by: Mihai Budiu <[email protected]>
… of TernaryExpression if it does not do any optimization

Before this change, OptimizeShuttle might return a different
Expression object that is equivalent to the original; this
would cause the optimizer to loop, mistakenly believing that
optimizations were occurring, which was inefficient.

After this change, the OptimizeShuttle avoids extra loops
when optimizing statements with ternary expressions.

Close apache#3518
Close apache#3494

Signed-off-by: Mihai Budiu <[email protected]>
This commit adds a lint test to check the contributors file;
the previous commit (by Mihai Budiu) sorts the contributors
file, so that lint succeeds.
…tes by adding a git mailmap file

Add entries to .mailmap to that release notes since 1.29
would be generated correctly.

Update HOWTO examples showing how to generate release notes.

Add a lint test to ensure that .mailmap remains sorted.

Close apache#3533
…ious Sort operator, if possible

The RelBuilder.limit(offset, fetch) method should apply offset
and fetch to the previous Sort operator, possible. If I call
RelBuilder.sort to create a Sort with an offset but no fetch,
then I call RelBuilder.limit(0, fetch) to set a fetch, it
currently creates two LogicalSort nodes but should just set
the fetch of the LogicalSort that already exists.

Close apache#3538
Copy link

This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 90 days if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the [email protected] list. Thank you for your contributions.

@github-actions github-actions bot added the stale label Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.