Does Teradata 14 support bitwise? - bit-manipulation

I can swear that I heard that TD14 will support bitwise, but I see no mention of it in searches nor searching "bitwise" in the TD14 manual.
Can someone confirm whether or not bitwise is supported?
BTW, the manual I am looking at is the Teradata User Documentation in case there's another doc that I should be reading.

Check out Chapter 4 of the Teradata 14 SQL Functions, Operators, Expressions and Predicates manual explains the Byte/Bit Manipulation Functions available in Teradata 14 via embedded services functions.
(read: They are not native ANSI operators like what is found in Transact-SQL.)

Yes, Teradata 14 (and other versions) support these kinds of functions, as documented in Chapter 6, "Bit/Byte Manipulation Functions," of the "SQL Functions, Operators, Expressions, and Predicates" reference. Specifically, they have BITAND(target_arg, bit_mask_arg), as well as BITNOT, BITOR, BITXOR, COUNTSET, GETBIT, SETBIT, ROTATELEFT, ROTATERIGHT, SHIFTLEFT, SHIFTRIGHT, and SUBBITSTR.

Related

How to take advantage of calcite-server

Our project relies on calcite-core, but we also need to use DDL statements. The server module (calcite-server) adds DDL support to Calcite. How can we take advantage of calcite-server to support our demands?
calcite's documentations have mentioned that
If you are the author of a sub-project, it is unlikely that your syntax extensions match those in calcite-server, so we recommend that you add your SQL syntax extensions by extending the core parser; if you want DDL commands, you may be able to copy-paste from calcite-server into your project.
Does this mean that we should extend Calcite-core by ourselves instead of using Calcite-server directly.
Is there a better way?
If you are fine using the dialect of DDL supported by calcite-server, feel free. But if you have your own dialect of DDL, you'll likely need to write your own version of calcite-server.

How to use Apache calcite LIKE_REGEX

I would like to use LIKE_REGEX in Apache calcite SQL query and can not find any documentation or examples on how to use it. Can you please share examples or documentation around it's usage.
LIKE_REGEX was introduced in the SQL:2008 standard but as of version 1.17 Calcite does not currently support it. (If you look at Calcite's SQL reference, LIKE_REGEX appears in Calcite's list of reserved SQL keywords because Calcite automatically reserves keywords listed in the SQL standard.)
If you would like to match regular expressions, use SIMILAR TO. For example, the query VALUES 'abcccd' similar to 'ab*c+d' returns TRUE.
Calcite's implementation of SIMILAR TO has semantics similar to PostgreSQL's implementation.

If Spark's data will be cached off-heap, will it have a byte-level specification?

I have learned from various blogs, most notably this one, that in the near future, Apache Spark will be cached off the Java heap (in sun.misc.Unsafe). What I haven't been able to find is if that data will have a well-known layout in bytes that can be interpreted with C or C++. Does anybody know? If so, will it be a "use at your own risk" specification or a supported API?
The reason I ask is that I have highly optimized C++ libraries that I currently can't use with Spark without copying through the JNI or shuttling to an external process or (equivalently) PySpark. It would be great to be able to run C++ code directly on the raw pointers without copying. (Read-only, of course.)
Does anybody know if there are plans to allow this? Spark has nice support for Scala/Java, Python, and R; it would be nice to add C/C++.
Thanks, zero323; by pointing me to the dev list, I was able to find the answer to my question.
http://apache-spark-developers-list.1001551.n3.nabble.com/Tungsten-off-heap-memory-access-for-C-libraries-td13898.html
The answer is that this is one of the motivating goals of the project, though it's still early in the design process (as of Oct 2015). There's a JIRA to track.

Rulesets for cppcheck

Cppcheck allows you to create your own rules files, but I don't know how much of cppcheck's functionality is exposed.
Is anyone working on a set that would enforce JSF or MISRA rules?
You won't be able to implement all MISRA/JSF rules and directives as cppcheck rules, mostly only the straightforward ones restricting certain C language features and constructions or that are style-related (some that come to mind: spaces before/after ./->, # of arguments on a single line, use of unions to provide different methods of accessing memory, presence of unsigned/signed before char, etc).
User Ira Baxter pretty much nailed it in a comment on another question touching cppcheck: not everything can be represented/simplified as a pattern. Relying on patterns for custom rules makes it difficult to handle and detect higher level issues, related for example to types (e.g. sizeof() on types; you would have to parse and collect tokens (typedefs, enums) used as a type representation), inheritance (e.g. classes, incl. derived ones, used both as virtual and non-virtual), and scope. Those need to be hard-coded into cppcheck (you could always fork cppcheck...)
In any case, have you touched MISRA (or JSF) rules? Is this a requirement for a project? If not, you could grab a copy of the MISRA guidelines (you already have the JSF ones) and check the ones you can implement using PCRE patterns. If it is a requirement, I suggest you "invest" in a commercial product that does check for MISRA/JSF guidelines and use both tools.
A final note: you don't need all the MISRA/JSF rules, and many tools leave a small percentage of those out.
Cppcheck has MISRA support. Here is an overview about the supported rules: supported MISRA rules
From what I can tell, looking through the documentation, It looks pretty exposed. http://cppcheck.sourceforge.net/manual.pdf .

Regular Expression in C++

I want to write C++ library for Regular Expression. I know there are many libraries available but I want to learn theory behind regular expression and implemented it by myself.
Can anybody please guide on what should I start with.
http://swtch.com/~rsc/regexp/regexp1.html has a good explanation of the two major approaches to regular expressions, their trade-offs, and how to make the faster one (DFAs) usable in a lot of cases that most implementations fail to use them for.
It's also worth looking into book "Compilers: Principles, Techniques, and Tools" that deeply covers techniques behind regular expression parsing (and the theory regarding DFAs and NDFAs). It has good pseudo-code examples that could help in creating own implementation
As long as you want to write the library, then in addition to referencing the excellent resources other answers give, you might explore implementing the C++0x specification for regular expressions found in chapter 28 of N3225.
As far as I'm concerned, this is THE book on the subject of regular expressions. It may not get you all the way to figuring out how to code up a C++ library, but the explanation of the theory is excellent and it includes a lot of examples for the practical application of regular expressions in many contexts.
http://oreilly.com/catalog/9780596528126?green=9514625548&cmp=af-mybuy-9780596528126.IP
In the Microsoft implementation of the TR1, which is the report for the next C++0x standard, there is the <regex> library available.
the TR1 is available for visual 2008, and by default in visual 2010.
But that's interesting only if you plan to program on the windows plateform, of course.
I don't know if g++ includes the <regex> library in its tr1 implementation. I guess yes, but I don't know.
I have used book http://www.amazon.com/Compiler-Design-C-Prentice-Hall-software/dp/0131550454
and implemented here http://code.google.com/p/regex/