同步操作将从 wangmingyue/prestosql 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
Developers should read the development section of the website, which covers thing like development philosophy and contribution process.
We recommend you use IntelliJ as your IDE. The code style template for the project can be found in the codestyle repository along with our general programming and Java guidelines. In addition to those you should also adhere to the following:
Alphabetize sections in the documentation source files (both in the table of contents files and other regular documentation files). In general, alphabetize methods/variables/sections if such ordering already exists in the surrounding code.
When appropriate, use the stream API. However, note that the stream implementation does not perform well so avoid using it in inner loops or otherwise performance sensitive sections.
Categorize errors when throwing exceptions. For example, TrinoException
takes
an error code as an argument, TrinoException(HIVE_TOO_MANY_OPEN_PARTITIONS)
.
This categorization lets you generate reports so you can monitor the frequency
of various failures.
Ensure that all files have the appropriate license header; you can generate the
license by running mvn license:format
.
Consider using String formatting (printf style formatting using the Java
Formatter
class): format("Session property %s is invalid: %s", name, value)
(note that format()
should always be statically imported). Sometimes, if you
only need to append something, consider using the +
operator. Please avoid
format()
or concatenation in performance critical sections of code.
Avoid using the ternary operator except for trivial expressions.
It is suggested to declare members in private inner classes as public if they are part of the class API.
Do not use mocking libraries. These libraries encourage testing specific call sequences, interactions, and other internal behavior, which we believe leads to fragile tests. They also make it possible to mock complex interfaces or classes, which hides the fact that these classes are not (easily) testable. We prefer to write mocks by hand, which forces code to be written in a certain testable style.
Prefer AssertJ for complex assertions.
Assertions
For thing not easily expressible with AssertJ, use Airlift's Assertions
class
if there is one that covers your case.
var
Using var
is discouraged.
Prefer using immutable collections from Guava over unmodifiable collections from JDK. The main motivation behind this is deterministic iteration.
Maintain the same quality for production and test code.
When writing a Git commit message, follow these guidelines.
Please avoid abbreviations, slang or inside jokes as this makes harder for
non-native english speaker to understand the code. Very well known
abbreviations like max
or min
and ones already very commonly used across
the code base like ttl
are allowed and encouraged.
Avoid using the default
clause when the switch statement is meant to cover all the
enum values. Handling the unknown option case after the switch statement allows static code
analysis tools (e.g. Error Prone's MissingCasesInEnumSwitch
check) report a problem
when the enum definition is updated but the code using it is not.
When using IntelliJ to develop Trino, we recommend starting with all of the default inspections, with some modifications.
Enable the following inspections:
Java | Internationalization | Implicit usage of platform's default charset
,Java | Control flow issues | Redundant 'else'
(including Report when there are no more statements after the 'if' statement
option),Java | Class structure | Utility class is not 'final'
,Java | Class structure | Utility class with 'public' constructor
,Java | Class structure | Utility class without 'private' constructor
.Disable the following inspections:
Java | Performance | Call to 'Arrays.asList()' with too few arguments
,Java | Abstraction issues | 'Optional' used as field or parameter type
.Enable errorprone (Error Prone Installation#IDEA):
Error Prone Compiler
plugin from marketplace,Java Compiler
tab, select Javac with error-prone
as the compiler,Additional command line parameters
with -XepExcludedPaths:.*/target/generated-(|test-)sources/.* -XepDisableAllChecks -Xep:MissingOverride:ERROR ......
(for current recommended list of command line parameters, see the top level pom.xml
, the definition of the errorprone-compiler
profile.In order to enable language injection inside Intellij IDEA, some code elements can be annotated with the @org.intellij.lang.annotations.Language
annotation. To make it useful, we recommend:
Languages & Frameworks | SQL Dialects
- "Generic SQL" is a decent choice here,SQL | No data source configured
,Language injection | Language mismatch
.Even if the IDE does not support language injection this annotation is useful for documenting the API's intent. Considering the above, we recommend annotating with @Language
:
String
containing an SQL statement (or any other language, like regular expressions),The Trino Web UI is composed of several React components and is written in JSX and ES6. This source code is compiled and packaged into browser-compatible Javascript, which is then checked in to the Trino source code (in the dist
folder). You must have Node.js and Yarn installed to execute these commands. To update this folder after making changes, simply run:
yarn --cwd core/trino-main/src/main/resources/webapp/src install
If no Javascript dependencies have changed (i.e., no changes to package.json
), it is faster to run:
yarn --cwd core/trino-main/src/main/resources/webapp/src run package
To simplify iteration, you can also run in watch
mode, which automatically re-compiles when changes to source files are detected:
yarn --cwd core/trino-main/src/main/resources/webapp/src run watch
To iterate quickly, simply re-build the project in IntelliJ after packaging is complete. Project resources will be hot-reloaded and changes are reflected on browser refresh.
More information about the documentation process can be found in the docs module.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。