Skip to content

[fix](function) error scale set in unix_timestamp (#36110)#37619

Merged
yiguolei merged 2 commits intoapache:branch-2.1from
Mryange:branch-2.1
Jul 15, 2024
Merged

[fix](function) error scale set in unix_timestamp (#36110)#37619
yiguolei merged 2 commits intoapache:branch-2.1from
Mryange:branch-2.1

Conversation

@Mryange
Copy link
Copy Markdown
Contributor

@Mryange Mryange commented Jul 10, 2024

Proposed changes

#36110

mysql [test]>set DEBUG_SKIP_FOLD_CONSTANT = true;
Query OK, 0 rows affected (0.00 sec)

mysql [test]>select cast(unix_timestamp("2024-01-01",'yyyy-MM-dd') as bigint);
+------------------------------------------------------------+
| cast(unix_timestamp('2024-01-01', 'yyyy-MM-dd') as BIGINT) |
+------------------------------------------------------------+
|                                           1704038400000000 |
+------------------------------------------------------------+

now

mysql [test]>select cast(unix_timestamp("2024-01-01",'yyyy-MM-dd') as bigint);
+------------------------------------------------------------+
| cast(unix_timestamp('2024-01-01', 'yyyy-MM-dd') as BIGINT) |
+------------------------------------------------------------+
|                                                 1704038400 |
+------------------------------------------------------------+
1 row in set (0.01 sec)

The column does not have a scale set, but the cast uses the scale to perform the cast.

Proposed changes

Issue Number: close #xxx

## Proposed changes

```
mysql [test]>set DEBUG_SKIP_FOLD_CONSTANT = true;
Query OK, 0 rows affected (0.00 sec)

mysql [test]>select cast(unix_timestamp("2024-01-01",'yyyy-MM-dd') as bigint);
+------------------------------------------------------------+
| cast(unix_timestamp('2024-01-01', 'yyyy-MM-dd') as BIGINT) |
+------------------------------------------------------------+
|                                           1704038400000000 |
+------------------------------------------------------------+
```
now
```
mysql [test]>select cast(unix_timestamp("2024-01-01",'yyyy-MM-dd') as bigint);
+------------------------------------------------------------+
| cast(unix_timestamp('2024-01-01', 'yyyy-MM-dd') as BIGINT) |
+------------------------------------------------------------+
|                                                 1704038400 |
+------------------------------------------------------------+
1 row in set (0.01 sec)
```

The column does not have a scale set, but the cast uses the scale to
perform the cast.


<!--Describe your changes.-->
@doris-robot
Copy link
Copy Markdown

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@Mryange
Copy link
Copy Markdown
Contributor Author

Mryange commented Jul 10, 2024

run buildall

@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@doris-robot
Copy link
Copy Markdown

TeamCity be ut coverage result:
Function Coverage: 36.33% (9153/25194)
Line Coverage: 27.88% (74772/268221)
Region Coverage: 26.78% (38584/144084)
Branch Coverage: 23.47% (19553/83306)
Coverage Report: http://coverage.selectdb-in.cc/coverage/b421dbc745e4d539bdb6e5342c3da31527bc3902_b421dbc745e4d539bdb6e5342c3da31527bc3902/report/index.html

@Mryange
Copy link
Copy Markdown
Contributor Author

Mryange commented Jul 11, 2024

run buildall

@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@doris-robot
Copy link
Copy Markdown

TeamCity be ut coverage result:
Function Coverage: 36.35% (9159/25195)
Line Coverage: 27.90% (74842/268249)
Region Coverage: 26.80% (38618/144097)
Branch Coverage: 23.49% (19570/83316)
Coverage Report: http://coverage.selectdb-in.cc/coverage/e44a8b75a26f10069e17254651bc8bdfcf562b1c_e44a8b75a26f10069e17254651bc8bdfcf562b1c/report/index.html

// UNIX_TIMESTAMP
def unin_timestamp_str = """ select unix_timestamp() """
assertTrue(unin_timestamp_str[0].size() == 1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sql """set DEBUG_SKIP_FOLD_CONSTANT = true;""" is missing?

@zhiqiang-hhhh
Copy link
Copy Markdown
Contributor

Is this picked from #36110 ? If so, why sql """set DEBUG_SKIP_FOLD_CONSTANT = true;""" is missing?

@Mryange
Copy link
Copy Markdown
Contributor Author

Mryange commented Jul 15, 2024

Is this picked from #36110 ? If so, why sql """set DEBUG_SKIP_FOLD_CONSTANT = true;""" is missing?

Because no such variable in 2.1

java.sql.SQLException: errCode = 2, detailMessage = Unknown system variable 'DEBUG_SKIP_FOLD_CONSTANT',the similar variables are {'forbid_unknown_col_stats', 'enable_strong_consistency_read', 'enable_function_pushdown'}

@yiguolei yiguolei merged commit 8de13c5 into apache:branch-2.1 Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants